From af9fbffbd23fa8ef41814ee94efb9a346131eba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=93=81?= Date: Mon, 9 May 2016 05:30:54 +0800 Subject: [PATCH] bug fixed for multi-version different classloader error. for issue 616. https://github.com/alibaba/fastjson/issues/616 --- .../alibaba/fastjson/util/ASMClassLoader.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/alibaba/fastjson/util/ASMClassLoader.java b/src/main/java/com/alibaba/fastjson/util/ASMClassLoader.java index 6303c11928..a8684981a5 100755 --- a/src/main/java/com/alibaba/fastjson/util/ASMClassLoader.java +++ b/src/main/java/com/alibaba/fastjson/util/ASMClassLoader.java @@ -5,7 +5,17 @@ import java.util.Map; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.parser.DefaultJSONParser; +import com.alibaba.fastjson.parser.JSONLexerBase; +import com.alibaba.fastjson.parser.ParseContext; +import com.alibaba.fastjson.parser.ParserConfig; +import com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer; +import com.alibaba.fastjson.serializer.JSONSerializer; +import com.alibaba.fastjson.serializer.JavaBeanSerializer; +import com.alibaba.fastjson.serializer.ObjectSerializer; +import com.alibaba.fastjson.serializer.SerializeBeanInfo; import com.alibaba.fastjson.serializer.SerializeFilterable; +import com.alibaba.fastjson.serializer.SerializeWriter; public class ASMClassLoader extends ClassLoader { @@ -22,7 +32,17 @@ public Object run() { }); classMapping.put(JavaBeanInfo.class.getName(), JavaBeanInfo.class); + classMapping.put(ObjectSerializer.class.getName(), ObjectSerializer.class); + classMapping.put(JavaBeanSerializer.class.getName(), JavaBeanSerializer.class); classMapping.put(SerializeFilterable.class.getName(), SerializeFilterable.class); + classMapping.put(SerializeBeanInfo.class.getName(), SerializeBeanInfo.class); + classMapping.put(JSONSerializer.class.getName(), JSONSerializer.class); + classMapping.put(JavaBeanDeserializer.class.getName(), JavaBeanDeserializer.class); + classMapping.put(ParserConfig.class.getName(), ParserConfig.class); + classMapping.put(SerializeWriter.class.getName(), SerializeWriter.class); + classMapping.put(DefaultJSONParser.class.getName(), DefaultJSONParser.class); + classMapping.put(JSONLexerBase.class.getName(), JSONLexerBase.class); + classMapping.put(ParseContext.class.getName(), ParseContext.class); } public ASMClassLoader(){ @@ -51,6 +71,7 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE if (mappingClass != null) { return mappingClass; } + try { return super.loadClass(name, resolve); } catch (ClassNotFoundException e) {