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