Do not use ObjectStreamClass.lookupAny() to resolve interfaces

Fixes #130
This commit is contained in:
Trustin Lee 2011-12-15 16:35:27 +09:00
parent 8145ad96f6
commit c6ef712503
2 changed files with 2 additions and 3 deletions

View File

@ -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(

View File

@ -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 {