[ 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
|