From 1bd9954a761fa73eed69436befe30ab3d90606ee Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 7 Feb 2020 10:51:22 -0500 Subject: [PATCH] Fix NPE in the DefaultSessionFactoryLocator **Cherry-pick to 5.2.x** (cherry picked from commit 00b771d8a8f83cf9bf9fdbe1cf4eb190c0786dd7) --- .../file/remote/session/DefaultSessionFactoryLocator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/DefaultSessionFactoryLocator.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/DefaultSessionFactoryLocator.java index 15bdd175f1..f425456278 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/DefaultSessionFactoryLocator.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/DefaultSessionFactoryLocator.java @@ -89,7 +89,9 @@ public class DefaultSessionFactoryLocator implements SessionFactoryLocator @Override public SessionFactory getSessionFactory(@Nullable Object key) { - return this.factories.getOrDefault(key, this.defaultFactory); + return key == null + ? this.defaultFactory + : this.factories.getOrDefault(key, this.defaultFactory); } }