commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1799682 - /commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
Date Fri, 23 Jun 2017 15:36:24 GMT
Author: rmannibucau
Date: Fri Jun 23 15:36:24 2017
New Revision: 1799682

URL: http://svn.apache.org/viewvc?rev=1799682&view=rev
Log:
JCS-180 if there is no argument we don't want to fail with a npe in CacheInvocationContextImpl

Modified:
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java?rev=1799682&r1=1799681&r2=1799682&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
(original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/cdi/CacheInvocationContextImpl.java
Fri Jun 23 15:36:24 2017
@@ -18,16 +18,18 @@
  */
 package org.apache.commons.jcs.jcache.cdi;
 
-import java.lang.annotation.Annotation;
-import java.util.HashSet;
 import javax.cache.annotation.CacheInvocationContext;
 import javax.cache.annotation.CacheInvocationParameter;
 import javax.interceptor.InvocationContext;
+import java.lang.annotation.Annotation;
+import java.util.HashSet;
 
 import static java.util.Arrays.asList;
 
 public class CacheInvocationContextImpl<A extends Annotation> extends CacheMethodDetailsImpl<A>
implements CacheInvocationContext<A>
 {
+    private static final Object[] EMPTY_ARGS = new Object[0];
+
     private CacheInvocationParameter[] parameters = null;
 
     public CacheInvocationContextImpl(final InvocationContext delegate, final A cacheAnnotation,
final String cacheName)
@@ -63,7 +65,8 @@ public class CacheInvocationContextImpl<
 
     protected CacheInvocationParameter[] doGetAllParameters(final Integer[] indexes)
     {
-        final Object[] args = delegate.getParameters();
+        final Object[] parameters = delegate.getParameters();
+        final Object[] args = parameters == null ? EMPTY_ARGS : parameters;
         final Class<?>[] parameterTypes = getMethod().getParameterTypes();
         final Annotation[][] parameterAnnotations = getMethod().getParameterAnnotations();
 



Mime
View raw message