Polish RedisIndexedSessionRepository
This commit addresses code warnings due to nullability of return values.
This commit is contained in:
@@ -480,6 +480,9 @@ public class RedisIndexedSessionRepository
|
||||
}
|
||||
String principalKey = getPrincipalKey(indexValue);
|
||||
Set<Object> sessionIds = this.sessionRedisOperations.boundSetOps(principalKey).members();
|
||||
if (sessionIds == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<String, RedisSession> sessions = new HashMap<>(sessionIds.size());
|
||||
for (Object id : sessionIds) {
|
||||
RedisSession session = findById((String) id);
|
||||
@@ -499,7 +502,7 @@ public class RedisIndexedSessionRepository
|
||||
*/
|
||||
private RedisSession getSession(String id, boolean allowExpired) {
|
||||
Map<String, Object> entries = getSessionBoundHashOperations(id).entries();
|
||||
if (entries.isEmpty()) {
|
||||
if ((entries == null) || entries.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
MapSession loaded = new RedisSessionMapper(id).apply(entries);
|
||||
|
||||
Reference in New Issue
Block a user