You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "spark shen (JIRA)" <ji...@apache.org> on 2006/08/14 08:51:15 UTC
[jira] Created: (HARMONY-1163) [classlib][luni] Two consecutive
java.io.ObjectInputStream.readObject() of enum type will trigger an
unspecified StreamCorruptedException
[classlib][luni] Two consecutive java.io.ObjectInputStream.readObject() of enum type will trigger an unspecified StreamCorruptedException
-----------------------------------------------------------------------------------------------------------------------------------------
Key: HARMONY-1163
URL: http://issues.apache.org/jira/browse/HARMONY-1163
Project: Harmony
Issue Type: Bug
Components: Classlib
Reporter: spark shen
Using the enum type below:
static enum EnumFoo {
a, b,
}
and write the elements of it out :
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(EnumFoo.a);
oos.writeObject(EnumFoo.b);
out.flush();
out.close();
Then read them in :
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
ObjectInputStream ois = new ObjectInputStream(in);
Object result = ois.readObject();
// an unspecified StreamCorruptedException will be thrown out here.
result = ois.readObject();
ois.close();
An unspecified StreamCorruptedException will be thrown out.
Best regards
Spark Shen
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-1163) [classlib][luni] Two consecutive
java.io.ObjectInputStream.readObject() of enum type will trigger an
unspecified StreamCorruptedException
Posted by "Alexey Petrenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1163?page=comments#action_12427836 ]
Alexey Petrenko commented on HARMONY-1163:
------------------------------------------
Here is a testcase as a class...
import java.io.*;
public class Harmony1163Test {
public static void main(String argv[]) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(EnumFoo.a);
oos.writeObject(EnumFoo.b);
out.flush();
out.close();
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
ObjectInputStream ois = new ObjectInputStream(in);
Object result = ois.readObject();
System.err.println(result);
// an unspecified StreamCorruptedException will be thrown out here.
result = ois.readObject();
System.err.println(result);
ois.close();
}
static enum EnumFoo {
a, b,
}
}
> [classlib][luni] Two consecutive java.io.ObjectInputStream.readObject() of enum type will trigger an unspecified StreamCorruptedException
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1163
> URL: http://issues.apache.org/jira/browse/HARMONY-1163
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: spark shen
>
> Using the enum type below:
> static enum EnumFoo {
> a, b,
> }
> and write the elements of it out :
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> ObjectOutputStream oos = new ObjectOutputStream(out);
> oos.writeObject(EnumFoo.a);
> oos.writeObject(EnumFoo.b);
> out.flush();
> out.close();
> Then read them in :
> ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
> ObjectInputStream ois = new ObjectInputStream(in);
> Object result = ois.readObject();
> // an unspecified StreamCorruptedException will be thrown out here.
> result = ois.readObject();
> ois.close();
> An unspecified StreamCorruptedException will be thrown out.
> Best regards
> Spark Shen
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (HARMONY-1163) [classlib][luni] Two consecutive
java.io.ObjectInputStream.readObject() of enum type will trigger an
unspecified StreamCorruptedException
Posted by "Jimmy, Jing Lv (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1163?page=comments#action_12428329 ]
Jimmy, Jing Lv commented on HARMONY-1163:
-----------------------------------------
Hi,
This is a bug of enum serialization. Seems it will meet some problems if parent classes are not enum. I will apply a patch for this soon.
> [classlib][luni] Two consecutive java.io.ObjectInputStream.readObject() of enum type will trigger an unspecified StreamCorruptedException
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1163
> URL: http://issues.apache.org/jira/browse/HARMONY-1163
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: spark shen
> Assigned To: Paulex Yang
>
> Using the enum type below:
> static enum EnumFoo {
> a, b,
> }
> and write the elements of it out :
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> ObjectOutputStream oos = new ObjectOutputStream(out);
> oos.writeObject(EnumFoo.a);
> oos.writeObject(EnumFoo.b);
> out.flush();
> out.close();
> Then read them in :
> ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
> ObjectInputStream ois = new ObjectInputStream(in);
> Object result = ois.readObject();
> // an unspecified StreamCorruptedException will be thrown out here.
> result = ois.readObject();
> ois.close();
> An unspecified StreamCorruptedException will be thrown out.
> Best regards
> Spark Shen
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-1163) [classlib][luni] Two consecutive
java.io.ObjectInputStream.readObject() of enum type will trigger an
unspecified StreamCorruptedException
Posted by "Jimmy, Jing Lv (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1163?page=all ]
Jimmy, Jing Lv updated HARMONY-1163:
------------------------------------
Attachment: Harmony-1163.zip
Hi,
Would you please try my patch? Thanks!
Best Regards,
Jimmy
> [classlib][luni] Two consecutive java.io.ObjectInputStream.readObject() of enum type will trigger an unspecified StreamCorruptedException
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1163
> URL: http://issues.apache.org/jira/browse/HARMONY-1163
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: spark shen
> Assigned To: Paulex Yang
> Attachments: Harmony-1163.zip
>
>
> Using the enum type below:
> static enum EnumFoo {
> a, b,
> }
> and write the elements of it out :
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> ObjectOutputStream oos = new ObjectOutputStream(out);
> oos.writeObject(EnumFoo.a);
> oos.writeObject(EnumFoo.b);
> out.flush();
> out.close();
> Then read them in :
> ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
> ObjectInputStream ois = new ObjectInputStream(in);
> Object result = ois.readObject();
> // an unspecified StreamCorruptedException will be thrown out here.
> result = ois.readObject();
> ois.close();
> An unspecified StreamCorruptedException will be thrown out.
> Best regards
> Spark Shen
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (HARMONY-1163) [classlib][luni] Two consecutive
java.io.ObjectInputStream.readObject() of enum type will trigger an
unspecified StreamCorruptedException
Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1163?page=all ]
Paulex Yang resolved HARMONY-1163.
----------------------------------
Resolution: Fixed
Jimmy, patch applied at revision r432196, thanks a lot for this enhancement.
Spark, please verify that the problem is fully fixed as you expected.
> [classlib][luni] Two consecutive java.io.ObjectInputStream.readObject() of enum type will trigger an unspecified StreamCorruptedException
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1163
> URL: http://issues.apache.org/jira/browse/HARMONY-1163
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: spark shen
> Assigned To: Paulex Yang
> Attachments: Harmony-1163.zip
>
>
> Using the enum type below:
> static enum EnumFoo {
> a, b,
> }
> and write the elements of it out :
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> ObjectOutputStream oos = new ObjectOutputStream(out);
> oos.writeObject(EnumFoo.a);
> oos.writeObject(EnumFoo.b);
> out.flush();
> out.close();
> Then read them in :
> ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
> ObjectInputStream ois = new ObjectInputStream(in);
> Object result = ois.readObject();
> // an unspecified StreamCorruptedException will be thrown out here.
> result = ois.readObject();
> ois.close();
> An unspecified StreamCorruptedException will be thrown out.
> Best regards
> Spark Shen
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (HARMONY-1163) [classlib][luni] Two consecutive
java.io.ObjectInputStream.readObject() of enum type will trigger an
unspecified StreamCorruptedException
Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1163?page=all ]
Paulex Yang reassigned HARMONY-1163:
------------------------------------
Assignee: Paulex Yang
> [classlib][luni] Two consecutive java.io.ObjectInputStream.readObject() of enum type will trigger an unspecified StreamCorruptedException
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1163
> URL: http://issues.apache.org/jira/browse/HARMONY-1163
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: spark shen
> Assigned To: Paulex Yang
>
> Using the enum type below:
> static enum EnumFoo {
> a, b,
> }
> and write the elements of it out :
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> ObjectOutputStream oos = new ObjectOutputStream(out);
> oos.writeObject(EnumFoo.a);
> oos.writeObject(EnumFoo.b);
> out.flush();
> out.close();
> Then read them in :
> ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
> ObjectInputStream ois = new ObjectInputStream(in);
> Object result = ois.readObject();
> // an unspecified StreamCorruptedException will be thrown out here.
> result = ois.readObject();
> ois.close();
> An unspecified StreamCorruptedException will be thrown out.
> Best regards
> Spark Shen
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira