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
This commit is contained in:
parent
28727f1fb3
commit
4480b3dcf6
9 changed files with 824 additions and 665 deletions
|
@ -47,8 +47,23 @@ public class ObjectStreamField implements java.lang.Comparable
|
|||
{
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.typename = TypeSignature.getEncodingOfClass(type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* There're many cases you can't get java.lang.Class from typename if your context
|
||||
* class loader can't load it, then use typename to construct the field
|
||||
*/
|
||||
ObjectStreamField (String name, String typename){
|
||||
this.name = name;
|
||||
this.typename = typename;
|
||||
try{
|
||||
type = TypeSignature.getClassForEncoding(typename);
|
||||
}catch(ClassNotFoundException e){
|
||||
type = Object.class; //??
|
||||
}
|
||||
}
|
||||
|
||||
public String getName ()
|
||||
{
|
||||
return name;
|
||||
|
@ -61,12 +76,13 @@ public class ObjectStreamField implements java.lang.Comparable
|
|||
|
||||
public char getTypeCode ()
|
||||
{
|
||||
return TypeSignature.getEncodingOfClass (type).charAt (0);
|
||||
return typename.charAt (0);
|
||||
}
|
||||
|
||||
public String getTypeString ()
|
||||
{
|
||||
return TypeSignature.getEncodingOfClass (type);
|
||||
// use intern()
|
||||
return typename.intern();
|
||||
}
|
||||
|
||||
public int getOffset ()
|
||||
|
@ -106,5 +122,6 @@ public class ObjectStreamField implements java.lang.Comparable
|
|||
|
||||
private String name;
|
||||
private Class type;
|
||||
private String typename;
|
||||
private int offset = -1; // XXX make sure this is correct
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue