Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
bug fixed for multi-version different classloader error. for issue 616.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed May 8, 2016
1 parent 40b67a9 commit af9fbff
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/com/alibaba/fastjson/util/ASMClassLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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(){
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit af9fbff

Please sign in to comment.