Hi Eugeny,

The enum mapping was failing the first time because jibx uses the 
Enum.valueOf(String) during unmarshalling.
This method is case sensitive. Not sure about the second error though.

Could you try round tripping using a plain enum?

public enum DiffTag {
    Replace, Insert, Delete, Equal;
}


I have used enums and have not run into any such problems.
I have come across one issue with enums when they are optional, but this 
was fixed in the 1.1.5 release.
http://jira.codehaus.org/browse/JIBX-157

regards
Varghese


Eugeny N Dzhurinsky wrote:
> On Mon, Jul 23, 2007 at 06:34:21PM +0300, Eugeny N Dzhurinsky wrote:
>   
>> Hello!
>>
>> I have an Enum class:
>>
>> /**
>>  * Holds tag enumeration
>>  */
>> public enum DiffTag {
>>
>>     Replace("replace"), Insert("insert"), Delete("delete"), Equal("equal");
>>     
>
> I changed this to
>
> Replace("Replace"), Insert("Insert"), Delete("Delete"), Equal("Equal");
>
>   
>>     private final String textForm;
>>
>>     DiffTag(String textForm) {
>>         this.textForm = textForm;
>>     }
>>
>>     /**
>>      * @see java.lang.Enum#toString()
>>      */
>>     @Override
>>     public String toString() {
>>         return textForm;
>>     }
>>
>> }
>>
>> and when I marshalling some document which has property of that enum class, 
>> it
>> is marshalled successfully, however when I trying to unmarshall the SAME
>> document which was marshalled before, I'm getting this exception:
>>
>> java.lang.IllegalArgumentException: No enum const class entity.DiffTag.equal
>>  at java.lang.Enum.valueOf(Enum.java:192)
>>  at DiffTag.valueOf(DiffTag.java:6)
>>     
>
> XML was changed to:
>
> <?xml version="1.0" encoding="utf-8"?>
> <diff_structure>
>     <diff_parts>
>         <diffpart tag="Equal" left_tag_start="0" left_tag_end="6" 
> right_tag_start="0" right_tag_end="6"/>
>         <diffpart tag="Replace" left_tag_start="7" left_tag_end="11" 
> right_tag_start="6" right_tag_end="17"/>
>         <diffpart tag="Equal" left_tag_start="12" left_tag_end="18" 
> right_tag_start="18" right_tag_end="24"/>
>         <diffpart tag="Replace" left_tag_start="19" left_tag_end="19" 
> right_tag_start="25" right_tag_end="27"/>
>         <diffpart tag="Equal" left_tag_start="20" left_tag_end="20" 
> right_tag_start="28" right_tag_end="28"/>
>         <diffpart tag="Replace" left_tag_start="21" left_tag_end="21" 
> right_tag_start="29" right_tag_end="29"/>
>         <diffpart tag="Equal" left_tag_start="22" left_tag_end="25" 
> right_tag_start="30" right_tag_end="33"/>
>     </diff_parts>
> </diff_structure>
>
> And now i'm getting different error:
>
> java.lang.IllegalAccessError
> at DiffPartStub.JiBX_DiffPartStub_binding_unmarshalAttr_2_0(DiffPartStub.java)
> at JiBX_DiffPartStub_bindingDiffPartStub_access.unmarshal()
> at 
> DiffStructureStub.JiBX_DiffStructureStub_binding_unmarshal_2_0(DiffStructureStub.java)
> at JiBX_DiffStructureStub_bindingDiffStructureStub_access.unmarshal()
> at 
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2538)
> at 
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2681)
>
> Hope that helps to understand the issue.
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to