From 56f7f98a0678761860161b7570abf95442b68667 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Fri, 16 Dec 2022 09:16:34 +0100 Subject: [PATCH] fix NPE in CacheSupport --- build.number | 4 ++-- .../src/lucee/extension/io/cache/redis/CacheSupport.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.number b/build.number index 19c321b..c715e40 100644 --- a/build.number +++ b/build.number @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Mon Nov 28 19:33:16 CET 2022 -build.number=48 +#Fri Dec 16 09:13:01 CET 2022 +build.number=49 diff --git a/source/java/src/lucee/extension/io/cache/redis/CacheSupport.java b/source/java/src/lucee/extension/io/cache/redis/CacheSupport.java index 84d752d..8cd0516 100644 --- a/source/java/src/lucee/extension/io/cache/redis/CacheSupport.java +++ b/source/java/src/lucee/extension/io/cache/redis/CacheSupport.java @@ -31,7 +31,7 @@ public List keys(CacheEntryFilter filter) throws IOException { while (it.hasNext()) { key = it.next(); entry = getQuiet(key, null); - if (all || filter.accept(entry)) list.add(key); + if (entry != null && (all || filter.accept(entry))) list.add(key); } return list; } @@ -44,7 +44,7 @@ public List entries(CacheEntryFilter filter) throws IOException { CacheEntry entry; while (it.hasNext()) { entry = it.next(); - if (entry != null && filter.accept(entry)) { + if (entry != null && (filter == null || filter.accept(entry))) { list.add(entry); } } @@ -65,7 +65,7 @@ public List values(CacheEntryFilter filter) throws IOException { while (it.hasNext()) { key = it.next(); entry = getQuiet(key, null); - if (filter.accept(entry)) list.add(entry.getValue()); + if (entry != null && (filter == null || filter.accept(entry))) list.add(entry.getValue()); } return list; } @@ -85,7 +85,7 @@ public int remove(CacheEntryFilter filter) throws IOException { while (it.hasNext()) { key = it.next(); entry = getQuiet(key, null); - if (filter == null || filter.accept(entry)) { + if (entry != null && (filter == null || filter.accept(entry))) { remove(key); count++; }