summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-10-06 08:48:52 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-06 08:48:52 -0700
commit3475ebfab28fbecc22841c692dbd0cbdba48417d (patch)
treea79d203b14d19b7751d110f1f574c8b899192cd9
parent11a670531febb0952224a0b819eb5350022fbe69 (diff)
parent518f72ca38f4a5e1dfcfade6b40e4fd082dd9fd8 (diff)
downloadframeworks_base-3475ebfab28fbecc22841c692dbd0cbdba48417d.zip
frameworks_base-3475ebfab28fbecc22841c692dbd0cbdba48417d.tar.gz
frameworks_base-3475ebfab28fbecc22841c692dbd0cbdba48417d.tar.bz2
Merge "Fix SslError.getPrimaryError() to return -1 if the set of errors is empty"
-rw-r--r--core/java/android/net/http/SslError.java7
-rw-r--r--core/java/android/webkit/SslErrorHandlerImpl.java4
2 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/net/http/SslError.java b/core/java/android/net/http/SslError.java
index 5998f5f..863304c 100644
--- a/core/java/android/net/http/SslError.java
+++ b/core/java/android/net/http/SslError.java
@@ -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;
}
/**
diff --git a/core/java/android/webkit/SslErrorHandlerImpl.java b/core/java/android/webkit/SslErrorHandlerImpl.java
index 82cd3e8..b2e4b13 100644
--- a/core/java/android/webkit/SslErrorHandlerImpl.java
+++ b/core/java/android/webkit/SslErrorHandlerImpl.java
@@ -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)) {