8003671: [findbugs] sun.management.AgentConfigurationError.getParams() may expose internal representation by returning AgentConfigurationError.params
authorsla
Tue, 30 Apr 2013 10:48:25 +0200
changeset 17197 8ee6909f1320
parent 17196 ef8b87b1597c
child 17198 32db080a2a70
8003671: [findbugs] sun.management.AgentConfigurationError.getParams() may expose internal representation by returning AgentConfigurationError.params Reviewed-by: mchung, rbackman, jbachorik
jdk/src/share/classes/sun/management/AgentConfigurationError.java
--- a/jdk/src/share/classes/sun/management/AgentConfigurationError.java	Mon Apr 29 22:03:04 2013 -0700
+++ b/jdk/src/share/classes/sun/management/AgentConfigurationError.java	Tue Apr 30 10:48:25 2013 +0200
@@ -128,19 +128,13 @@
     public AgentConfigurationError(String error, String... params) {
         super();
         this.error = error;
-        this.params = new String[params.length];
-        for (int i = 0; i < params.length; i++) {
-            this.params[i] = params[i];
-        }
+        this.params = params.clone();
     }
 
     public AgentConfigurationError(String error, Throwable cause, String... params) {
         super(cause);
         this.error = error;
-        this.params = new String[params.length];
-        for (int i = 0; i < params.length; i++) {
-            this.params[i] = params[i];
-        }
+        this.params = params.clone();
     }
 
     public String getError() {
@@ -148,7 +142,7 @@
     }
 
     public String[] getParams() {
-        return params;
+        return params.clone();
     }
 
     private static final long serialVersionUID = 1211605593516195475L;