Skip to content

Commit

Permalink
INTERNAL: Log info level when null value is present to ArcusCache.put…
Browse files Browse the repository at this point in the history
…IfAbsent() method.
  • Loading branch information
uhm0311 committed Jun 14, 2024
1 parent c23599d commit 241a379
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ public ValueWrapper putIfAbsent(Object key, Object value) {
logger.debug("trying to add key: {}", arcusKey);

if (value == null) {
throw new IllegalArgumentException("arcus cannot add NULL value. key: " + arcusKey);
logger.info("arcus cannot putIfAbsent NULL value. key: {}", arcusKey);
return null;
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1306,12 +1306,14 @@ public void testPutIfAbsent_FrontCache_FutureException_ForceFrontCaching() {
}

@Test
@SuppressWarnings("deprecation")
public void testPutIfAbsent_FrontCache_Null() {
// given
IllegalArgumentException exception = null;
arcusCache.setArcusFrontCache(arcusFrontCache);
arcusCache.setExpireSeconds(EXPIRE_SECONDS);
arcusCache.setFrontExpireSeconds(FRONT_EXPIRE_SECONDS);
arcusCache.setWantToGetException(true);
when(arcusClientPool.add(arcusKey, EXPIRE_SECONDS, VALUE))
.thenReturn(createOperationFuture(true));
when(arcusClientPool.asyncGet(arcusKey))
Expand All @@ -1331,7 +1333,7 @@ public void testPutIfAbsent_FrontCache_Null() {
.asyncGet(arcusKey);
verify(arcusFrontCache, never())
.set(arcusKey, VALUE, FRONT_EXPIRE_SECONDS);
assertNotNull(exception);
assertNull(exception);
}

private static GetFuture<Object> createGetFuture(
Expand Down

0 comments on commit 241a379

Please sign in to comment.