From c6ef712503412752968a0715be64864c795adc6e Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 15 Dec 2011 16:35:27 +0900 Subject: [PATCH] Do not use ObjectStreamClass.lookupAny() to resolve interfaces Fixes #130 --- .../handler/codec/serialization/CompactObjectInputStream.java | 2 -- .../handler/codec/serialization/CompactObjectOutputStream.java | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java index 4c3259ccd5..8a4282f21b 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectInputStream.java @@ -55,8 +55,6 @@ class CompactObjectInputStream extends ObjectInputStream { case CompactObjectOutputStream.TYPE_THIN_DESCRIPTOR: String className = readUTF(); Class clazz = classResolver.resolve(className); - - // change lookupAny to lookup as lookupAny is only supported in java6 return ObjectStreamClass.lookup(clazz); default: throw new StreamCorruptedException( diff --git a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java index d77b245bc7..d17157b581 100644 --- a/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java +++ b/src/main/java/org/jboss/netty/handler/codec/serialization/CompactObjectOutputStream.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.ObjectOutputStream; import java.io.ObjectStreamClass; import java.io.OutputStream; +import java.io.Serializable; /** */ @@ -39,7 +40,7 @@ class CompactObjectOutputStream extends ObjectOutputStream { @Override protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException { Class clazz = desc.forClass(); - if (clazz.isPrimitive() || clazz.isArray()) { + if (clazz.isPrimitive() || clazz.isArray() || desc.getSerialVersionUID() == 0) { write(TYPE_FAT_DESCRIPTOR); super.writeClassDescriptor(desc); } else {