summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-10-05 18:48:09 +0100
committerSteve Block <steveblock@google.com>2011-10-05 23:09:23 +0100
commit518f72ca38f4a5e1dfcfade6b40e4fd082dd9fd8 (patch)
tree1b0b9b4e9a9cdae4a00ae9c784be81ed7f564785 /core/java
parent4198627a284a9dbdd7a16f98c4fbcf5032c6020f (diff)
downloadframeworks_base-518f72ca38f4a5e1dfcfade6b40e4fd082dd9fd8.zip
frameworks_base-518f72ca38f4a5e1dfcfade6b40e4fd082dd9fd8.tar.gz
frameworks_base-518f72ca38f4a5e1dfcfade6b40e4fd082dd9fd8.tar.bz2
Fix SslError.getPrimaryError() to return -1 if the set of errors is empty
Also fix a couple of buggy asserts. Bug: 5416594 Change-Id: I0e7e2548886af5fc0b8c20f70a3040d2c5bc68ea
Diffstat (limited to 'core/java')
-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)) {