From 6e40e558da01f55245b8a1027e9f122180e65abd Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Tue, 23 May 2017 16:21:21 -0400 Subject: [PATCH] Use Thread ContextClassLoader in ConfigurableObjectInputStream Issue: SWF-1690 --- .../snapshot/SerializedFlowExecutionSnapshot.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshot.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshot.java index a91af8e7..cb0b726d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshot.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/snapshot/SerializedFlowExecutionSnapshot.java @@ -248,7 +248,12 @@ public class SerializedFlowExecutionSnapshot extends FlowExecutionSnapshot imple public ConfigurableObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException { super(in); - this.classLoader = classLoader; + this.classLoader = initClassLoader(classLoader); + } + + private static ClassLoader initClassLoader(ClassLoader defaultClassLoader) { + ClassLoader result = Thread.currentThread().getContextClassLoader(); + return result != null ? result : defaultClassLoader; } protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {