src/share/classes/com/sun/jndi/dns/DnsContext.java

Print this page
8005598 (reopened) Need to clone array of input/output parameters

@@ -100,11 +100,11 @@
             throws NamingException {
 
         this.domain = new DnsName(domain.endsWith(".")
                                   ? domain
                                   : domain + ".");
-        this.servers = servers;
+        this.servers = servers.clone();
         this.environment = (Hashtable<Object,Object>) environment.clone();
         envShared = false;
         parentIsDns = false;
         resolver = null;
 

@@ -127,15 +127,15 @@
      * context, for example, won't close the other).  The two contexts
      * share <tt>environment</tt>, but it's copy-on-write so there's
      * no conflict.
      */
     private DnsContext(DnsContext ctx) {
-        environment = ctx.environment;
+        environment = ctx.environment;  // shared environment, copy-on-write
         envShared = ctx.envShared = true;
         parentIsDns = ctx.parentIsDns;
         domain = ctx.domain;
-        servers = ctx.servers;
+        servers = ctx.servers;          // shared servers, no write operation
         resolver = ctx.resolver;
         authoritative = ctx.authoritative;
         recursion = ctx.recursion;
         timeout = ctx.timeout;
         retries = ctx.retries;