Harmony
  1. Harmony
  2. HARMONY-4307

[classlib][luni] java.io.ObjectStreamField.getType() sometimes returns null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0M2, 5.0M14
    • Component/s: Classlib
    • Labels:
      None
    • Environment:
      SLES 10 x86_64, DRLVM release build

      Description

      The method java.io.ObjectStreamField.getType() sometimes returns null. Because of this issue the test org.apache.harmony.awt.ListenerListTest sometimes fails on Linux x86_64 on release build of DRLVM. I'm not sure if it's classlib issue, but it's most probably not AWT issue.
      For additional info please see the discussion in the dev-list http://thread.gmane.org/gmane.comp.java.harmony.devel/27651

      1. H-4307.patch
        3 kB
        Mikhail Markov

        Activity

        Andrey Pavlenko created issue -
        Hide
        Vladimir Ivanov added a comment -

        For me the test org.apache.harmony.awt.ListenerListTest failed not intermittently on the SLES 9 x86_64, DRLVM debug build.

        Show
        Vladimir Ivanov added a comment - For me the test org.apache.harmony.awt.ListenerListTest failed not intermittently on the SLES 9 x86_64, DRLVM debug build.
        Hide
        Mikhail Markov added a comment -

        Although i could not create a reproducer to confirm the issue, after some code investigation i've found a gap allowing type to be null:
        It's package-private constructor of ObjectStreamField - if called then type is null and getType() not only could return null, but in some circumstances could throw NPE. It's expected that other classes in java.io package using this constructor will call resolve() method before actual class using but until that the class is in invalid state. So, it seems that type should be initialized to some non-null value in this case. I'll provide the patch soon.

        Show
        Mikhail Markov added a comment - Although i could not create a reproducer to confirm the issue, after some code investigation i've found a gap allowing type to be null: It's package-private constructor of ObjectStreamField - if called then type is null and getType() not only could return null, but in some circumstances could throw NPE. It's expected that other classes in java.io package using this constructor will call resolve() method before actual class using but until that the class is in invalid state. So, it seems that type should be initialized to some non-null value in this case. I'll provide the patch soon.
        Hide
        Mikhail Markov added a comment -

        Here is the patch adding default type resolution to ObjectStreamField.
        Could someone from committers please try it? Thanks!

        Show
        Mikhail Markov added a comment - Here is the patch adding default type resolution to ObjectStreamField. Could someone from committers please try it? Thanks!
        Mikhail Markov made changes -
        Field Original Value New Value
        Attachment H-4307.patch [ 12361476 ]
        Tony Wu made changes -
        Assignee Tony Wu [ tony.wu ]
        Hide
        Vladimir Ivanov added a comment -

        Last days the test org.apache.harmony.awt.ListenerListTest failed on the Win x86_64 with the same execution log:
        Test: testSerialize
        Class: org.apache.harmony.awt.ListenerListTest
        java.lang.NullPointerException
        at java.io.ObjectStreamClass.buildFieldDescriptors(ObjectStreamClass.java:322)
        at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:229)
        at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:907)
        at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:884)
        at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1844)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1770)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1734)
        at org.apache.harmony.awt.ListenerList.writeObject(ListenerList.java:180)
        at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
        at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1301)
        at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1659)
        at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1927)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1770)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1734)
        at org.apache.harmony.awt.ListenerListTest.writeAndRead(ListenerListTest.java:57)
        at org.apache.harmony.awt.ListenerListTest.testSerialize(ListenerListTest.java:46)
        at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)

        Test will be excluded for the Windows X86_64 too.

        Show
        Vladimir Ivanov added a comment - Last days the test org.apache.harmony.awt.ListenerListTest failed on the Win x86_64 with the same execution log: Test: testSerialize Class: org.apache.harmony.awt.ListenerListTest java.lang.NullPointerException at java.io.ObjectStreamClass.buildFieldDescriptors(ObjectStreamClass.java:322) at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:229) at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:907) at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:884) at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1844) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1770) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1734) at org.apache.harmony.awt.ListenerList.writeObject(ListenerList.java:180) at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java) at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1301) at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1659) at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1927) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1770) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1734) at org.apache.harmony.awt.ListenerListTest.writeAndRead(ListenerListTest.java:57) at org.apache.harmony.awt.ListenerListTest.testSerialize(ListenerListTest.java:46) at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java) Test will be excluded for the Windows X86_64 too.
        Hide
        Mikhail Markov added a comment -

        Tony, is everything ok with my patch - are you going to integrate it?

        Show
        Mikhail Markov added a comment - Tony, is everything ok with my patch - are you going to integrate it?
        Oliver Deakin made changes -
        Assignee Tony Wu [ tony.wu ] Oliver Deakin [ odeakin ]
        Hide
        Oliver Deakin added a comment -

        Hope you don't mind me stealing this issue Tony

        Thanks Andrey and Mikhail. Patch applied at repo revision r926547 - please check that it was applied as expected.

        Show
        Oliver Deakin added a comment - Hope you don't mind me stealing this issue Tony Thanks Andrey and Mikhail. Patch applied at repo revision r926547 - please check that it was applied as expected.
        Oliver Deakin made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 6.0M2 [ 12314804 ]
        Fix Version/s 5.0M14 [ 12314803 ]
        Resolution Fixed [ 1 ]
        Hide
        Oliver Deakin added a comment -

        Closing...

        Show
        Oliver Deakin added a comment - Closing...
        Oliver Deakin made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Mark Hindess added a comment -

        Removed test from exclude list with commit r948719.

        Show
        Mark Hindess added a comment - Removed test from exclude list with commit r948719.

          People

          • Assignee:
            Oliver Deakin
            Reporter:
            Andrey Pavlenko
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development