Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
RuedigerMoeller committed May 17, 2020
2 parents c3ae98c + 0ea32ec commit 8b1c953
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -20,6 +20,7 @@
import org.nustaq.serialization.util.FSTUtil;

import java.io.IOException;
import java.lang.reflect.Proxy;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;

Expand Down Expand Up @@ -182,6 +183,8 @@ public FSTClazzInfo decodeClass(FSTDecoder in, FSTConfiguration conf) throws IOE
}
}


private static final String JDKPROXYCLASSPREFIX = "com.sun.proxy.$Proxy"; // Might only work with Oracle JDK
HashMap<String,Class> classCache = new HashMap<String, Class>(200);
AtomicBoolean classCacheLock = new AtomicBoolean(false);
public Class classForName(String clName, FSTConfiguration conf) throws ClassNotFoundException {
Expand Down Expand Up @@ -214,7 +217,10 @@ public Class classForName(String clName, FSTConfiguration conf) throws ClassNotF
}
}
return actorClz;
} else {
} else if (clName.startsWith(JDKPROXYCLASSPREFIX)) {
res = Proxy.class;
}
else {
if ( conf.getLastResortResolver() != null ) {
Class aClass = conf.getLastResortResolver().getClass(clName);
if ( aClass != null )
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/nustaq/serialization/FSTConfiguration.java
Expand Up @@ -34,6 +34,7 @@

import java.io.*;
import java.lang.ref.SoftReference;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
Expand Down Expand Up @@ -500,6 +501,7 @@ protected static FSTConfiguration initDefaultFstConfigurationInternal(FSTConfigu
reg.putSerializer(Hashtable.class, new FSTMapSerializer(), true);
reg.putSerializer(ConcurrentHashMap.class, new FSTMapSerializer(), true);
reg.putSerializer(Throwable.class, new FSTThrowableSerializer(),true);
reg.putSerializer(Proxy.class, new FSTProxySerializer(),true);

reg.putSerializer(BitSet.class, new FSTBitSetSerializer(),true);
reg.putSerializer(Timestamp.class, new FSTTimestampSerializer(),true);
Expand Down Expand Up @@ -836,6 +838,8 @@ void addDefaultClazzes() {
classRegistry.registerClass(Timestamp.class, this);
classRegistry.registerClass(Locale.class,this);

classRegistry.registerClass(Proxy.class,this);

classRegistry.registerClass(StringBuffer.class,this);
classRegistry.registerClass(StringBuilder.class,this);

Expand Down

0 comments on commit 8b1c953

Please sign in to comment.