8003671: [findbugs] sun.management.AgentConfigurationError.getParams() may expose internal representation by returning AgentConfigurationError.params
Reviewed-by: mchung, rbackman, jbachorik
--- 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;