Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-2146549

LTP: DefaultPersistenceDelegate does not handle boolean properties in a superclass.

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b76
    • Introduced In Version:
      6
    • Resolved In Build:
      b01

      Description

      A class with an immutable boolean property "ascending", accessed by the public method isAscending(), cannot be encoded using XMLEncoder on Java 6, even though the encoding succeeds on Java 5. I attached TestBean.java and SortCriteria.java to reproduce the bug:

      1. Set Java 5 (as root):
      ; rm /usr/java
      ; ln -s /usr/jdk/jdk1.5.0_08 /usr/java
      ; java -version
      java version "1.5.0_08"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
      Java HotSpot(TM) Server VM (build 1.5.0_08-b03, mixed mode)
      ;

      2. Compile and run attached classes (as non-root):
      ; javac -cp . TestBean.java SortCriteria.java
      ; java -cp . TestBean
      encoded: Count descending
      decoded: Count descending
      ;

      3. Set Java 6 (as root):
      ; rm /usr/java
      ; ln -s /usr/jdk/jdk1.6.0 /usr/java
      ; java -version
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b100)
      Java HotSpot(TM) Server VM (build 1.6.0-rc-b100, mixed mode)
      ;

      4. Compile and run attached classes (as non-root):
      ; javac -cp . TestBean.java SortCriteria.java
      ; java -cp . TestBean
      java.lang.NoSuchMethodException: SortCriteria.getAscending
      Continuing ...
      java.lang.IllegalArgumentException
      Continuing ...
      java.lang.Exception: XMLEncoder: discarding statement XMLEncoder.writeObject(SortCriteria);
      Continuing ...
      encoded: Count descending
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
              at com.sun.beans.ObjectHandler.dequeueResult(ObjectHandler.java:139)
              at java.beans.XMLDecoder.readObject(XMLDecoder.java:201)
              at TestBean.main(TestBean.java:44)
      ;

      This was reproducible on sparc and amd64.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              malenkov Sergey Malenkov (Inactive)
              Reporter:
              malenkov Sergey Malenkov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: