@@ -66,13 +66,18 @@ public MagicHandler(CacheHandler cacheHandler, CacheAopProxyChain pjp, Cache cac
6666 this .magic = cache .magic ();
6767 this .arguments = pjp .getArgs ();
6868 this .iterableArgIndex = magic .iterableArgIndex ();
69- Object tmpArg = arguments [iterableArgIndex ];
70- if (tmpArg instanceof Collection ) {
71- this .iterableCollectionArg = (Collection <Object >) tmpArg ;
72- this .iterableArrayArg = null ;
73- } else if (tmpArg .getClass ().isArray ()) {
74- this .iterableArrayArg = (Object []) tmpArg ;
75- this .iterableCollectionArg = null ;
69+ if (iterableArgIndex >= 0 && iterableArgIndex < arguments .length ) {
70+ Object tmpArg = arguments [iterableArgIndex ];
71+ if (tmpArg instanceof Collection ) {
72+ this .iterableCollectionArg = (Collection <Object >) tmpArg ;
73+ this .iterableArrayArg = null ;
74+ } else if (tmpArg .getClass ().isArray ()) {
75+ this .iterableArrayArg = (Object []) tmpArg ;
76+ this .iterableCollectionArg = null ;
77+ } else {
78+ this .iterableArrayArg = null ;
79+ this .iterableCollectionArg = null ;
80+ }
7681 } else {
7782 this .iterableArrayArg = null ;
7883 this .iterableCollectionArg = null ;
@@ -332,6 +337,7 @@ private Object getValueFormCacheOrDatasource(CacheKeyTO cacheKeyTO, Map<CacheKey
332337
333338 /**
334339 * 生成缓存Key
340+ *
335341 * @return
336342 */
337343 private Map <CacheKeyTO , Object > getCacheKeyForMagic () {
0 commit comments