You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Jingkei Ly (JIRA)" <ji...@apache.org> on 2009/10/15 12:43:31 UTC
[jira] Commented: (HARMONY-6354) XMLEncoder does not encode
enumerations correctly
[ https://issues.apache.org/jira/browse/HARMONY-6354?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766004#action_12766004 ]
Jingkei Ly commented on HARMONY-6354:
-------------------------------------
The following demonstrates the problem:
{code}
package test;
import java.beans.XMLEncoder;
import java.io.FileOutputStream;
public class TestEnum {
public static void main(String[] args) throws Exception {
FileOutputStream os = new FileOutputStream("test1.xml");
XMLEncoder encoder = new XMLEncoder(os);
encoder.writeObject(NumbersEnum.ONE);
encoder.flush();
encoder.close();
}
}
enum NumbersEnum {
ONE, TWO;
}
{code}
Running this prints this message to stderr:
Exception during encoding:java.lang.Exception: failed to write expression: NumbersEnum=Class.new();
Continue...
And the bean encoded in test1.xml is:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0" class="java.beans.XMLDecoder">
<object class="test.NumbersEnum"/>
</java>
{code:xml}
Instead of the expected:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<java version="1.5.0" class="java.beans.XMLDecoder">
<object class="java.lang.Enum" method="valueOf">
<class>test.NumbersEnum</class>
<string>ONE</string>
</object>
</java>
{code:xml}
> XMLEncoder does not encode enumerations correctly
> -------------------------------------------------
>
> Key: HARMONY-6354
> URL: https://issues.apache.org/jira/browse/HARMONY-6354
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Affects Versions: 5.0M11
> Reporter: Jingkei Ly
>
> This is also a bug in the RI of Java 5 (the bug report is here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=50154030) and was only fixed in the RI of Java 6.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.