From f30ff1343be4784000be803f77e9828151a83fb3 Mon Sep 17 00:00:00 2001 From: SrdjanStevanetic Date: Thu, 2 Nov 2023 10:01:48 +0100 Subject: [PATCH] sonar bugs --- .../api/translation/web/service/RedisCacheService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java b/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java index 7adc0773..0ae27d45 100644 --- a/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java +++ b/translation-web/src/main/java/eu/europeana/api/translation/web/service/RedisCacheService.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -48,8 +49,9 @@ public void saveRedisCache(String sourceLang, String targetLang, List in } public void deleteAll() { - if(redisTemplate.getConnectionFactory()!=null) { - redisTemplate.getConnectionFactory().getConnection().flushAll(); + RedisConnectionFactory connFact=redisTemplate.getConnectionFactory(); + if(connFact!=null) { + connFact.getConnection().flushAll(); } }