diff options
author | Jesse Wilson <jessewilson@google.com> | 2009-09-30 14:44:20 -0700 |
---|---|---|
committer | Jesse Wilson <jessewilson@google.com> | 2009-09-30 14:44:20 -0700 |
commit | 5905afbf06aa390d6e580d75f3e1419f9cf67472 (patch) | |
tree | 433d0b7b3432425a3dde0179e3b0422ac7488840 /luni | |
parent | cbb67b37b1a0223097763f84ebae072eca183164 (diff) | |
download | libcore-5905afbf06aa390d6e580d75f3e1419f9cf67472.zip libcore-5905afbf06aa390d6e580d75f3e1419f9cf67472.tar.gz libcore-5905afbf06aa390d6e580d75f3e1419f9cf67472.tar.bz2 |
Fixing a Harmony regression in ObjectInputStream.
We check the field type against the instance being
populated and not the field descriptor on the wire.
The root cause is a bug in Harmony which we should
send upstream.
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/main/java/java/io/ObjectInputStream.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/luni/src/main/java/java/io/ObjectInputStream.java b/luni/src/main/java/java/io/ObjectInputStream.java index 7dc87ff..6d24eb2 100644 --- a/luni/src/main/java/java/io/ObjectInputStream.java +++ b/luni/src/main/java/java/io/ObjectInputStream.java @@ -1323,7 +1323,13 @@ public class ObjectInputStream extends InputStream implements ObjectInput, } if (fieldDesc != null) { if (toSet != null) { - Class<?> fieldType = fieldDesc.getType(); + // BEGIN android-changed + // Get the field type from the local field rather than + // from the stream's supplied data. That's the field + // we'll be setting, so that's the one that needs to be + // validated. + Class<?> fieldType = field.getTypeInternal(); + // END android-added Class<?> valueType = toSet.getClass(); if (!fieldType.isAssignableFrom(valueType)) { throw new ClassCastException(Msg.getString( |