Skip to content

Commit

Permalink
STORM-1853: Replace ClassLoaderObjectInputStream with ObjectInputStream
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek Agarwal committed May 20, 2016
1 parent 7981ef2 commit fafbaeb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions storm-core/src/jvm/org/apache/storm/utils/Utils.java
Expand Up @@ -161,7 +161,7 @@ public static Utils setInstance(Utils u) {
private static ThreadLocal<TDeserializer> threadDes = new ThreadLocal<TDeserializer>();

private static SerializationDelegate serializationDelegate;
private static ClassLoader cl = ClassLoader.getSystemClassLoader();
private static ClassLoader cl = null;

public static final boolean IS_ON_WINDOWS = "Windows_NT".equals(System.getenv("OS"));
public static final String FILE_PATH_SEPARATOR = System.getProperty("file.separator");
Expand Down Expand Up @@ -238,7 +238,13 @@ public static byte[] javaSerialize(Object obj) {
public static <T> T javaDeserialize(byte[] serialized, Class<T> clazz) {
try {
ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
ObjectInputStream ois = new ClassLoaderObjectInputStream(cl, bis);
ObjectInputStream ois = null;
if (null == cl) {
ois = new ObjectInputStream(bis);
} else {
// Use custom class loader set in testing environment
ois = new ClassLoaderObjectInputStream(cl, bis);
}
Object ret = ois.readObject();
ois.close();
return (T)ret;
Expand Down

0 comments on commit fafbaeb

Please sign in to comment.