fixed findbugs violation: URF_UNREAD_FIELD
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/digester/trunk@1142025 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java b/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java
index 1349776..3890c79 100644
--- a/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java
+++ b/src/main/java/org/apache/commons/digester3/annotations/reflect/MethodArgument.java
@@ -19,6 +19,8 @@
* under the License.
*/
+import static java.lang.System.arraycopy;
+
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
@@ -55,9 +57,20 @@
*/
public MethodArgument( int index, Class<?> parameterType, Annotation[] annotations )
{
+ if ( parameterType == null )
+ {
+ throw new IllegalArgumentException( "Argument 'parameterType' must be not null" );
+ }
+ if ( annotations == null )
+ {
+ throw new IllegalArgumentException( "Argument 'annotations' must be not null" );
+ }
+
this.index = index;
this.parameterType = parameterType;
- this.annotations = annotations;
+ this.annotations = new Annotation[annotations.length];
+
+ arraycopy( annotations, 0, this.annotations, 0, annotations.length );
}
/**