copy array values in a smartest way
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/digester/trunk@1142272 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/digester3/CallMethodRule.java b/src/main/java/org/apache/commons/digester3/CallMethodRule.java
index 80a86e9..7897cd3 100644
--- a/src/main/java/org/apache/commons/digester3/CallMethodRule.java
+++ b/src/main/java/org/apache/commons/digester3/CallMethodRule.java
@@ -19,6 +19,7 @@
* under the License.
*/
+import static java.lang.System.arraycopy;
import static java.lang.String.format;
import static java.util.Arrays.fill;
import static org.apache.commons.beanutils.ConvertUtils.convert;
@@ -196,10 +197,7 @@
// copy the parameter class names into an array
// the classes will be loaded when the digester is set
this.paramClassNames = new String[paramTypes.length];
- for ( int i = 0; i < this.paramClassNames.length; i++ )
- {
- this.paramClassNames[i] = paramTypes[i];
- }
+ arraycopy( paramTypes, 0, this.paramClassNames, 0, paramTypes.length );
}
}
@@ -246,10 +244,7 @@
else
{
this.paramTypes = new Class[paramTypes.length];
- for ( int i = 0; i < this.paramTypes.length; i++ )
- {
- this.paramTypes[i] = paramTypes[i];
- }
+ arraycopy( paramTypes, 0, this.paramTypes, 0, paramTypes.length );
}
}