You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2009/06/24 17:47:07 UTC

[jira] Updated: (HARMONY-6228) [classlib][text] SimpleDateFormat serialization round trip fails with NPE

     [ https://issues.apache.org/jira/browse/HARMONY-6228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Ellison updated HARMONY-6228:
---------------------------------

    Attachment: sdf-read.jar
                sdf-hy.ser
                sdf-ri.ser

Looks like there may be a problem in serialization rather than specifically in the SimpleDateFormat.

I've attached three files:

sdf-hy.ser  = the serialized form of a simple date format instance, from harmony
sdf-ri.ser  = the same object serialized by the RI
sdf-read.jar = java code to read and compare the serialized instances

Here's what I see.

Using Harmony,
  read sdf-hy.ser returns false.  It should round trip as true.
  read sdf-ri.ser gives a segmentation error!

Using the RI,
  read sdf-hy.ser returns false.  It does not recognise our form.
  read sdf-ri.ser returns true.  The RI does round trip successfully.

Two questions arise:
1) why are we writing out the object in the wrong format
2) why do we seg fault when reading in the RI format

> [classlib][text] SimpleDateFormat serialization round trip fails with NPE
> -------------------------------------------------------------------------
>
>                 Key: HARMONY-6228
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6228
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M9
>         Environment: All
>            Reporter: Tim Ellison
>         Attachments: sdf-hy.ser, sdf-read.jar, sdf-ri.ser
>
>
> The following code causes a NPE on Harmony, but passes ok on the RI:
>         SimpleDateFormat sdf = new SimpleDateFormat(
>                 "EEE, d MMM yyyy HH:mm:ss Z");
>         ByteArrayOutputStream bos = new ByteArrayOutputStream();
>         ObjectOutputStream oos = new ObjectOutputStream(bos);
>         oos.writeObject(sdf);
>         oos.close();
>         ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
>         ObjectInputStream ois = new ObjectInputStream(bis);
>         SimpleDateFormat sdf2 = (SimpleDateFormat)ois.readObject();
>         ois.close();
> The walkback is:
> java.lang.reflect.InvocationTargetException
>         at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
>         at java.lang.reflect.Method.invoke(Method.java:317)
>         at org.apache.harmony.vm.JarRunner.main(JarRunner.java:89)
> Caused by: java.lang.NullPointerException
>         at java.text.SimpleDateFormat.set2DigitYearStart(SimpleDateFormat.java:722)
>         at java.text.SimpleDateFormat.readObject(SimpleDateFormat.java:787)
>         at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
>         at java.lang.reflect.Method.invoke(Method.java:317)
>         at java.io.ObjectInputStream.readObjectForClass(ObjectInputStream.java:1406)
>         at java.io.ObjectInputStream.readHierarchy(ObjectInputStream.java:1329)
>         at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2003)
>         at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:802)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2152)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2107)
>         at SDFTest.main(SDFTest.java:21)
>         at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
>         ... 2 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.