DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33965>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33965

           Summary: Can't XMLDecode an Enum
           Product: Commons
           Version: 2.0 Final
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Lang
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


I am encoding and decoding Enums using java.beans.XMLEncoder/Decoder.

When an Enum is decoded, I am using the following to get the instance. The
enumClass name and the enum name are stored in the serialized XML file, then
used to restore the bean at read time
        return EnumUtils.getEnum(enumClass, name);

The problem is that the Enum.cEnumClasses map may not contain an entry for the
Enum class yet, despite the fact that the Class for the enum has been loaded.

If I loop through the Class.fields using reflection and get(null) the value for
each one, then the cEnumClasses is populated and getEnum works.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to