ARTEMIS-3816 Fix connection router null pointer dereferences

This commit is contained in:
Domenico Francesco Bruscino 2022-05-06 13:18:35 +02:00 committed by Bruscino Domenico Francesco
parent d433f3bc3f
commit 7a03f58be9
3 changed files with 7 additions and 5 deletions

View File

@ -176,7 +176,7 @@ public class ConnectionRouter implements ActiveMQComponent {
return localTarget;
}
if (pool == null) {
if (policy == null || pool == null) {
return TargetResult.REFUSED_USE_ANOTHER_RESULT;
}

View File

@ -186,7 +186,7 @@ public final class ConnectionRouterManager implements ActiveMQComponent {
policy.init(policyConfig.getProperties());
if (policy.getTargetProbe() != null) {
if (pool != null && policy.getTargetProbe() != null) {
pool.addTargetProbe(policy.getTargetProbe());
}

View File

@ -71,9 +71,11 @@ public class LocalCache implements Cache, RemovalListener<String, String> {
if (persisted) {
persistedCacheEntries = storageManager.getPersistedKeyValuePairs(id);
for (Map.Entry<String, PersistedKeyValuePair> cacheEntry : persistedCacheEntries.entrySet()) {
cache.put(cacheEntry.getKey(), cacheEntry.getValue().getValue());
logger.info(cacheEntry.toString());
if (persistedCacheEntries != null) {
for (Map.Entry<String, PersistedKeyValuePair> cacheEntry : persistedCacheEntries.entrySet()) {
cache.put(cacheEntry.getKey(), cacheEntry.getValue().getValue());
logger.info(cacheEntry.toString());
}
}
}