harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jingkei Ly (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6354) XMLEncoder does not encode enumerations correctly
Date Thu, 15 Oct 2009 10:43:31 GMT

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


Mime
View raw message