Merge "Fix SslError.getPrimaryError() to return -1 if the set of errors is empty"

This commit is contained in:
Steve Block
2011-10-06 08:48:52 -07:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 4 deletions

View File

@@ -198,7 +198,8 @@ public class SslError {
/**
* 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() {
if (mErrors != 0) {
@@ -208,9 +209,11 @@ public class SslError {
return error;
}
}
// mErrors should never be set to an invalid value.
assert false;
}
return 0;
return -1;
}
/**

View File

@@ -159,7 +159,7 @@ class SslErrorHandlerImpl extends SslErrorHandler {
if (DebugFlags.SSL_ERROR_HANDLER) {
assert host != null;
assert primary != 0;
assert primary != -1;
}
if (mSslPrefTable.containsKey(host) && primary <= mSslPrefTable.getInt(host)) {
@@ -260,7 +260,7 @@ class SslErrorHandlerImpl extends SslErrorHandler {
if (DebugFlags.SSL_ERROR_HANDLER) {
assert host != null;
assert primary != 0;
assert primary != -1;
}
boolean hasKey = mSslPrefTable.containsKey(host);
if (!hasKey || primary > mSslPrefTable.getInt(host)) {