ObjectInputStream.java (readFields): Turn off readDataFromBlock while reading via GetField.

* java/io/ObjectInputStream.java (readFields): Turn off
	readDataFromBlock while reading via GetField.
	(GetField$1.get(String, Object)): Pass Class of default value to
	getField.
	(getField): Allow for null default values.

	* java/io/ObjectOutputStream.java: Fixed typo in comment.
	(PutField$1.put): Fixed calls of checkType in most of the put
	methods to pass the correct parameter.
	(PutField$1.put(String, Object)): Allow for null value arg.
	(PutField$1.write): Turn off writeDataAsBlocks while writing via
	PutField.

	* java/io/ObjectStreamClass.java (serialPersistentFields): Fixed
	typo in spec'ed field name.
	(getSerialPersistentFields): Changed spelling of method to match
	the correct spelling of the spec'ed field name.

More serialization fixes per Mauve errors.

From-SVN: r35468
This commit is contained in:
Warren Levy 2000-08-04 00:42:20 +00:00 committed by Warren Levy
parent a1bcc528be
commit 9b4773cbba
4 changed files with 50 additions and 17 deletions

View file

@ -700,9 +700,15 @@ public class ObjectInputStream extends InputStream
final ObjectStreamClass clazz = this.currentObjectStreamClass;
final byte[] prim_field_data = new byte[clazz.primFieldSize];
final Object[] objs = new Object[clazz.objectFieldCount];
// Apparently Block data is not used with GetField as per
// empirical evidence against JDK 1.2. Also see Mauve test
// java.io.ObjectInputOutput.Test.GetPutField.
setBlockDataMode (false);
readFully (prim_field_data);
for (int i = 0; i < objs.length; ++ i)
objs[i] = readObject ();
setBlockDataMode (true);
return new GetField ()
{
@ -843,7 +849,8 @@ public class ObjectInputStream extends InputStream
public Object get (String name, Object defvalue)
throws IOException, IllegalArgumentException
{
ObjectStreamField field = getField (name, null);
ObjectStreamField field =
getField (name, defvalue == null ? null : defvalue.getClass ());
if (field == null)
return defvalue;
@ -862,7 +869,7 @@ public class ObjectInputStream extends InputStream
Class field_type = field.getType ();
if (type == field_type ||
(type != null && field_type.isPrimitive ()))
(type == null && ! field_type.isPrimitive ()))
return field;
throw new IllegalArgumentException ("Field requested is of type "