Do not use ObjectStreamClass.lookupAny() to resolve interfaces
Fixes #130
This commit is contained in:
parent
f38bf74f3e
commit
f779a4415c
@ -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);
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user