summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2012-05-17 11:18:33 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-17 11:18:33 -0700
commit9cb376e792567b5278e0eb418a3aeb848339a283 (patch)
tree69adbbcabfc873fc59c58a4d3d780f7e936e6f08 /core/java
parent0a95ce9ffbfa39def9186c736f6b135d251bc810 (diff)
parent2108ead7f125536874d6de6ca1c0c4cffbf61b44 (diff)
downloadframeworks_base-9cb376e792567b5278e0eb418a3aeb848339a283.zip
frameworks_base-9cb376e792567b5278e0eb418a3aeb848339a283.tar.gz
frameworks_base-9cb376e792567b5278e0eb418a3aeb848339a283.tar.bz2
Merge "Change NPN to forbid empty lists of protocols." into jb-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/SSLCertificateSocketFactory.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java
index 6a4f1f2..2703f1d 100644
--- a/core/java/android/net/SSLCertificateSocketFactory.java
+++ b/core/java/android/net/SSLCertificateSocketFactory.java
@@ -261,8 +261,8 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
* server then the first protocol in the client's list will be selected.
* The order of the client's protocols is otherwise insignificant.
*
- * @param npnProtocols a possibly-empty list of protocol byte arrays. All
- * arrays must be non-empty and of length less than 256.
+ * @param npnProtocols a non-empty list of protocol byte arrays. All arrays
+ * must be non-empty and of length less than 256.
*/
public void setNpnProtocols(byte[][] npnProtocols) {
this.mNpnProtocols = toNpnProtocolsList(npnProtocols);
@@ -273,6 +273,9 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
* strings.
*/
static byte[] toNpnProtocolsList(byte[]... npnProtocols) {
+ if (npnProtocols.length == 0) {
+ throw new IllegalArgumentException("npnProtocols.length == 0");
+ }
int totalLength = 0;
for (byte[] s : npnProtocols) {
if (s.length == 0 || s.length > 255) {