Skip to content

Commit 87004d7

Browse files
committed
[bugfix] cache:put should never return null
1 parent 163411e commit 87004d7

File tree

1 file changed

+5
-1
lines changed
  • extensions/modules/cache/src/main/java/org/exist/xquery/modules/cache

1 file changed

+5
-1
lines changed

extensions/modules/cache/src/main/java/org/exist/xquery/modules/cache/Cache.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ public CacheConfig getConfig() {
5757
}
5858

5959
public Sequence put(final String key, final Sequence value) {
60-
return store.asMap().put(key, value);
60+
final Sequence previous = store.asMap().put(key, value);
61+
if (previous != null) {
62+
return previous;
63+
}
64+
return Sequence.EMPTY_SEQUENCE;
6165
}
6266

6367
public Sequence list(final String[] keys) throws XPathException {

0 commit comments

Comments
 (0)