Do not use ObjectStreamClass.lookupAny() to resolve interfaces

Fixes #130
This commit is contained in:
Trustin Lee 2011-12-15 16:37:21 +09:00
parent f38bf74f3e
commit f779a4415c
2 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ class CompactObjectInputStream extends ObjectInputStream {
case CompactObjectOutputStream.TYPE_THIN_DESCRIPTOR: case CompactObjectOutputStream.TYPE_THIN_DESCRIPTOR:
String className = readUTF(); String className = readUTF();
Class<?> clazz = classResolver.resolve(className); Class<?> clazz = classResolver.resolve(className);
return ObjectStreamClass.lookupAny(clazz); return ObjectStreamClass.lookup(clazz);
default: default:
throw new StreamCorruptedException( throw new StreamCorruptedException(
"Unexpected class descriptor type: " + type); "Unexpected class descriptor type: " + type);

View File

@ -39,7 +39,7 @@ class CompactObjectOutputStream extends ObjectOutputStream {
@Override @Override
protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException { protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
Class<?> clazz = desc.forClass(); Class<?> clazz = desc.forClass();
if (clazz.isPrimitive() || clazz.isArray()) { if (clazz.isPrimitive() || clazz.isArray() || desc.getSerialVersionUID() == 0) {
write(TYPE_FAT_DESCRIPTOR); write(TYPE_FAT_DESCRIPTOR);
super.writeClassDescriptor(desc); super.writeClassDescriptor(desc);
} else { } else {