8003265: Need to clone array of input/output parameters
authorxuelei
Fri, 28 Dec 2012 03:50:57 -0800
changeset 14930 d05f028770b9
parent 14929 59377f4b9919
child 14931 60d0e9160ae4
child 14932 cf325f3b80b1
8003265: Need to clone array of input/output parameters Reviewed-by: mullan
jdk/src/share/classes/com/sun/jndi/dns/DnsContext.java
jdk/src/share/classes/com/sun/jndi/ldap/BasicControl.java
--- a/jdk/src/share/classes/com/sun/jndi/dns/DnsContext.java	Fri Dec 28 00:48:12 2012 -0800
+++ b/jdk/src/share/classes/com/sun/jndi/dns/DnsContext.java	Fri Dec 28 03:50:57 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2012, 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
@@ -102,8 +102,8 @@
         this.domain = new DnsName(domain.endsWith(".")
                                   ? domain
                                   : domain + ".");
-        this.servers = servers;
-        this.environment = (Hashtable<Object,Object>) environment.clone();
+        this.servers = servers.clone();
+        this.environment = (Hashtable<Object,Object>)environment.clone();
         envShared = false;
         parentIsDns = false;
         resolver = null;
@@ -129,11 +129,11 @@
      * no conflict.
      */
     private DnsContext(DnsContext ctx) {
-        environment = ctx.environment;
+        environment = (Hashtable<Object,Object>)environment.clone();
         envShared = ctx.envShared = true;
         parentIsDns = ctx.parentIsDns;
         domain = ctx.domain;
-        servers = ctx.servers;
+        servers = ctx.servers.clone();
         resolver = ctx.resolver;
         authoritative = ctx.authoritative;
         recursion = ctx.recursion;
--- a/jdk/src/share/classes/com/sun/jndi/ldap/BasicControl.java	Fri Dec 28 00:48:12 2012 -0800
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/BasicControl.java	Fri Dec 28 03:50:57 2012 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, 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
@@ -81,7 +81,7 @@
         this.id = id;
         this.criticality = criticality;
         if (value != null) {
-            this.value = value;
+            this.value = value.clone();
         }
     }