Return-Path: X-Original-To: apmail-tapestry-dev-archive@www.apache.org Delivered-To: apmail-tapestry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C41ED2879 for ; Fri, 29 Apr 2011 22:56:24 +0000 (UTC) Received: (qmail 97357 invoked by uid 500); 29 Apr 2011 22:56:24 -0000 Delivered-To: apmail-tapestry-dev-archive@tapestry.apache.org Received: (qmail 97309 invoked by uid 500); 29 Apr 2011 22:56:24 -0000 Mailing-List: contact commits-help@tapestry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tapestry.apache.org Delivered-To: mailing list commits@tapestry.apache.org Received: (qmail 97302 invoked by uid 99); 29 Apr 2011 22:56:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Apr 2011 22:56:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Apr 2011 22:56:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8CB232388C29; Fri, 29 Apr 2011 22:56:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@tapestry.apache.org From: hlship@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110429225603.8CB232388C29@eris.apache.org> 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 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)); } }