tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r1098003 - /tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java
Date Fri, 29 Apr 2011 22:56:03 GMT
Author: hlship
Date: Fri Apr 29 22:56:03 2011
New Revision: 1098003

URL: http://svn.apache.org/viewvc?rev=1098003&view=rev
Log:
TAP5-853: Safely dereference method parameter values which may be null

Modified:
    tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java

Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java?rev=1098003&r1=1098002&r2=1098003&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java
(original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticClassImpl.java
Fri Apr 29 22:56:03 2011
@@ -111,6 +111,14 @@ public class PlasticClassImpl extends Lo
         return PlasticUtils.getMethod(declaringClass, methodName, parameterTypes);
     }
 
+    private static <T> T safeArrayDeref(T[] array, int index)
+    {
+        if (array == null)
+            return null;
+
+        return array[index];
+    }
+
     private class PlasticMember implements AnnotationAccess
     {
         private final AnnotationAccess annotationAccess;
@@ -350,8 +358,9 @@ public class PlasticClassImpl extends Lo
 
                 for (int i = 0; i < description.argumentTypes.length; i++)
                 {
-                    parameters.add(new MethodParameterImpl(node.visibleParameterAnnotations[i],
-                            description.argumentTypes[i], i));
+
+                    parameters.add(new MethodParameterImpl(safeArrayDeref(node.visibleParameterAnnotations,
i),
+                            safeArrayDeref(description.argumentTypes, i), i));
                 }
             }
 



Mime
View raw message