Merge "Fix SslError.getPrimaryError() to return -1 if the set of errors is empty"
This commit is contained in:
@@ -198,7 +198,8 @@ public class SslError {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the most severe SSL error in this object's set of errors.
|
* Gets the most severe SSL error in this object's set of errors.
|
||||||
* @return The most severe SSL error.
|
* Returns -1 if the set is empty.
|
||||||
|
* @return The most severe SSL error, or -1 if the set is empty.
|
||||||
*/
|
*/
|
||||||
public int getPrimaryError() {
|
public int getPrimaryError() {
|
||||||
if (mErrors != 0) {
|
if (mErrors != 0) {
|
||||||
@@ -208,9 +209,11 @@ public class SslError {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// mErrors should never be set to an invalid value.
|
||||||
|
assert false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class SslErrorHandlerImpl extends SslErrorHandler {
|
|||||||
|
|
||||||
if (DebugFlags.SSL_ERROR_HANDLER) {
|
if (DebugFlags.SSL_ERROR_HANDLER) {
|
||||||
assert host != null;
|
assert host != null;
|
||||||
assert primary != 0;
|
assert primary != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSslPrefTable.containsKey(host) && primary <= mSslPrefTable.getInt(host)) {
|
if (mSslPrefTable.containsKey(host) && primary <= mSslPrefTable.getInt(host)) {
|
||||||
@@ -260,7 +260,7 @@ class SslErrorHandlerImpl extends SslErrorHandler {
|
|||||||
|
|
||||||
if (DebugFlags.SSL_ERROR_HANDLER) {
|
if (DebugFlags.SSL_ERROR_HANDLER) {
|
||||||
assert host != null;
|
assert host != null;
|
||||||
assert primary != 0;
|
assert primary != -1;
|
||||||
}
|
}
|
||||||
boolean hasKey = mSslPrefTable.containsKey(host);
|
boolean hasKey = mSslPrefTable.containsKey(host);
|
||||||
if (!hasKey || primary > mSslPrefTable.getInt(host)) {
|
if (!hasKey || primary > mSslPrefTable.getInt(host)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user