mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 02:05:12 +08:00
优化XStreamTransformer
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package me.chanjar.weixin.common.util.xml;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider;
|
||||
import com.thoughtworks.xstream.core.util.QuickWriter;
|
||||
@@ -9,8 +11,6 @@ import com.thoughtworks.xstream.io.xml.XppDriver;
|
||||
import com.thoughtworks.xstream.security.NullPermission;
|
||||
import com.thoughtworks.xstream.security.PrimitiveTypePermission;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
public class XStreamInitializer {
|
||||
|
||||
public static XStream getInstance() {
|
||||
@@ -38,7 +38,8 @@ public class XStreamInitializer {
|
||||
|
||||
@Override
|
||||
public String encodeNode(String name) {
|
||||
return name;//防止将_转换成__
|
||||
//防止将_转换成__
|
||||
return name;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -48,6 +49,7 @@ public class XStreamInitializer {
|
||||
xstream.setMode(XStream.NO_REFERENCES);
|
||||
xstream.addPermission(NullPermission.NULL);
|
||||
xstream.addPermission(PrimitiveTypePermission.PRIMITIVES);
|
||||
xstream.setClassLoader(Thread.currentThread().getContextClassLoader());
|
||||
return xstream;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user