commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33965] New: - Can't XMLDecode an Enum
Date Fri, 11 Mar 2005 15:26:45 GMT
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: kevin.gilpin@alum.mit.edu


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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message