Issue Details (XML | Word | Printable)

Key: LANG-153
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Kevin Gilpin
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Lang

[lang] Can't XMLDecode an Enum

Created: 12/Mar/05 12:26 AM   Updated: 06/Feb/07 11:47 PM
Return to search
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.3

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File CommonsLangBug33965Test.java 2006-03-16 03:31 AM Cedric Veilleux 1 kB
Environment:
Operating System: Windows 2000
Platform: PC
Issue Links:
Duplicate
 

Bugzilla Id: 33965
Resolution Date: 19/Sep/06 09:43 PM


 Description  « Hide
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.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.