diff options
author | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-26 14:31:29 +0000 |
---|---|---|
committer | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-26 14:31:29 +0000 |
commit | 04562e6b1c585a68a8278bd83e3a521546efa117 (patch) | |
tree | 5adf7762dc6581c91705a6569ffe2b0e7aa990f5 /libjava/classpath/java/io/ObjectStreamClass.java | |
parent | 7938709957fc04becafae60bf202f5d21064c371 (diff) | |
download | gcc-04562e6b1c585a68a8278bd83e3a521546efa117.tar.gz |
2007-04-25 Andrew Haley <aph@redhat.com>
* java/io/ObjectStreamClass.java (ensureFieldsSet): New method.
(setFields): call ensureFieldsSet.
(fieldsSet): New field.
* java/io/ObjectOutputStream.java (writeFields): Call
osc.ensureFieldsSet().
* java/io/ObjectInputStream.java (parseContent): Assign the handle
for a PROXYCLASSDESC immediately after reading the marker.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124187 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/io/ObjectStreamClass.java')
-rw-r--r-- | libjava/classpath/java/io/ObjectStreamClass.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libjava/classpath/java/io/ObjectStreamClass.java b/libjava/classpath/java/io/ObjectStreamClass.java index 52a1ad42873..cc3d0a9e31f 100644 --- a/libjava/classpath/java/io/ObjectStreamClass.java +++ b/libjava/classpath/java/io/ObjectStreamClass.java @@ -654,11 +654,29 @@ outer: flags |= ObjectStreamConstants.SC_ENUM; } +/* GCJ LOCAL */ + // FIXME: This is a workaround for a fairly obscure bug that happens + // when reading a Proxy and then writing it back out again. The + // result is that the ObjectStreamClass doesn't have its fields set, + // generating a NullPointerException. Rather than this kludge we + // should probably fix the real bug, but it would require a fairly + // radical reorganization to do so. + final void ensureFieldsSet(Class cl) + { + if (! fieldsSet) + setFields(cl); + } +/* END GCJ LOCAL */ + // Sets fields to be a sorted array of the serializable fields of // clazz. private void setFields(Class cl) { +/* GCJ LOCAL */ + fieldsSet = true; +/* END GCJ LOCAL */ + SetAccessibleAction setAccessible = new SetAccessibleAction(); if (!isSerializable() || isExternalizable() || isEnum()) @@ -1094,6 +1112,11 @@ outer: boolean isProxyClass = false; +/* GCJ LOCAL */ + // True after setFields() has been called + private boolean fieldsSet = false; +/* END GCJ LOCAL */ + // This is probably not necessary because this class is special cased already // but it will avoid showing up as a discrepancy when comparing SUIDs. private static final long serialVersionUID = -6120832682080437368L; |