From 518f72ca38f4a5e1dfcfade6b40e4fd082dd9fd8 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 5 Oct 2011 18:48:09 +0100 Subject: 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 --- core/java/android/net/http/SslError.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/java/android/net/http') 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; } /** -- cgit v1.1