JDK-6519016 : LTP: Java 6 breaks XML encoding of immutable boolean property
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_nevada
  • CPU: generic
  • Submitted: 2007-01-30
  • Updated: 2011-01-19
  • Resolved: 2007-02-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u2Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
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.

Comments
EVALUATION It looks like regression after 4741757. But it is duplicate of 4950122 that is fixed in 7. So we should backport the fix of 4950122 into 6u2.
01-02-2007