From 5905afbf06aa390d6e580d75f3e1419f9cf67472 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Wed, 30 Sep 2009 14:44:20 -0700 Subject: 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. --- luni/src/main/java/java/io/ObjectInputStream.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'luni') 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( -- cgit v1.1