8005598: (reopened) Need to clone array of input/output parameters
Reviewed-by: weijun
--- a/jdk/src/share/classes/com/sun/jndi/dns/DnsContext.java Mon May 13 05:41:51 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/dns/DnsContext.java Mon May 13 06:05:32 2013 -0700
@@ -102,7 +102,7 @@
this.domain = new DnsName(domain.endsWith(".")
? domain
: domain + ".");
- this.servers = servers;
+ this.servers = (servers == null) ? null : servers.clone();
this.environment = (Hashtable<Object,Object>) environment.clone();
envShared = false;
parentIsDns = false;
@@ -129,11 +129,11 @@
* 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;
--- a/jdk/src/share/classes/com/sun/jndi/ldap/BasicControl.java Mon May 13 05:41:51 2013 -0700
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/BasicControl.java Mon May 13 06:05:32 2013 -0700
@@ -81,7 +81,7 @@
this.id = id;
this.criticality = criticality;
if (value != null) {
- this.value = value;
+ this.value = value.clone();
}
}