2000-05-19 19:55:34 +02:00
|
|
|
/* ObjectInputStream.java -- Class used to read serialized objects
|
2004-02-28 22:28:53 +01:00
|
|
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
This file is part of GNU Classpath.
|
|
|
|
|
|
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
2003-03-01 16:05:46 +01:00
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA.
|
|
|
|
|
2002-01-22 23:40:42 +01:00
|
|
|
Linking this library statically or dynamically with other modules is
|
|
|
|
making a combined work based on this library. Thus, the terms and
|
|
|
|
conditions of the GNU General Public License cover the whole
|
|
|
|
combination.
|
|
|
|
|
|
|
|
As a special exception, the copyright holders of this library give you
|
|
|
|
permission to link this library with independent modules to produce an
|
|
|
|
executable, regardless of the license terms of these independent
|
|
|
|
modules, and to copy and distribute the resulting executable under
|
|
|
|
terms of your choice, provided that you also meet, for each linked
|
|
|
|
independent module, the terms and conditions of the license of that
|
|
|
|
module. An independent module is a module which is not derived from
|
|
|
|
or based on this library. If you modify this library, you may extend
|
|
|
|
this exception to your version of the library, but you are not
|
|
|
|
obligated to do so. If you do not wish to do so, delete this
|
|
|
|
exception statement from your version. */
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
package java.io;
|
|
|
|
|
2004-09-24 12:48:12 +02:00
|
|
|
import gnu.classpath.Configuration;
|
|
|
|
import gnu.java.io.ObjectIdentityWrapper;
|
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
import java.lang.reflect.Array;
|
2004-09-24 12:48:12 +02:00
|
|
|
import java.lang.reflect.Field;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
import java.lang.reflect.Method;
|
2000-05-19 19:55:34 +02:00
|
|
|
import java.lang.reflect.Modifier;
|
ObjectInputStream.java (resolveProxyClass): New method from Classpath.
* java/io/ObjectInputStream.java (resolveProxyClass): New method
from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (rmi_java_source_files): Added new files.
* gnu/java/rmi/RMIMarshalledObjectInputStream.java,
gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
Classpath.
* gnu/java/rmi/dgc/DGCImpl.java,
gnu/java/rmi/dgc/DGCImpl_Skel.java,
gnu/java/rmi/dgc/DGCImpl_Stub.java,
gnu/java/rmi/registry/RegistryImpl_Skel.java,
gnu/java/rmi/registry/RegistryImpl_Stub.java,
gnu/java/rmi/server/RMIHashes.java,
gnu/java/rmi/server/RMIObjectInputStream.java,
gnu/java/rmi/server/RMIObjectOutputStream.java,
gnu/java/rmi/server/UnicastConnection.java,
gnu/java/rmi/server/UnicastConnectionManager.java,
gnu/java/rmi/server/UnicastRef.java,
gnu/java/rmi/server/UnicastServer.java,
gnu/java/rmi/server/UnicastServerRef.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/rmi/server/RemoteObject.java,
java/rmi/server/UnicastRemoteObject.java,
java/security/SecureClassLoader.java: Merged from Classpath.
From-SVN: r57675
2002-10-01 05:46:43 +02:00
|
|
|
import java.lang.reflect.Proxy;
|
2004-06-21 18:52:14 +02:00
|
|
|
import java.security.PrivilegedAction;
|
|
|
|
import java.security.AccessController;
|
2000-05-19 19:55:34 +02:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Hashtable;
|
|
|
|
import java.util.Vector;
|
|
|
|
|
|
|
|
public class ObjectInputStream extends InputStream
|
|
|
|
implements ObjectInput, ObjectStreamConstants
|
|
|
|
{
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Creates a new <code>ObjectInputStream</code> that will do all of
|
|
|
|
* its reading from <code>in</code>. This method also checks
|
|
|
|
* the stream by reading the header information (stream magic number
|
|
|
|
* and stream version).
|
|
|
|
*
|
|
|
|
* @exception IOException Reading stream header from underlying
|
|
|
|
* stream cannot be completed.
|
|
|
|
*
|
|
|
|
* @exception StreamCorruptedException An invalid stream magic
|
|
|
|
* number or stream version was read from the stream.
|
|
|
|
*
|
|
|
|
* @see #readStreamHeader()
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
public ObjectInputStream(InputStream in)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, StreamCorruptedException
|
|
|
|
{
|
2000-11-26 02:48:04 +01:00
|
|
|
if (Configuration.DEBUG)
|
|
|
|
{
|
|
|
|
String val = System.getProperty("gcj.dumpobjects");
|
|
|
|
if (dump == false && val != null && !val.equals(""))
|
|
|
|
{
|
|
|
|
dump = true;
|
|
|
|
System.out.println ("Serialization debugging enabled");
|
|
|
|
}
|
|
|
|
else if (dump == true && (val == null || val.equals("")))
|
|
|
|
{
|
|
|
|
dump = false;
|
|
|
|
System.out.println ("Serialization debugging disabled");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
this.resolveEnabled = false;
|
|
|
|
this.isDeserializing = false;
|
|
|
|
this.blockDataPosition = 0;
|
|
|
|
this.blockDataBytes = 0;
|
|
|
|
this.blockData = new byte[BUFFER_SIZE];
|
2003-12-30 16:51:15 +01:00
|
|
|
this.blockDataInput = new DataInputStream(this);
|
|
|
|
this.realInputStream = new DataInputStream(in);
|
2000-05-19 19:55:34 +02:00
|
|
|
this.nextOID = baseWireHandle;
|
2003-12-30 16:51:15 +01:00
|
|
|
this.objectLookupTable = new Hashtable();
|
|
|
|
this.validators = new Vector();
|
2003-12-23 23:06:01 +01:00
|
|
|
this.classLookupTable = new Hashtable();
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(true);
|
|
|
|
readStreamHeader();
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Returns the next deserialized object read from the underlying stream.
|
|
|
|
*
|
|
|
|
* This method can be overriden by a class by implementing
|
|
|
|
* <code>private void readObject (ObjectInputStream)</code>.
|
|
|
|
*
|
|
|
|
* If an exception is thrown from this method, the stream is left in
|
|
|
|
* an undefined state.
|
|
|
|
*
|
|
|
|
* @exception ClassNotFoundException The class that an object being
|
|
|
|
* read in belongs to cannot be found.
|
|
|
|
*
|
|
|
|
* @exception IOException Exception from underlying
|
|
|
|
* <code>InputStream</code>.
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
public final Object readObject() throws ClassNotFoundException, IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2004-11-25 04:47:08 +01:00
|
|
|
if (callersClassLoader == null)
|
|
|
|
{
|
|
|
|
callersClassLoader = getCallersClassLoader ();
|
|
|
|
if (Configuration.DEBUG && dump)
|
|
|
|
{
|
|
|
|
dumpElementln ("CallersClassLoader = " + callersClassLoader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
if (this.useSubclassMethod)
|
2003-12-30 16:51:15 +01:00
|
|
|
return readObjectOverride();
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
boolean was_deserializing;
|
|
|
|
|
|
|
|
Object ret_val;
|
|
|
|
was_deserializing = this.isDeserializing;
|
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
boolean is_consumed = false;
|
2003-12-30 16:51:15 +01:00
|
|
|
boolean old_mode = setBlockDataMode(false);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
this.isDeserializing = true;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
byte marker = this.realInputStream.readByte();
|
2004-06-21 18:52:14 +02:00
|
|
|
|
|
|
|
depth += 2;
|
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " ");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
try
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
switch (marker)
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
case TC_ENDBLOCKDATA:
|
|
|
|
{
|
|
|
|
ret_val = null;
|
|
|
|
is_consumed = true;
|
|
|
|
break;
|
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
case TC_BLOCKDATA:
|
|
|
|
case TC_BLOCKDATALONG:
|
|
|
|
{
|
2003-03-01 16:05:46 +01:00
|
|
|
if (marker == TC_BLOCKDATALONG)
|
2004-06-21 18:52:14 +02:00
|
|
|
{ if(dump) dumpElementln("BLOCKDATALONG"); }
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
else
|
2004-06-21 18:52:14 +02:00
|
|
|
{ if(dump) dumpElementln("BLOCKDATA"); }
|
2003-12-30 16:51:15 +01:00
|
|
|
readNextBlock(marker);
|
|
|
|
throw new StreamCorruptedException("Unexpected blockData");
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
case TC_NULL:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("NULL");
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
ret_val = null;
|
|
|
|
break;
|
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
case TC_REFERENCE:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("REFERENCE ");
|
2003-12-30 16:51:15 +01:00
|
|
|
Integer oid = new Integer(this.realInputStream.readInt());
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln(Integer.toHexString(oid.intValue()));
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
ret_val = ((ObjectIdentityWrapper)
|
2003-12-30 16:51:15 +01:00
|
|
|
this.objectLookupTable.get(oid)).object;
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
break;
|
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
case TC_CLASS:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("CLASS");
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamClass osc = (ObjectStreamClass)readObject();
|
|
|
|
Class clazz = osc.forClass();
|
|
|
|
assignNewHandle(clazz);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
ret_val = clazz;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case TC_PROXYCLASSDESC:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("PROXYCLASS");
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
int n_intf = this.realInputStream.readInt();
|
|
|
|
String[] intfs = new String[n_intf];
|
|
|
|
for (int i = 0; i < n_intf; i++)
|
|
|
|
{
|
|
|
|
intfs[i] = this.realInputStream.readUTF();
|
|
|
|
System.out.println(intfs[i]);
|
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
boolean oldmode = setBlockDataMode(true);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
Class cl = resolveProxyClass(intfs);
|
|
|
|
setBlockDataMode(oldmode);
|
|
|
|
|
2003-12-16 14:45:01 +01:00
|
|
|
ObjectStreamClass osc = lookupClass(cl);
|
2003-12-30 16:51:15 +01:00
|
|
|
assignNewHandle(osc);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
|
|
|
if (!is_consumed)
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
byte b = this.realInputStream.readByte();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
if (b != TC_ENDBLOCKDATA)
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new IOException("Data annotated to class was not consumed." + b);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
is_consumed = false;
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamClass superosc = (ObjectStreamClass)readObject();
|
|
|
|
osc.setSuperclass(superosc);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
ret_val = osc;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case TC_CLASSDESC:
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamClass osc = readClassDescriptor();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
|
|
|
if (!is_consumed)
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
byte b = this.realInputStream.readByte();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
if (b != TC_ENDBLOCKDATA)
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new IOException("Data annotated to class was not consumed." + b);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
is_consumed = false;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
osc.setSuperclass ((ObjectStreamClass)readObject());
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
ret_val = osc;
|
|
|
|
break;
|
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
case TC_STRING:
|
|
|
|
case TC_LONGSTRING:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("STRING=");
|
2003-12-30 16:51:15 +01:00
|
|
|
String s = this.realInputStream.readUTF();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln(s);
|
|
|
|
ret_val = processResolution(null, s, assignNewHandle(s));
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case TC_ARRAY:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("ARRAY");
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamClass osc = (ObjectStreamClass)readObject();
|
|
|
|
Class componentType = osc.forClass().getComponentType();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("ARRAY LENGTH=");
|
2003-12-30 16:51:15 +01:00
|
|
|
int length = this.realInputStream.readInt();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
|
2003-12-30 16:51:15 +01:00
|
|
|
Object array = Array.newInstance(componentType, length);
|
|
|
|
int handle = assignNewHandle(array);
|
|
|
|
readArrayElements(array, componentType);
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump)
|
|
|
|
for (int i = 0, len = Array.getLength(array); i < len; i++)
|
2004-11-25 04:47:08 +01:00
|
|
|
dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
ret_val = processResolution(null, array, handle);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case TC_OBJECT:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("OBJECT");
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamClass osc = (ObjectStreamClass)readObject();
|
|
|
|
Class clazz = osc.forClass();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if (!osc.realClassIsSerializable)
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new NotSerializableException
|
|
|
|
(clazz + " is not Serializable, and thus cannot be deserialized.");
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if (osc.realClassIsExternalizable)
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
{
|
2004-09-24 11:05:10 +02:00
|
|
|
Externalizable obj = osc.newInstance();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int handle = assignNewHandle(obj);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (read_from_blocks)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(true);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
obj.readExternal(this);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
|
|
|
if (read_from_blocks)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
ret_val = processResolution(osc, obj, handle);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
break;
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
} // end if (osc.realClassIsExternalizable)
|
|
|
|
|
|
|
|
Object obj = newObject(clazz, osc.firstNonSerializableParent);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int handle = assignNewHandle(obj);
|
2004-06-21 18:52:14 +02:00
|
|
|
Object prevObject = this.currentObject;
|
|
|
|
ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
|
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
this.currentObject = obj;
|
|
|
|
ObjectStreamClass[] hierarchy =
|
2003-12-16 14:45:01 +01:00
|
|
|
inputGetObjectStreamClasses(clazz);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
for (int i = 0; i < hierarchy.length; i++)
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
{
|
|
|
|
this.currentObjectStreamClass = hierarchy[i];
|
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
|
|
|
// XXX: should initialize fields in classes in the hierarchy
|
|
|
|
// that aren't in the stream
|
|
|
|
// should skip over classes in the stream that aren't in the
|
|
|
|
// real classes hierarchy
|
2003-03-14 12:54:38 +01:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
|
|
|
|
if (readObjectMethod != null)
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
{
|
2003-03-14 12:54:38 +01:00
|
|
|
fieldsAlreadyRead = false;
|
2003-12-30 16:51:15 +01:00
|
|
|
boolean oldmode = setBlockDataMode(true);
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2004-06-21 18:52:14 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
readFields(obj, currentObjectStreamClass);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.currentObjectStreamClass.hasWriteMethod())
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("ENDBLOCKDATA? ");
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
try
|
|
|
|
{
|
2004-06-21 18:52:14 +02:00
|
|
|
// FIXME: XXX: This try block is to
|
|
|
|
// catch EOF which is thrown for some
|
|
|
|
// objects. That indicates a bug in
|
|
|
|
// the logic.
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
|
|
|
|
throw new IOException
|
|
|
|
("No end of block data seen for class with readObject (ObjectInputStream) method.");
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("yes");
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
}
|
2004-06-21 18:52:14 +02:00
|
|
|
// catch (EOFException e)
|
|
|
|
// {
|
|
|
|
// if(dump) dumpElementln("no, got EOFException");
|
|
|
|
// }
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
catch (IOException e)
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("no, got IOException");
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-21 18:52:14 +02:00
|
|
|
this.currentObject = prevObject;
|
|
|
|
this.currentObjectStreamClass = prevObjectStreamClass;
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
ret_val = processResolution(osc, obj, handle);
|
2004-06-21 18:52:14 +02:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
break;
|
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
case TC_RESET:
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("RESET");
|
2003-12-30 16:51:15 +01:00
|
|
|
clearHandles();
|
|
|
|
ret_val = readObject();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
break;
|
2003-03-01 16:05:46 +01:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
case TC_EXCEPTION:
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("EXCEPTION=");
|
2003-12-30 16:51:15 +01:00
|
|
|
Exception e = (Exception)readObject();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln(e.toString());
|
2003-12-30 16:51:15 +01:00
|
|
|
clearHandles();
|
|
|
|
throw new WriteAbortedException("Exception thrown during writing of stream", e);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
default:
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new IOException("Unknown marker on stream: " + marker);
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
}
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
finally
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(old_mode);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
|
|
|
this.isDeserializing = was_deserializing;
|
2004-11-25 04:47:08 +01:00
|
|
|
|
|
|
|
depth -= 2;
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
2004-06-21 18:52:14 +02:00
|
|
|
depth -= 2;
|
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
if (! was_deserializing)
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
if (validators.size() > 0)
|
|
|
|
invokeValidators();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
return ret_val;
|
|
|
|
}
|
|
|
|
|
2004-02-28 22:28:53 +01:00
|
|
|
/**
|
|
|
|
* This method makes a partial check of types for the fields
|
|
|
|
* contained given in arguments. It checks primitive types of
|
|
|
|
* fields1 against non primitive types of fields2. This method
|
|
|
|
* assumes the two lists has already been sorted according to
|
|
|
|
* the Java specification.
|
|
|
|
*
|
|
|
|
* @param name Name of the class owning the given fields.
|
|
|
|
* @param fields1 First list to check.
|
|
|
|
* @param fields2 Second list to check.
|
|
|
|
* @throws InvalidClassException if a field in fields1, which has a primitive type, is a present
|
|
|
|
* in the non primitive part in fields2.
|
|
|
|
*/
|
|
|
|
private void checkTypeConsistency(String name, ObjectStreamField[] fields1, ObjectStreamField[] fields2)
|
|
|
|
throws InvalidClassException
|
2004-02-28 22:48:35 +01:00
|
|
|
{
|
2004-02-28 22:28:53 +01:00
|
|
|
int nonPrimitive = 0;
|
|
|
|
|
|
|
|
for (nonPrimitive = 0;
|
|
|
|
nonPrimitive < fields1.length
|
|
|
|
&& fields1[nonPrimitive].isPrimitive(); nonPrimitive++)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nonPrimitive == fields1.length)
|
|
|
|
return;
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
ObjectStreamField f1;
|
|
|
|
ObjectStreamField f2;
|
|
|
|
|
|
|
|
while (i < fields2.length
|
|
|
|
&& nonPrimitive < fields1.length)
|
|
|
|
{
|
|
|
|
f1 = fields1[nonPrimitive];
|
|
|
|
f2 = fields2[i];
|
|
|
|
|
|
|
|
if (!f2.isPrimitive())
|
|
|
|
break;
|
|
|
|
|
|
|
|
int compVal = f1.getName().compareTo (f2.getName());
|
|
|
|
|
|
|
|
if (compVal < 0)
|
|
|
|
{
|
|
|
|
nonPrimitive++;
|
|
|
|
}
|
|
|
|
else if (compVal > 0)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new InvalidClassException
|
|
|
|
("invalid field type for " + f2.getName() +
|
|
|
|
" in class " + name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
/**
|
|
|
|
* This method reads a class descriptor from the real input stream
|
|
|
|
* and use these data to create a new instance of ObjectStreamClass.
|
|
|
|
* Fields are sorted and ordered for the real read which occurs for
|
|
|
|
* each instance of the described class. Be aware that if you call that
|
|
|
|
* method you must ensure that the stream is synchronized, in the other
|
|
|
|
* case it may be completely desynchronized.
|
|
|
|
*
|
|
|
|
* @return A new instance of ObjectStreamClass containing the freshly
|
|
|
|
* created descriptor.
|
|
|
|
* @throws ClassNotFoundException if the required class to build the
|
|
|
|
* descriptor has not been found in the system.
|
|
|
|
* @throws IOException An input/output error occured.
|
|
|
|
* @throws InvalidClassException If there was a compatibility problem
|
|
|
|
* between the class present in the system and the serialized class.
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
protected ObjectStreamClass readClassDescriptor()
|
2003-06-25 08:31:59 +02:00
|
|
|
throws ClassNotFoundException, IOException
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("CLASSDESC NAME=");
|
2003-12-30 16:51:15 +01:00
|
|
|
String name = this.realInputStream.readUTF();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement(name + "; UID=");
|
2003-06-25 08:31:59 +02:00
|
|
|
long uid = this.realInputStream.readLong ();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement(Long.toHexString(uid) + "; FLAGS=");
|
2003-06-25 08:31:59 +02:00
|
|
|
byte flags = this.realInputStream.readByte ();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement(Integer.toHexString(flags) + "; FIELD COUNT=");
|
2003-12-30 16:51:15 +01:00
|
|
|
short field_count = this.realInputStream.readShort();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln(Short.toString(field_count));
|
2003-06-25 08:31:59 +02:00
|
|
|
ObjectStreamField[] fields = new ObjectStreamField[field_count];
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamClass osc = new ObjectStreamClass(name, uid,
|
|
|
|
flags, fields);
|
|
|
|
assignNewHandle(osc);
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
|
|
|
|
ClassLoader currentLoader = currentLoader();
|
2003-06-25 08:31:59 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
for (int i = 0; i < field_count; i++)
|
2003-06-25 08:31:59 +02:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement(" TYPE CODE=");
|
2003-12-30 16:51:15 +01:00
|
|
|
char type_code = (char)this.realInputStream.readByte();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement(type_code + "; FIELD NAME=");
|
2003-12-30 16:51:15 +01:00
|
|
|
String field_name = this.realInputStream.readUTF();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln(field_name);
|
2003-06-25 08:31:59 +02:00
|
|
|
String class_name;
|
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
// If the type code is an array or an object we must
|
|
|
|
// decode a String here. In the other case we convert
|
|
|
|
// the type code and pass it to ObjectStreamField.
|
|
|
|
// Type codes are decoded by gnu.java.lang.reflect.TypeSignature.
|
2003-06-25 08:31:59 +02:00
|
|
|
if (type_code == 'L' || type_code == '[')
|
2003-12-30 16:51:15 +01:00
|
|
|
class_name = (String)readObject();
|
2003-06-25 08:31:59 +02:00
|
|
|
else
|
2003-12-30 16:51:15 +01:00
|
|
|
class_name = String.valueOf(type_code);
|
2003-06-25 08:31:59 +02:00
|
|
|
|
|
|
|
fields[i] =
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
new ObjectStreamField(field_name, class_name, currentLoader);
|
2003-06-25 08:31:59 +02:00
|
|
|
}
|
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
/* Now that fields have been read we may resolve the class
|
|
|
|
* (and read annotation if needed). */
|
2003-12-16 14:45:01 +01:00
|
|
|
Class clazz = resolveClass(osc);
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
|
|
|
|
boolean oldmode = setBlockDataMode(true);
|
|
|
|
osc.setClass(clazz, lookupClass(clazz.getSuperclass()));
|
|
|
|
classLookupTable.put(clazz, osc);
|
|
|
|
setBlockDataMode(oldmode);
|
|
|
|
|
|
|
|
// find the first non-serializable, non-abstract
|
|
|
|
// class in clazz's inheritance hierarchy
|
|
|
|
Class first_nonserial = clazz.getSuperclass();
|
|
|
|
while (Serializable.class.isAssignableFrom(first_nonserial)
|
|
|
|
|| Modifier.isAbstract(first_nonserial.getModifiers()))
|
|
|
|
first_nonserial = first_nonserial.getSuperclass();
|
|
|
|
|
|
|
|
osc.firstNonSerializableParent = first_nonserial;
|
|
|
|
osc.realClassIsSerializable = Serializable.class.isAssignableFrom(clazz);
|
|
|
|
osc.realClassIsExternalizable = Externalizable.class.isAssignableFrom(clazz);
|
|
|
|
|
|
|
|
ObjectStreamField[] stream_fields = osc.fields;
|
|
|
|
ObjectStreamField[] real_fields = ObjectStreamClass.lookup(clazz).fields;
|
|
|
|
ObjectStreamField[] fieldmapping = new ObjectStreamField[2 * Math.max(stream_fields.length, real_fields.length)];
|
|
|
|
|
|
|
|
int stream_idx = 0;
|
|
|
|
int real_idx = 0;
|
|
|
|
int map_idx = 0;
|
|
|
|
|
2004-02-28 22:28:53 +01:00
|
|
|
/*
|
|
|
|
* Check that there is no type inconsistencies between the lists.
|
|
|
|
* A special checking must be done for the two groups: primitive types and
|
|
|
|
* not primitive types.
|
|
|
|
*/
|
|
|
|
checkTypeConsistency(name, real_fields, stream_fields);
|
|
|
|
checkTypeConsistency(name, stream_fields, real_fields);
|
|
|
|
|
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
while (stream_idx < stream_fields.length
|
|
|
|
|| real_idx < real_fields.length)
|
2003-12-23 23:06:01 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
ObjectStreamField stream_field = null;
|
|
|
|
ObjectStreamField real_field = null;
|
|
|
|
|
|
|
|
if (stream_idx == stream_fields.length)
|
2003-12-23 23:06:01 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
real_field = real_fields[real_idx++];
|
2003-12-23 23:06:01 +01:00
|
|
|
}
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
else if (real_idx == real_fields.length)
|
2003-12-23 23:06:01 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
stream_field = stream_fields[stream_idx++];
|
2003-12-23 23:06:01 +01:00
|
|
|
}
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int comp_val =
|
2004-02-28 22:28:53 +01:00
|
|
|
real_fields[real_idx].compareTo (stream_fields[stream_idx]);
|
2003-12-23 23:06:01 +01:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if (comp_val < 0)
|
|
|
|
{
|
|
|
|
real_field = real_fields[real_idx++];
|
|
|
|
}
|
|
|
|
else if (comp_val > 0)
|
|
|
|
{
|
|
|
|
stream_field = stream_fields[stream_idx++];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stream_field = stream_fields[stream_idx++];
|
|
|
|
real_field = real_fields[real_idx++];
|
2004-02-28 22:28:53 +01:00
|
|
|
if (stream_field.getType() != real_field.getType())
|
|
|
|
throw new InvalidClassException
|
|
|
|
("invalid field type for " + real_field.getName() +
|
|
|
|
" in class " + name);
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
}
|
|
|
|
}
|
2004-02-28 22:28:53 +01:00
|
|
|
|
2004-02-15 12:53:45 +01:00
|
|
|
/* If some of stream_fields does not correspond to any of real_fields,
|
|
|
|
* or the opposite, then fieldmapping will go short.
|
|
|
|
*/
|
|
|
|
if (map_idx == fieldmapping.length)
|
|
|
|
{
|
|
|
|
ObjectStreamField[] newfieldmapping =
|
|
|
|
new ObjectStreamField[fieldmapping.length + 2];
|
|
|
|
System.arraycopy(fieldmapping, 0,
|
2004-02-28 22:28:53 +01:00
|
|
|
newfieldmapping, 0, fieldmapping.length);
|
2004-02-15 12:53:45 +01:00
|
|
|
fieldmapping = newfieldmapping;
|
|
|
|
}
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
fieldmapping[map_idx++] = stream_field;
|
|
|
|
fieldmapping[map_idx++] = real_field;
|
|
|
|
}
|
2004-02-15 12:53:45 +01:00
|
|
|
osc.fieldMapping = fieldmapping;
|
2003-12-30 16:51:15 +01:00
|
|
|
|
2003-06-25 08:31:59 +02:00
|
|
|
return osc;
|
|
|
|
}
|
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Reads the current objects non-transient, non-static fields from
|
|
|
|
* the current class from the underlying output stream.
|
|
|
|
*
|
|
|
|
* This method is intended to be called from within a object's
|
|
|
|
* <code>private void readObject (ObjectInputStream)</code>
|
|
|
|
* method.
|
|
|
|
*
|
|
|
|
* @exception ClassNotFoundException The class that an object being
|
|
|
|
* read in belongs to cannot be found.
|
|
|
|
*
|
|
|
|
* @exception NotActiveException This method was called from a
|
|
|
|
* context other than from the current object's and current class's
|
|
|
|
* <code>private void readObject (ObjectInputStream)</code>
|
|
|
|
* method.
|
|
|
|
*
|
|
|
|
* @exception IOException Exception from underlying
|
|
|
|
* <code>OutputStream</code>.
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
public void defaultReadObject()
|
2000-05-19 19:55:34 +02:00
|
|
|
throws ClassNotFoundException, IOException, NotActiveException
|
|
|
|
{
|
|
|
|
if (this.currentObject == null || this.currentObjectStreamClass == null)
|
2003-12-23 23:06:01 +01:00
|
|
|
throw new NotActiveException("defaultReadObject called by non-active"
|
|
|
|
+ " class and/or object");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
if (fieldsAlreadyRead)
|
2003-12-23 23:06:01 +01:00
|
|
|
throw new NotActiveException("defaultReadObject called but fields "
|
|
|
|
+ "already read from stream (by "
|
|
|
|
+ "defaultReadObject or readFields)");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
boolean oldmode = setBlockDataMode(false);
|
2003-12-30 16:51:15 +01:00
|
|
|
readFields(this.currentObject, this.currentObjectStreamClass);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
fieldsAlreadyRead = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Registers a <code>ObjectInputValidation</code> to be carried out
|
|
|
|
* on the object graph currently being deserialized before it is
|
|
|
|
* returned to the original caller of <code>readObject ()</code>.
|
|
|
|
* The order of validation for multiple
|
|
|
|
* <code>ObjectInputValidation</code>s can be controled using
|
|
|
|
* <code>priority</code>. Validators with higher priorities are
|
|
|
|
* called first.
|
|
|
|
*
|
|
|
|
* @see java.io.ObjectInputValidation
|
|
|
|
*
|
|
|
|
* @exception InvalidObjectException <code>validator</code> is
|
|
|
|
* <code>null</code>
|
|
|
|
*
|
|
|
|
* @exception NotActiveException an attempt was made to add a
|
|
|
|
* validator outside of the <code>readObject</code> method of the
|
|
|
|
* object currently being deserialized
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
public void registerValidation(ObjectInputValidation validator,
|
|
|
|
int priority)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws InvalidObjectException, NotActiveException
|
|
|
|
{
|
|
|
|
if (this.currentObject == null || this.currentObjectStreamClass == null)
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new NotActiveException("registerValidation called by non-active "
|
|
|
|
+ "class and/or object");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
if (validator == null)
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new InvalidObjectException("attempt to add a null "
|
|
|
|
+ "ObjectInputValidation object");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
this.validators.addElement(new ValidatorAndPriority (validator,
|
|
|
|
priority));
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Called when a class is being deserialized. This is a hook to
|
|
|
|
* allow subclasses to read in information written by the
|
|
|
|
* <code>annotateClass (Class)</code> method of an
|
|
|
|
* <code>ObjectOutputStream</code>.
|
|
|
|
*
|
|
|
|
* This implementation looks up the active call stack for a
|
|
|
|
* <code>ClassLoader</code>; if a <code>ClassLoader</code> is found,
|
|
|
|
* it is used to load the class associated with <code>osc</code>,
|
|
|
|
* otherwise, the default system <code>ClassLoader</code> is used.
|
|
|
|
*
|
|
|
|
* @exception IOException Exception from underlying
|
|
|
|
* <code>OutputStream</code>.
|
|
|
|
*
|
|
|
|
* @see java.io.ObjectOutputStream#annotateClass (java.lang.Class)
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
protected Class resolveClass(ObjectStreamClass osc)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws ClassNotFoundException, IOException
|
2003-12-16 14:45:01 +01:00
|
|
|
{
|
2004-06-21 18:52:14 +02:00
|
|
|
return Class.forName(osc.getName(), true, callersClassLoader);
|
2003-12-16 14:45:01 +01:00
|
|
|
}
|
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
/**
|
|
|
|
* This method invokes the method currentClassLoader for the
|
|
|
|
* current security manager (or build an empty one if it is not
|
|
|
|
* present).
|
|
|
|
*
|
|
|
|
* @return The most recent non-system ClassLoader on the execution stack.
|
|
|
|
* @see java.lang.SecurityManager#currentClassLoader()
|
|
|
|
*/
|
2003-12-16 14:45:01 +01:00
|
|
|
private ClassLoader currentLoader()
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
SecurityManager sm = System.getSecurityManager();
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
if (sm == null)
|
|
|
|
sm = new SecurityManager () {};
|
2003-12-16 14:45:01 +01:00
|
|
|
|
|
|
|
return currentClassLoader(sm);
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-16 14:45:01 +01:00
|
|
|
/**
|
|
|
|
* Lookup a class stored in the local hashtable. If it is not
|
|
|
|
* use the global lookup function in ObjectStreamClass to build
|
|
|
|
* the ObjectStreamClass. This method is requested according to
|
|
|
|
* the behaviour detected in the JDK by Kaffe's team.
|
|
|
|
*
|
|
|
|
* @param clazz Class to lookup in the hash table or for which
|
|
|
|
* we must build a descriptor.
|
|
|
|
* @return A valid instance of ObjectStreamClass corresponding
|
|
|
|
* to the specified class.
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
private ObjectStreamClass lookupClass(Class clazz)
|
2003-12-16 14:45:01 +01:00
|
|
|
{
|
|
|
|
ObjectStreamClass oclazz;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
oclazz = (ObjectStreamClass)classLookupTable.get(clazz);
|
2003-12-16 14:45:01 +01:00
|
|
|
if (oclazz == null)
|
2003-12-30 16:51:15 +01:00
|
|
|
return ObjectStreamClass.lookup(clazz);
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
else
|
2003-12-16 14:45:01 +01:00
|
|
|
return oclazz;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reconstruct class hierarchy the same way
|
|
|
|
* {@link java.io.ObjectStreamClass.getObjectStreamClasses(java.lang.Class)} does
|
|
|
|
* but using lookupClass instead of ObjectStreamClass.lookup. This
|
2003-12-23 23:06:01 +01:00
|
|
|
* dup is necessary localize the lookup table. Hopefully some future
|
|
|
|
* rewritings will be able to prevent this.
|
2003-12-16 14:45:01 +01:00
|
|
|
*
|
|
|
|
* @param clazz This is the class for which we want the hierarchy.
|
|
|
|
*
|
|
|
|
* @return An array of valid {@link java.io.ObjectStreamClass} instances which
|
|
|
|
* represent the class hierarchy for clazz.
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
private ObjectStreamClass[] inputGetObjectStreamClasses(Class clazz)
|
2003-12-16 14:45:01 +01:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamClass osc = lookupClass(clazz);
|
2003-12-16 14:45:01 +01:00
|
|
|
|
|
|
|
if (osc == null)
|
|
|
|
return new ObjectStreamClass[0];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Vector oscs = new Vector();
|
|
|
|
|
|
|
|
while (osc != null)
|
|
|
|
{
|
|
|
|
oscs.addElement(osc);
|
|
|
|
osc = osc.getSuper();
|
|
|
|
}
|
|
|
|
|
|
|
|
int count = oscs.size();
|
|
|
|
ObjectStreamClass[] sorted_oscs = new ObjectStreamClass[count];
|
|
|
|
|
|
|
|
for (int i = count - 1; i >= 0; i--)
|
|
|
|
sorted_oscs[count - i - 1] = (ObjectStreamClass) oscs.elementAt(i);
|
|
|
|
|
|
|
|
return sorted_oscs;
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Allows subclasses to resolve objects that are read from the
|
|
|
|
* stream with other objects to be returned in their place. This
|
|
|
|
* method is called the first time each object is encountered.
|
|
|
|
*
|
|
|
|
* This method must be enabled before it will be called in the
|
|
|
|
* serialization process.
|
|
|
|
*
|
|
|
|
* @exception IOException Exception from underlying
|
|
|
|
* <code>OutputStream</code>.
|
|
|
|
*
|
|
|
|
* @see #enableResolveObject(boolean)
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
protected Object resolveObject(Object obj) throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
protected Class resolveProxyClass(String[] intfs)
|
ObjectInputStream.java (resolveProxyClass): New method from Classpath.
* java/io/ObjectInputStream.java (resolveProxyClass): New method
from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (rmi_java_source_files): Added new files.
* gnu/java/rmi/RMIMarshalledObjectInputStream.java,
gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
Classpath.
* gnu/java/rmi/dgc/DGCImpl.java,
gnu/java/rmi/dgc/DGCImpl_Skel.java,
gnu/java/rmi/dgc/DGCImpl_Stub.java,
gnu/java/rmi/registry/RegistryImpl_Skel.java,
gnu/java/rmi/registry/RegistryImpl_Stub.java,
gnu/java/rmi/server/RMIHashes.java,
gnu/java/rmi/server/RMIObjectInputStream.java,
gnu/java/rmi/server/RMIObjectOutputStream.java,
gnu/java/rmi/server/UnicastConnection.java,
gnu/java/rmi/server/UnicastConnectionManager.java,
gnu/java/rmi/server/UnicastRef.java,
gnu/java/rmi/server/UnicastServer.java,
gnu/java/rmi/server/UnicastServerRef.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/rmi/server/RemoteObject.java,
java/rmi/server/UnicastRemoteObject.java,
java/security/SecureClassLoader.java: Merged from Classpath.
From-SVN: r57675
2002-10-01 05:46:43 +02:00
|
|
|
throws IOException, ClassNotFoundException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
SecurityManager sm = System.getSecurityManager();
|
ObjectInputStream.java (resolveProxyClass): New method from Classpath.
* java/io/ObjectInputStream.java (resolveProxyClass): New method
from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (rmi_java_source_files): Added new files.
* gnu/java/rmi/RMIMarshalledObjectInputStream.java,
gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
Classpath.
* gnu/java/rmi/dgc/DGCImpl.java,
gnu/java/rmi/dgc/DGCImpl_Skel.java,
gnu/java/rmi/dgc/DGCImpl_Stub.java,
gnu/java/rmi/registry/RegistryImpl_Skel.java,
gnu/java/rmi/registry/RegistryImpl_Stub.java,
gnu/java/rmi/server/RMIHashes.java,
gnu/java/rmi/server/RMIObjectInputStream.java,
gnu/java/rmi/server/RMIObjectOutputStream.java,
gnu/java/rmi/server/UnicastConnection.java,
gnu/java/rmi/server/UnicastConnectionManager.java,
gnu/java/rmi/server/UnicastRef.java,
gnu/java/rmi/server/UnicastServer.java,
gnu/java/rmi/server/UnicastServerRef.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/rmi/server/RemoteObject.java,
java/rmi/server/UnicastRemoteObject.java,
java/security/SecureClassLoader.java: Merged from Classpath.
From-SVN: r57675
2002-10-01 05:46:43 +02:00
|
|
|
|
|
|
|
if (sm == null)
|
2003-12-30 16:51:15 +01:00
|
|
|
sm = new SecurityManager() {};
|
ObjectInputStream.java (resolveProxyClass): New method from Classpath.
* java/io/ObjectInputStream.java (resolveProxyClass): New method
from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (rmi_java_source_files): Added new files.
* gnu/java/rmi/RMIMarshalledObjectInputStream.java,
gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
Classpath.
* gnu/java/rmi/dgc/DGCImpl.java,
gnu/java/rmi/dgc/DGCImpl_Skel.java,
gnu/java/rmi/dgc/DGCImpl_Stub.java,
gnu/java/rmi/registry/RegistryImpl_Skel.java,
gnu/java/rmi/registry/RegistryImpl_Stub.java,
gnu/java/rmi/server/RMIHashes.java,
gnu/java/rmi/server/RMIObjectInputStream.java,
gnu/java/rmi/server/RMIObjectOutputStream.java,
gnu/java/rmi/server/UnicastConnection.java,
gnu/java/rmi/server/UnicastConnectionManager.java,
gnu/java/rmi/server/UnicastRef.java,
gnu/java/rmi/server/UnicastServer.java,
gnu/java/rmi/server/UnicastServerRef.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/rmi/server/RemoteObject.java,
java/rmi/server/UnicastRemoteObject.java,
java/security/SecureClassLoader.java: Merged from Classpath.
From-SVN: r57675
2002-10-01 05:46:43 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
ClassLoader cl = currentClassLoader(sm);
|
ObjectInputStream.java (resolveProxyClass): New method from Classpath.
* java/io/ObjectInputStream.java (resolveProxyClass): New method
from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (rmi_java_source_files): Added new files.
* gnu/java/rmi/RMIMarshalledObjectInputStream.java,
gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
Classpath.
* gnu/java/rmi/dgc/DGCImpl.java,
gnu/java/rmi/dgc/DGCImpl_Skel.java,
gnu/java/rmi/dgc/DGCImpl_Stub.java,
gnu/java/rmi/registry/RegistryImpl_Skel.java,
gnu/java/rmi/registry/RegistryImpl_Stub.java,
gnu/java/rmi/server/RMIHashes.java,
gnu/java/rmi/server/RMIObjectInputStream.java,
gnu/java/rmi/server/RMIObjectOutputStream.java,
gnu/java/rmi/server/UnicastConnection.java,
gnu/java/rmi/server/UnicastConnectionManager.java,
gnu/java/rmi/server/UnicastRef.java,
gnu/java/rmi/server/UnicastServer.java,
gnu/java/rmi/server/UnicastServerRef.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/rmi/server/RemoteObject.java,
java/rmi/server/UnicastRemoteObject.java,
java/security/SecureClassLoader.java: Merged from Classpath.
From-SVN: r57675
2002-10-01 05:46:43 +02:00
|
|
|
|
|
|
|
Class[] clss = new Class[intfs.length];
|
2003-12-30 16:51:15 +01:00
|
|
|
if(cl == null)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < intfs.length; i++)
|
|
|
|
clss[i] = Class.forName(intfs[i]);
|
|
|
|
cl = ClassLoader.getSystemClassLoader();
|
|
|
|
}
|
ObjectInputStream.java (resolveProxyClass): New method from Classpath.
* java/io/ObjectInputStream.java (resolveProxyClass): New method
from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (rmi_java_source_files): Added new files.
* gnu/java/rmi/RMIMarshalledObjectInputStream.java,
gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
Classpath.
* gnu/java/rmi/dgc/DGCImpl.java,
gnu/java/rmi/dgc/DGCImpl_Skel.java,
gnu/java/rmi/dgc/DGCImpl_Stub.java,
gnu/java/rmi/registry/RegistryImpl_Skel.java,
gnu/java/rmi/registry/RegistryImpl_Stub.java,
gnu/java/rmi/server/RMIHashes.java,
gnu/java/rmi/server/RMIObjectInputStream.java,
gnu/java/rmi/server/RMIObjectOutputStream.java,
gnu/java/rmi/server/UnicastConnection.java,
gnu/java/rmi/server/UnicastConnectionManager.java,
gnu/java/rmi/server/UnicastRef.java,
gnu/java/rmi/server/UnicastServer.java,
gnu/java/rmi/server/UnicastServerRef.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/rmi/server/RemoteObject.java,
java/rmi/server/UnicastRemoteObject.java,
java/security/SecureClassLoader.java: Merged from Classpath.
From-SVN: r57675
2002-10-01 05:46:43 +02:00
|
|
|
else
|
|
|
|
for (int i = 0; i < intfs.length; i++)
|
|
|
|
clss[i] = cl.loadClass(intfs[i]);
|
2003-12-30 16:51:15 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
return Proxy.getProxyClass(cl, clss);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException e)
|
|
|
|
{
|
|
|
|
throw new ClassNotFoundException(null, e);
|
|
|
|
}
|
ObjectInputStream.java (resolveProxyClass): New method from Classpath.
* java/io/ObjectInputStream.java (resolveProxyClass): New method
from Classpath.
* Makefile.in: Rebuilt.
* Makefile.am (rmi_java_source_files): Added new files.
* gnu/java/rmi/RMIMarshalledObjectInputStream.java,
gnu/java/rmi/RMIMarshalledObjectOutputStream.java,
gnu/java/rmi/server/ConnectionRunnerPool.java: New files from
Classpath.
* gnu/java/rmi/dgc/DGCImpl.java,
gnu/java/rmi/dgc/DGCImpl_Skel.java,
gnu/java/rmi/dgc/DGCImpl_Stub.java,
gnu/java/rmi/registry/RegistryImpl_Skel.java,
gnu/java/rmi/registry/RegistryImpl_Stub.java,
gnu/java/rmi/server/RMIHashes.java,
gnu/java/rmi/server/RMIObjectInputStream.java,
gnu/java/rmi/server/RMIObjectOutputStream.java,
gnu/java/rmi/server/UnicastConnection.java,
gnu/java/rmi/server/UnicastConnectionManager.java,
gnu/java/rmi/server/UnicastRef.java,
gnu/java/rmi/server/UnicastServer.java,
gnu/java/rmi/server/UnicastServerRef.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/rmi/server/RemoteObject.java,
java/rmi/server/UnicastRemoteObject.java,
java/security/SecureClassLoader.java: Merged from Classpath.
From-SVN: r57675
2002-10-01 05:46:43 +02:00
|
|
|
}
|
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* If <code>enable</code> is <code>true</code> and this object is
|
|
|
|
* trusted, then <code>resolveObject (Object)</code> will be called
|
|
|
|
* in subsequent calls to <code>readObject (Object)</code>.
|
|
|
|
* Otherwise, <code>resolveObject (Object)</code> will not be called.
|
|
|
|
*
|
|
|
|
* @exception SecurityException This class is not trusted.
|
|
|
|
*/
|
2000-05-19 19:55:34 +02:00
|
|
|
protected boolean enableResolveObject (boolean enable)
|
|
|
|
throws SecurityException
|
|
|
|
{
|
|
|
|
if (enable)
|
2001-12-21 23:51:41 +01:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
SecurityManager sm = System.getSecurityManager();
|
2001-12-21 23:51:41 +01:00
|
|
|
if (sm != null)
|
2003-12-30 16:51:15 +01:00
|
|
|
sm.checkPermission(new SerializablePermission("enableSubstitution"));
|
2001-12-21 23:51:41 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
boolean old_val = this.resolveEnabled;
|
|
|
|
this.resolveEnabled = enable;
|
|
|
|
return old_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Reads stream magic and stream version information from the
|
|
|
|
* underlying stream.
|
|
|
|
*
|
|
|
|
* @exception IOException Exception from underlying stream.
|
|
|
|
*
|
|
|
|
* @exception StreamCorruptedException An invalid stream magic
|
|
|
|
* number or stream version was read from the stream.
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
protected void readStreamHeader()
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, StreamCorruptedException
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("STREAM MAGIC ");
|
2003-12-30 16:51:15 +01:00
|
|
|
if (this.realInputStream.readShort() != STREAM_MAGIC)
|
|
|
|
throw new StreamCorruptedException("Invalid stream magic number");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln("STREAM VERSION ");
|
2003-12-30 16:51:15 +01:00
|
|
|
if (this.realInputStream.readShort() != STREAM_VERSION)
|
|
|
|
throw new StreamCorruptedException("Invalid stream version number");
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int read() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
if (this.readDataFromBlock)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
if (this.blockDataPosition >= this.blockDataBytes)
|
2003-12-30 16:51:15 +01:00
|
|
|
readNextBlock();
|
2003-03-01 16:05:46 +01:00
|
|
|
return (this.blockData[this.blockDataPosition++] & 0xff);
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
else
|
2003-12-30 16:51:15 +01:00
|
|
|
return this.realInputStream.read();
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int read(byte[] data, int offset, int length) throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
if (this.readDataFromBlock)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
if (this.blockDataPosition + length > this.blockDataBytes)
|
|
|
|
{
|
|
|
|
int remain = this.blockDataBytes - this.blockDataPosition;
|
|
|
|
if (remain != 0)
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
System.arraycopy(this.blockData, this.blockDataPosition,
|
|
|
|
data, offset, remain);
|
2003-03-01 16:05:46 +01:00
|
|
|
offset += remain;
|
|
|
|
length -= remain;
|
|
|
|
}
|
|
|
|
readNextBlock ();
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
System.arraycopy(this.blockData, this.blockDataPosition,
|
|
|
|
data, offset, length);
|
2003-03-01 16:05:46 +01:00
|
|
|
this.blockDataPosition += length;
|
2001-01-27 07:04:29 +01:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
return length;
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
else
|
2003-12-30 16:51:15 +01:00
|
|
|
return this.realInputStream.read(data, offset, length);
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int available() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
if (this.readDataFromBlock)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
if (this.blockDataPosition >= this.blockDataBytes)
|
|
|
|
readNextBlock ();
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
return this.blockDataBytes - this.blockDataPosition;
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
else
|
2003-12-30 16:51:15 +01:00
|
|
|
return this.realInputStream.available();
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public void close() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
this.realInputStream.close();
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public boolean readBoolean() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
|
|
|
oldmode = setBlockDataMode (true);
|
|
|
|
boolean value = this.dataInputStream.readBoolean ();
|
|
|
|
if (switchmode)
|
|
|
|
setBlockDataMode (oldmode);
|
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public byte readByte() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
byte value = this.dataInputStream.readByte();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int readUnsignedByte() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
int value = this.dataInputStream.readUnsignedByte();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public short readShort() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
short value = this.dataInputStream.readShort();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int readUnsignedShort() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
int value = this.dataInputStream.readUnsignedShort();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public char readChar() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
char value = this.dataInputStream.readChar();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int readInt() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 4)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
int value = this.dataInputStream.readInt();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public long readLong() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 8)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
long value = this.dataInputStream.readLong();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public float readFloat() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 4)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
float value = this.dataInputStream.readFloat();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public double readDouble() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean switchmode = true;
|
|
|
|
boolean oldmode = this.readDataFromBlock;
|
|
|
|
if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 8)
|
|
|
|
switchmode = false;
|
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
oldmode = setBlockDataMode(true);
|
|
|
|
double value = this.dataInputStream.readDouble();
|
2003-12-23 23:06:01 +01:00
|
|
|
if (switchmode)
|
2003-12-30 16:51:15 +01:00
|
|
|
setBlockDataMode(oldmode);
|
2003-12-23 23:06:01 +01:00
|
|
|
return value;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public void readFully(byte data[]) throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
this.dataInputStream.readFully(data);
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public void readFully(byte data[], int offset, int size)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
this.dataInputStream.readFully(data, offset, size);
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int skipBytes(int len) throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
return this.dataInputStream.skipBytes(len);
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* @deprecated
|
|
|
|
* @see java.io.DataInputStream#readLine ()
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
public String readLine() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
return this.dataInputStream.readLine();
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public String readUTF() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
return this.dataInputStream.readUTF();
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* This class allows a class to specify exactly which fields should
|
|
|
|
* be read, and what values should be read for these fields.
|
|
|
|
*
|
|
|
|
* XXX: finish up comments
|
|
|
|
*/
|
2004-10-18 15:40:05 +02:00
|
|
|
public abstract static class GetField
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract ObjectStreamClass getObjectStreamClass();
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract boolean defaulted(String name)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract boolean get(String name, boolean defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract char get(String name, char defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract byte get(String name, byte defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract short get(String name, short defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract int get(String name, int defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract long get(String name, long defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract float get(String name, float defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract double get(String name, double defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public abstract Object get(String name, Object defvalue)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, IllegalArgumentException;
|
|
|
|
}
|
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
/**
|
|
|
|
* This method should be called by a method called 'readObject' in the
|
|
|
|
* deserializing class (if present). It cannot (and should not)be called
|
|
|
|
* outside of it. Its goal is to read all fields in the real input stream
|
|
|
|
* and keep them accessible through the {@link #GetField} class. Calling
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
* this method will not alter the deserializing object.
|
2003-12-23 23:06:01 +01:00
|
|
|
*
|
|
|
|
* @return A valid freshly created 'GetField' instance to get access to
|
|
|
|
* the deserialized stream.
|
|
|
|
* @throws IOException An input/output exception occured.
|
|
|
|
* @throws ClassNotFoundException
|
|
|
|
* @throws NotActiveException
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
public GetField readFields()
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, ClassNotFoundException, NotActiveException
|
|
|
|
{
|
|
|
|
if (this.currentObject == null || this.currentObjectStreamClass == null)
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new NotActiveException("readFields called by non-active class and/or object");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
if (prereadFields != null)
|
|
|
|
return prereadFields;
|
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
if (fieldsAlreadyRead)
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new NotActiveException("readFields called but fields already read from"
|
|
|
|
+ " stream (by defaultReadObject or readFields)");
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
final ObjectStreamClass clazz = this.currentObjectStreamClass;
|
|
|
|
final byte[] prim_field_data = new byte[clazz.primFieldSize];
|
|
|
|
final Object[] objs = new Object[clazz.objectFieldCount];
|
2000-08-04 02:42:20 +02:00
|
|
|
|
|
|
|
// 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.
|
2003-12-30 16:51:15 +01:00
|
|
|
boolean oldmode = setBlockDataMode(false);
|
|
|
|
readFully(prim_field_data);
|
2000-05-19 19:55:34 +02:00
|
|
|
for (int i = 0; i < objs.length; ++ i)
|
2003-12-30 16:51:15 +01:00
|
|
|
objs[i] = readObject();
|
|
|
|
setBlockDataMode(oldmode);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
prereadFields = new GetField()
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
public ObjectStreamClass getObjectStreamClass()
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
return clazz;
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public boolean defaulted(String name)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-23 23:06:01 +01:00
|
|
|
ObjectStreamField f = clazz.getField(name);
|
|
|
|
|
|
|
|
/* First if we have a serialized field use the descriptor */
|
|
|
|
if (f != null)
|
|
|
|
{
|
|
|
|
/* It is in serialPersistentFields but setClass tells us
|
|
|
|
* it should not be set. This value is defaulted.
|
|
|
|
*/
|
|
|
|
if (f.isPersistent() && !f.isToSet())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is not a serialized field. There should be
|
|
|
|
* a default value only if the field really exists.
|
|
|
|
*/
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return (clazz.forClass().getDeclaredField (name) != null);
|
|
|
|
}
|
|
|
|
catch (NoSuchFieldException e)
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new IllegalArgumentException(e.getMessage());
|
2003-12-23 23:06:01 +01:00
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public boolean get(String name, boolean defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Boolean.TYPE);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
return prim_field_data[field.getOffset()] == 0 ? false : true;
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public char get(String name, char defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Character.TYPE);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int off = field.getOffset();
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
return (char)(((prim_field_data[off++] & 0xFF) << 8)
|
|
|
|
| (prim_field_data[off] & 0xFF));
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public byte get(String name, byte defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Byte.TYPE);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
return prim_field_data[field.getOffset()];
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public short get(String name, short defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Short.TYPE);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int off = field.getOffset();
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
return (short)(((prim_field_data[off++] & 0xFF) << 8)
|
|
|
|
| (prim_field_data[off] & 0xFF));
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public int get(String name, int defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Integer.TYPE);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int off = field.getOffset();
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
return ((prim_field_data[off++] & 0xFF) << 24)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 16)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 8)
|
|
|
|
| (prim_field_data[off] & 0xFF);
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public long get(String name, long defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Long.TYPE);
|
2003-03-01 16:05:46 +01:00
|
|
|
|
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int off = field.getOffset();
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2004-07-09 17:37:31 +02:00
|
|
|
return (long)(((prim_field_data[off++] & 0xFFL) << 56)
|
|
|
|
| ((prim_field_data[off++] & 0xFFL) << 48)
|
|
|
|
| ((prim_field_data[off++] & 0xFFL) << 40)
|
|
|
|
| ((prim_field_data[off++] & 0xFFL) << 32)
|
2003-03-01 16:05:46 +01:00
|
|
|
| ((prim_field_data[off++] & 0xFF) << 24)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 16)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 8)
|
|
|
|
| (prim_field_data[off] & 0xFF));
|
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public float get(String name, float defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Float.TYPE);
|
2003-03-01 16:05:46 +01:00
|
|
|
|
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int off = field.getOffset();
|
2003-03-01 16:05:46 +01:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
return Float.intBitsToFloat(((prim_field_data[off++] & 0xFF) << 24)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 16)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 8)
|
|
|
|
| (prim_field_data[off] & 0xFF));
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public double get(String name, double defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = getField(name, Double.TYPE);
|
2003-03-01 16:05:46 +01:00
|
|
|
|
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
int off = field.getOffset();
|
2003-03-01 16:05:46 +01:00
|
|
|
|
|
|
|
return Double.longBitsToDouble
|
2004-07-09 17:37:31 +02:00
|
|
|
( (long) (((prim_field_data[off++] & 0xFFL) << 56)
|
|
|
|
| ((prim_field_data[off++] & 0xFFL) << 48)
|
|
|
|
| ((prim_field_data[off++] & 0xFFL) << 40)
|
|
|
|
| ((prim_field_data[off++] & 0xFFL) << 32)
|
2000-05-19 19:55:34 +02:00
|
|
|
| ((prim_field_data[off++] & 0xFF) << 24)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 16)
|
|
|
|
| ((prim_field_data[off++] & 0xFF) << 8)
|
2003-03-01 16:05:46 +01:00
|
|
|
| (prim_field_data[off] & 0xFF)));
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
public Object get(String name, Object defvalue)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IOException, IllegalArgumentException
|
|
|
|
{
|
|
|
|
ObjectStreamField field =
|
2003-12-30 16:51:15 +01:00
|
|
|
getField(name, defvalue == null ? null : defvalue.getClass ());
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-03-01 16:05:46 +01:00
|
|
|
if (field == null)
|
|
|
|
return defvalue;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
return objs[field.getOffset()];
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
private ObjectStreamField getField(String name, Class type)
|
2003-03-01 16:05:46 +01:00
|
|
|
throws IllegalArgumentException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
ObjectStreamField field = clazz.getField(name);
|
2003-12-23 23:06:01 +01:00
|
|
|
boolean illegal = false;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
try
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Class field_type = field.getType();
|
|
|
|
|
|
|
|
if (type == field_type ||
|
|
|
|
(type == null && !field_type.isPrimitive()))
|
|
|
|
{
|
|
|
|
/* See defaulted */
|
|
|
|
return field;
|
|
|
|
}
|
|
|
|
|
|
|
|
illegal = true;
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("Field requested is of type "
|
|
|
|
+ field_type.getName()
|
|
|
|
+ ", but requested type was "
|
|
|
|
+ (type == null ? "Object" : type.getName()));
|
|
|
|
}
|
|
|
|
catch (NullPointerException _)
|
|
|
|
{
|
|
|
|
/* Here we catch NullPointerException, because it may
|
|
|
|
only come from the call 'field.getType()'. If field
|
|
|
|
is null, we have to return null and classpath ethic
|
|
|
|
say we must try to avoid 'if (xxx == null)'.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException e)
|
|
|
|
{
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
/* If this is an unassigned field we should return
|
|
|
|
* the default value.
|
|
|
|
*/
|
|
|
|
if (!illegal && field != null && !field.isToSet() && field.isPersistent())
|
|
|
|
return null;
|
|
|
|
|
|
|
|
/* We do not want to modify transient fields. They should
|
|
|
|
* be left to 0.
|
|
|
|
*/
|
|
|
|
try
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
Field f = clazz.forClass().getDeclaredField(name);
|
2003-12-23 23:06:01 +01:00
|
|
|
if (Modifier.isTransient(f.getModifiers()))
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("no such field (non transient) " + name);
|
|
|
|
if (field == null && f.getType() != type)
|
|
|
|
throw new IllegalArgumentException
|
|
|
|
("Invalid requested type for field " + name);
|
|
|
|
}
|
|
|
|
catch (NoSuchFieldException e)
|
|
|
|
{
|
|
|
|
if (field == null)
|
|
|
|
throw new IllegalArgumentException(e.getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
|
|
|
};
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-23 23:06:01 +01:00
|
|
|
fieldsAlreadyRead = true;
|
|
|
|
return prereadFields;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* Protected constructor that allows subclasses to override
|
|
|
|
* deserialization. This constructor should be called by subclasses
|
|
|
|
* that wish to override <code>readObject (Object)</code>. This
|
|
|
|
* method does a security check <i>NOTE: currently not
|
|
|
|
* implemented</i>, then sets a flag that informs
|
|
|
|
* <code>readObject (Object)</code> to call the subclasses
|
|
|
|
* <code>readObjectOverride (Object)</code> method.
|
|
|
|
*
|
|
|
|
* @see #readObjectOverride()
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
protected ObjectInputStream()
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException, SecurityException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
SecurityManager sec_man = System.getSecurityManager();
|
2000-05-19 19:55:34 +02:00
|
|
|
if (sec_man != null)
|
2003-12-30 16:51:15 +01:00
|
|
|
sec_man.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION);
|
2000-05-19 19:55:34 +02:00
|
|
|
this.useSubclassMethod = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-03-24 09:27:28 +01:00
|
|
|
* This method allows subclasses to override the default
|
|
|
|
* de serialization mechanism provided by
|
|
|
|
* <code>ObjectInputStream</code>. To make this method be used for
|
|
|
|
* writing objects, subclasses must invoke the 0-argument
|
|
|
|
* constructor on this class from their constructor.
|
|
|
|
*
|
|
|
|
* @see #ObjectInputStream()
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
protected Object readObjectOverride()
|
2000-05-19 19:55:34 +02:00
|
|
|
throws ClassNotFoundException, IOException, OptionalDataException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new IOException("Subclass of ObjectInputStream must implement readObjectOverride");
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-16 14:45:01 +01:00
|
|
|
/**
|
|
|
|
* Assigns the next available handle to <code>obj</code>.
|
|
|
|
*
|
|
|
|
* @param obj The object for which we want a new handle.
|
|
|
|
* @return A valid handle for the specified object.
|
|
|
|
*/
|
2003-12-30 16:51:15 +01:00
|
|
|
private int assignNewHandle(Object obj)
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
this.objectLookupTable.put(new Integer(this.nextOID),
|
|
|
|
new ObjectIdentityWrapper(obj));
|
2000-05-19 19:55:34 +02:00
|
|
|
return this.nextOID++;
|
|
|
|
}
|
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
private Object processResolution(ObjectStreamClass osc, Object obj, int handle)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws IOException
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if (osc != null && obj instanceof Serializable)
|
2000-10-06 01:57:16 +02:00
|
|
|
{
|
|
|
|
try
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
Method m = osc.readResolveMethod;
|
|
|
|
if(m != null)
|
|
|
|
{
|
|
|
|
obj = m.invoke(obj, new Object[] {});
|
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-10-06 01:57:16 +02:00
|
|
|
catch (IllegalAccessException ignore)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
}
|
2000-10-06 01:57:16 +02:00
|
|
|
catch (InvocationTargetException ignore)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
}
|
2000-10-06 01:57:16 +02:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
if (this.resolveEnabled)
|
2003-12-30 16:51:15 +01:00
|
|
|
obj = resolveObject(obj);
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
this.objectLookupTable.put(new Integer(handle),
|
|
|
|
new ObjectIdentityWrapper(obj));
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
private void clearHandles()
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
this.objectLookupTable.clear();
|
2000-05-19 19:55:34 +02:00
|
|
|
this.nextOID = baseWireHandle;
|
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
private void readNextBlock() throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
readNextBlock(this.realInputStream.readByte());
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
private void readNextBlock(byte marker) throws IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
if (marker == TC_BLOCKDATA)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("BLOCK DATA SIZE=");
|
2003-12-30 16:51:15 +01:00
|
|
|
this.blockDataBytes = this.realInputStream.readUnsignedByte();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
else if (marker == TC_BLOCKDATALONG)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElement("BLOCK DATA LONG SIZE=");
|
2003-12-30 16:51:15 +01:00
|
|
|
this.blockDataBytes = this.realInputStream.readInt();
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
else
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new EOFException("Attempt to read primitive data, but no data block is active.");
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
|
|
|
|
if (this.blockData.length < this.blockDataBytes)
|
|
|
|
this.blockData = new byte[this.blockDataBytes];
|
|
|
|
|
|
|
|
this.realInputStream.readFully (this.blockData, 0, this.blockDataBytes);
|
|
|
|
this.blockDataPosition = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void readArrayElements (Object array, Class clazz)
|
|
|
|
throws ClassNotFoundException, IOException
|
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
if (clazz.isPrimitive())
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-03-01 16:05:46 +01:00
|
|
|
if (clazz == Boolean.TYPE)
|
|
|
|
{
|
|
|
|
boolean[] cast_array = (boolean[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readBoolean();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (clazz == Byte.TYPE)
|
|
|
|
{
|
|
|
|
byte[] cast_array = (byte[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readByte();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (clazz == Character.TYPE)
|
|
|
|
{
|
|
|
|
char[] cast_array = (char[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readChar();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (clazz == Double.TYPE)
|
|
|
|
{
|
|
|
|
double[] cast_array = (double[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readDouble();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (clazz == Float.TYPE)
|
|
|
|
{
|
|
|
|
float[] cast_array = (float[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readFloat();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (clazz == Integer.TYPE)
|
|
|
|
{
|
|
|
|
int[] cast_array = (int[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readInt();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (clazz == Long.TYPE)
|
|
|
|
{
|
|
|
|
long[] cast_array = (long[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readLong();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (clazz == Short.TYPE)
|
|
|
|
{
|
|
|
|
short[] cast_array = (short[])array;
|
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = this.realInputStream.readShort();
|
2003-03-01 16:05:46 +01:00
|
|
|
return;
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
2003-03-01 16:05:46 +01:00
|
|
|
else
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-03-01 16:05:46 +01:00
|
|
|
Object[] cast_array = (Object[])array;
|
2000-05-19 19:55:34 +02:00
|
|
|
for (int i=0; i < cast_array.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
cast_array[i] = readObject();
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-03-14 12:54:38 +01:00
|
|
|
private void readFields (Object obj, ObjectStreamClass stream_osc)
|
2000-05-19 19:55:34 +02:00
|
|
|
throws ClassNotFoundException, IOException
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
ObjectStreamField[] fields = stream_osc.fieldMapping;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
for (int i = 0; i < fields.length; i += 2)
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
ObjectStreamField stream_field = fields[i];
|
|
|
|
ObjectStreamField real_field = fields[i + 1];
|
2004-02-28 22:28:53 +01:00
|
|
|
boolean read_value = (stream_field != null && stream_field.getOffset() >= 0 && stream_field.isToSet());
|
|
|
|
boolean set_value = (real_field != null && real_field.isToSet());
|
|
|
|
String field_name;
|
|
|
|
char type;
|
2003-12-23 23:06:01 +01:00
|
|
|
|
2004-02-28 22:28:53 +01:00
|
|
|
if (stream_field != null)
|
|
|
|
{
|
|
|
|
field_name = stream_field.getName();
|
|
|
|
type = stream_field.getTypeCode();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
field_name = real_field.getName();
|
|
|
|
type = real_field.getTypeCode();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(type)
|
|
|
|
{
|
|
|
|
case 'Z':
|
|
|
|
{
|
|
|
|
boolean value =
|
|
|
|
read_value ? this.realInputStream.readBoolean() : false;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setBooleanField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'B':
|
|
|
|
{
|
|
|
|
byte value =
|
|
|
|
read_value ? this.realInputStream.readByte() : 0;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setByteField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'C':
|
|
|
|
{
|
|
|
|
char value =
|
|
|
|
read_value ? this.realInputStream.readChar(): 0;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setCharField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'D':
|
|
|
|
{
|
|
|
|
double value =
|
|
|
|
read_value ? this.realInputStream.readDouble() : 0;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setDoubleField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'F':
|
|
|
|
{
|
|
|
|
float value =
|
|
|
|
read_value ? this.realInputStream.readFloat() : 0;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setFloatField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'I':
|
|
|
|
{
|
|
|
|
int value =
|
|
|
|
read_value ? this.realInputStream.readInt() : 0;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setIntField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'J':
|
|
|
|
{
|
|
|
|
long value =
|
|
|
|
read_value ? this.realInputStream.readLong() : 0;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setLongField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'S':
|
|
|
|
{
|
|
|
|
short value =
|
|
|
|
read_value ? this.realInputStream.readShort() : 0;
|
|
|
|
if (dump && read_value && set_value)
|
|
|
|
dumpElementln(" " + field_name + ": " + value);
|
|
|
|
if (set_value)
|
|
|
|
real_field.setShortField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'L':
|
|
|
|
case '[':
|
|
|
|
{
|
|
|
|
Object value =
|
|
|
|
read_value ? readObject() : null;
|
|
|
|
if (set_value)
|
|
|
|
real_field.setObjectField(obj, value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
throw new InternalError("Invalid type code: " + type);
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-02-28 22:28:53 +01:00
|
|
|
|
2000-05-19 19:55:34 +02:00
|
|
|
// Toggles writing primitive data to block-data buffer.
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
private boolean setBlockDataMode (boolean on)
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
boolean oldmode = this.readDataFromBlock;
|
2000-05-19 19:55:34 +02:00
|
|
|
this.readDataFromBlock = on;
|
|
|
|
|
|
|
|
if (on)
|
|
|
|
this.dataInputStream = this.blockDataInput;
|
|
|
|
else
|
|
|
|
this.dataInputStream = this.realInputStream;
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
return oldmode;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// returns a new instance of REAL_CLASS that has been constructed
|
2001-12-09 01:17:07 +01:00
|
|
|
// only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS)
|
2000-05-19 19:55:34 +02:00
|
|
|
private Object newObject (Class real_class, Class constructor_class)
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
throws ClassNotFoundException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
try
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
Object obj = allocateObject (real_class);
|
|
|
|
callConstructor (constructor_class, obj);
|
|
|
|
return obj;
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
catch (InstantiationException e)
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
throw new ClassNotFoundException
|
|
|
|
("Instance of " + real_class + " could not be created");
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// runs all registered ObjectInputValidations in prioritized order
|
|
|
|
// on OBJ
|
2003-12-30 16:51:15 +01:00
|
|
|
private void invokeValidators() throws InvalidObjectException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
Object[] validators = new Object[this.validators.size()];
|
2000-05-19 19:55:34 +02:00
|
|
|
this.validators.copyInto (validators);
|
|
|
|
Arrays.sort (validators);
|
|
|
|
|
|
|
|
try
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
for (int i=0; i < validators.length; i++)
|
2003-12-30 16:51:15 +01:00
|
|
|
((ObjectInputValidation)validators[i]).validateObject();
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
finally
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
this.validators.removeAllElements();
|
2003-03-01 16:05:46 +01:00
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
2003-12-16 14:45:01 +01:00
|
|
|
/**
|
|
|
|
* This native method is used to get access to the protected method
|
|
|
|
* of the same name in SecurityManger.
|
|
|
|
*
|
|
|
|
* @param sm SecurityManager instance which should be called.
|
|
|
|
* @return The current class loader in the calling stack.
|
|
|
|
*/
|
2004-11-25 04:47:08 +01:00
|
|
|
|
2004-06-21 18:52:14 +02:00
|
|
|
private static native ClassLoader currentClassLoader (SecurityManager sm);
|
|
|
|
|
|
|
|
private native ClassLoader getCallersClassLoader();
|
2003-03-01 16:05:46 +01:00
|
|
|
|
2004-09-24 11:31:28 +02:00
|
|
|
private void callReadMethod (Method readObject, Class klass, Object obj)
|
|
|
|
throws ClassNotFoundException, IOException
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
readObject.invoke(obj, new Object[] { this });
|
2003-08-01 05:34:52 +02:00
|
|
|
}
|
2001-01-27 07:04:29 +01:00
|
|
|
catch (InvocationTargetException x)
|
|
|
|
{
|
|
|
|
/* Rethrow if possible. */
|
|
|
|
Throwable exception = x.getTargetException();
|
|
|
|
if (exception instanceof RuntimeException)
|
|
|
|
throw (RuntimeException) exception;
|
|
|
|
if (exception instanceof IOException)
|
|
|
|
throw (IOException) exception;
|
2004-09-24 11:31:28 +02:00
|
|
|
if (exception instanceof ClassNotFoundException)
|
|
|
|
throw (ClassNotFoundException) exception;
|
2001-01-27 07:04:29 +01:00
|
|
|
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new IOException("Exception thrown from readObject() on " +
|
2001-01-27 07:04:29 +01:00
|
|
|
klass + ": " + exception.getClass().getName());
|
|
|
|
}
|
|
|
|
catch (Exception x)
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
2003-12-30 16:51:15 +01:00
|
|
|
throw new IOException("Failure invoking readObject() on " +
|
2001-01-27 07:04:29 +01:00
|
|
|
klass + ": " + x.getClass().getName());
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
2003-12-23 23:06:01 +01:00
|
|
|
|
|
|
|
// Invalidate fields which has been read through readFields.
|
|
|
|
prereadFields = null;
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private native Object allocateObject (Class clazz)
|
|
|
|
throws InstantiationException;
|
|
|
|
|
|
|
|
private native void callConstructor (Class clazz, Object obj);
|
|
|
|
|
|
|
|
private static final int BUFFER_SIZE = 1024;
|
|
|
|
|
|
|
|
private DataInputStream realInputStream;
|
|
|
|
private DataInputStream dataInputStream;
|
|
|
|
private DataInputStream blockDataInput;
|
|
|
|
private int blockDataPosition;
|
|
|
|
private int blockDataBytes;
|
|
|
|
private byte[] blockData;
|
|
|
|
private boolean useSubclassMethod;
|
|
|
|
private int nextOID;
|
|
|
|
private boolean resolveEnabled;
|
|
|
|
private Hashtable objectLookupTable;
|
|
|
|
private Object currentObject;
|
|
|
|
private ObjectStreamClass currentObjectStreamClass;
|
|
|
|
private boolean readDataFromBlock;
|
|
|
|
private boolean isDeserializing;
|
|
|
|
private boolean fieldsAlreadyRead;
|
|
|
|
private Vector validators;
|
2003-12-16 14:45:01 +01:00
|
|
|
private Hashtable classLookupTable;
|
2003-12-23 23:06:01 +01:00
|
|
|
private GetField prereadFields;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
private static boolean dump = false && Configuration.DEBUG;
|
2000-05-19 19:55:34 +02:00
|
|
|
|
2004-06-21 18:52:14 +02:00
|
|
|
private ClassLoader callersClassLoader;
|
|
|
|
|
|
|
|
// The nesting depth for debugging output
|
|
|
|
private int depth = 0;
|
|
|
|
|
2000-11-26 02:48:04 +01:00
|
|
|
private void dumpElement (String msg)
|
2004-11-25 04:47:08 +01:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
System.out.print(msg);
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
2000-11-26 02:48:04 +01:00
|
|
|
|
|
|
|
private void dumpElementln (String msg)
|
2000-05-19 19:55:34 +02:00
|
|
|
{
|
ObjectInputStream.java: Made all calls to dumpElement[ln] conditional on dump flag.
2004-02-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java: Made all calls
to dumpElement[ln] conditional on dump flag. (readObject): Changed to
use cached info from ObjectStreamClass. (readClassDescriptor):
Cache more information in ObjectStreamClass. (processResolution,
readFields): Use cached info from ObjectStreamClass.
(newObject): Throw exception instead of returning null for failure.
(getField, getMethod, callReadMethod, setBooleanField, setByteField,
setCharField, setDoubleField, setFloatField, setIntField,
setLongField, setShortField, setObjectField, readObjectParams):
Removed. (dumpElement, dumpElementln): Removed dump flag condition
check.
* java/io/ObjectStreamField.java (hasReadMethod): Removed.
(setClass): Added call to cacheMethods() (findMethod): New method.
(cacheMethods): New method. (ObjectStreamClass): Added call to
cacheMethods(). (setFields): Cache fields. (getClassUID): Use
AccessController.doPrivileged to invoke setAccessible.
(readObjectMethod, readResolveMethod, realClassIsSerializable,
realClassIsExternalizable, fieldMapping, firstNonSerializableParent):
New fields.
* java/io/ObjectStreamField.java (ObjectStreamField): New constructor.
(ObjectStreamField): Removed FIXME workaround. (getTypeString,
isPrimitive): Made safe for cases where type == null.
(setBooleanField, setByteField, setCharField, setShortField,
setIntField, setLongField, setFloatField, setDoubleField,
setObjectField): New methods.
From-SVN: r77395
2004-02-06 14:27:36 +01:00
|
|
|
System.out.println(msg);
|
2004-06-21 18:52:14 +02:00
|
|
|
for (int i = 0; i < depth; i++)
|
|
|
|
System.out.print (" ");
|
|
|
|
System.out.print (Thread.currentThread() + ": ");
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
Makefile.am (nat_source_files): Remove java/io/natObjectOutputStream.cc.
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
From-SVN: r63556
2003-02-28 12:38:56 +01:00
|
|
|
|
|
|
|
static
|
2003-03-01 16:05:46 +01:00
|
|
|
{
|
|
|
|
if (Configuration.INIT_LOAD_LIBRARY)
|
|
|
|
{
|
|
|
|
System.loadLibrary ("javaio");
|
|
|
|
}
|
|
|
|
}
|
2000-05-19 19:55:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// used to keep a prioritized list of object validators
|
|
|
|
class ValidatorAndPriority implements Comparable
|
|
|
|
{
|
|
|
|
int priority;
|
|
|
|
ObjectInputValidation validator;
|
|
|
|
|
|
|
|
ValidatorAndPriority (ObjectInputValidation validator, int priority)
|
|
|
|
{
|
|
|
|
this.priority = priority;
|
|
|
|
this.validator = validator;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int compareTo (Object o)
|
|
|
|
{
|
|
|
|
ValidatorAndPriority vap = (ValidatorAndPriority)o;
|
|
|
|
return this.priority - vap.priority;
|
|
|
|
}
|
|
|
|
}
|