File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/xml Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11
11
import com .thoughtworks .xstream .io .xml .XppDriver ;
12
12
import com .thoughtworks .xstream .security .NoTypePermission ;
13
13
import com .thoughtworks .xstream .security .WildcardTypePermission ;
14
-
15
14
import java .io .Writer ;
16
15
17
16
/**
20
19
* @author Daniel Qian
21
20
*/
22
21
public class XStreamInitializer {
22
+
23
+ public static ClassLoader classLoader ;
24
+
25
+ public static void setClassLoader (ClassLoader classLoaderInfo ) {
26
+ classLoader = classLoaderInfo ;
27
+ }
28
+
23
29
private static final XppDriver XPP_DRIVER = new XppDriver () {
24
30
@ Override
25
31
public HierarchicalStreamWriter createWriter (Writer out ) {
@@ -87,7 +93,10 @@ protected void setupConverters() {
87
93
xstream .addPermission (new WildcardTypePermission (new String []{
88
94
"me.chanjar.weixin.**" , "cn.binarywang.wx.**" , "com.github.binarywang.**"
89
95
}));
90
- xstream .setClassLoader (Thread .currentThread ().getContextClassLoader ());
96
+ if (null == classLoader ) {
97
+ classLoader = Thread .currentThread ().getContextClassLoader ();
98
+ }
99
+ xstream .setClassLoader (classLoader );
91
100
return xstream ;
92
101
}
93
102
You can’t perform that action at this time.
0 commit comments