changeset 4042:3fee1c67bd10

7029848: KeyStoreBuilderParameters((Builder)null) does not throw NullPointerException Summary: throws NPE for null Builder Reviewed-by: weijun
author xuelei
date Wed, 23 Mar 2011 20:07:46 -0700
parents b58572df94f1
children b921112e39d3
files src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java	Wed Mar 23 15:01:09 2011 -0700
+++ b/src/share/classes/javax/net/ssl/KeyStoreBuilderParameters.java	Wed Mar 23 20:07:46 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
      * @exception NullPointerException if builder is null
      */
     public KeyStoreBuilderParameters(Builder builder) {
-        parameters = Collections.singletonList(builder);
+        parameters = Collections.singletonList(Objects.requireNonNull(builder));
     }
 
     /**
@@ -64,11 +64,12 @@
      * @exception IllegalArgumentException if parameters is an empty list
      */
     public KeyStoreBuilderParameters(List<Builder> parameters) {
-        this.parameters = Collections.unmodifiableList(
-            new ArrayList<Builder>(parameters));
         if (this.parameters.isEmpty()) {
             throw new IllegalArgumentException();
         }
+
+        this.parameters = Collections.unmodifiableList(
+            new ArrayList<Builder>(parameters));
     }
 
     /**