changeset 17197:8ee6909f1320

8003671: [findbugs] sun.management.AgentConfigurationError.getParams() may expose internal representation by returning AgentConfigurationError.params Reviewed-by: mchung, rbackman, jbachorik
author sla
date Tue, 30 Apr 2013 10:48:25 +0200
parents ef8b87b1597c
children 32db080a2a70
files jdk/src/share/classes/sun/management/AgentConfigurationError.java
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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;