From f779a4415cedcfa445777b186c8fe1d6341278df Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 15 Dec 2011 16:37:21 +0900 Subject: [PATCH] Do not use ObjectStreamClass.lookupAny() to resolve interfaces Fixes #130 --- .../handler/codec/serialization/CompactObjectInputStream.java | 2 +- .../handler/codec/serialization/CompactObjectOutputStream.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/netty/handler/codec/serialization/CompactObjectInputStream.java b/src/main/java/io/netty/handler/codec/serialization/CompactObjectInputStream.java index baa9f16be1..7bfc0bfa7c 100644 --- a/src/main/java/io/netty/handler/codec/serialization/CompactObjectInputStream.java +++ b/src/main/java/io/netty/handler/codec/serialization/CompactObjectInputStream.java @@ -55,7 +55,7 @@ class CompactObjectInputStream extends ObjectInputStream { case CompactObjectOutputStream.TYPE_THIN_DESCRIPTOR: String className = readUTF(); Class clazz = classResolver.resolve(className); - return ObjectStreamClass.lookupAny(clazz); + return ObjectStreamClass.lookup(clazz); default: throw new StreamCorruptedException( "Unexpected class descriptor type: " + type); diff --git a/src/main/java/io/netty/handler/codec/serialization/CompactObjectOutputStream.java b/src/main/java/io/netty/handler/codec/serialization/CompactObjectOutputStream.java index d386ce3b72..2e88e7cc13 100644 --- a/src/main/java/io/netty/handler/codec/serialization/CompactObjectOutputStream.java +++ b/src/main/java/io/netty/handler/codec/serialization/CompactObjectOutputStream.java @@ -39,7 +39,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 {