Commit af7547b
committed
fix: getClassLoader() may return null
In the Java 8 + WAR + Tomcat runtime environment, when using CompletableFuture.runAsync() (which runs in ForkJoinPool), Thread.currentThread().getContextClassLoader() may return null.
Meanwhile, SerializerFactory#getClassFactory only creates a ClassFactory instance on its first invocation. If the first Dubbo call happens to be executed in ForkJoinPool, ClassFactory._loader will be initialized as null and will remain null permanently. As a result, all subsequent Dubbo calls will fail during deserialization (objects will be converted to HashMap).
Therefore, if classLoader is null at this point, it is better to throw an exception immediately to prevent ClassFactory from being initialized incorrectly.1 parent 36cef60 commit af7547b
File tree
1 file changed
+6
-1
lines changed- dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2
1 file changed
+6
-1
lines changedLines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
0 commit comments