[ 
http://jira.codehaus.org/browse/JIBX-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Sosnoski updated JIBX-263:
---------------------------------

             Assignee: Dennis Sosnoski
    Affects Version/s:     (was: JiBX 1.2)
                       JiBX 1.2 beta 1
        Fix Version/s: JiBX 1.2

> Codegen: Enumeration in imported schema can result in 
> IllegalArgumentException: No enum const class
> ---------------------------------------------------------------------------------------------------
>
>                 Key: JIBX-263
>                 URL: http://jira.codehaus.org/browse/JIBX-263
>             Project: JiBX
>          Issue Type: Bug
>          Components: core
>    Affects Versions: JiBX 1.2 beta 1
>            Reporter: Nigel Charman
>            Assignee: Dennis Sosnoski
>             Fix For: JiBX 1.2
>
>
> The problem occurs when a complex-type containing a string with an enum 
> restriction is imported from another schema.  It happens consistently in one 
> project, but I've been trying for most of the afternoon to reproduce it in a 
> simpler form and can't make it fail outside the original project.
> The project uses 4 schema. Schema C imports schema D.  Schema A imports both 
> schema C and D.  Schema B also imports both schema C and D.  Schema D contains
>    <xsd:simpleType name="version">
>        <xsd:restriction base="xsd:string">
>            <xsd:enumeration value="3.2"/>
>            <xsd:enumeration value="3.3"/>
>            <xsd:enumeration value="4.0"/>
>        </xsd:restriction>
>    </xsd:simpleType>
> The generated binding.xml includes the bindings in the "wrong" order:
>  <include path="binding D"/>
>  <include path="binding C"/>
>  <include path="binding B"/>
>  <include path="binding A"/>
> binding A contains:
>  <format type="Version" enum-value-method="value"/>
> bindings C and D contain:
>    <value style="attribute" name="Version" get-method="getVersion" 
> set-method="setVersion"/>
> However, since C and D are included before A in binding.xml, they do not seem 
> to know about the format of the Version enum. The resulting error is:
>     [java] Exception in thread "main" java.lang.IllegalArgumentException: No 
> enum const class xsd.simpletypes.Version.3.2
>     [java]     at java.lang.Enum.valueOf(Enum.java:196)
>     [java]     at xsd.simpletypes.Version.valueOf(Version.java:16)
>     [java]     at 
> xsd.svreq.MESSAGE.JiBX_binding_unmarshalAttr_1_0(MESSAGE.java)
>     [java]     at xsd.svreq.JiBX_bindingMESSAGE_access.unmarshal()
>     [java]     at 
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:2762)
>     [java]     at 
> org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:2905)
>     [java]     at Test.main(Test.java:25)
> I can work around the issue by either adding the <format type="Version" 
> enum-value-method="value"/> element to bindings C and D, or rearranging 
> binding.xml to have the bindings in the order A, B, C, D.  When I try to 
> reproduce the error in a simplified project, the code generator always seems 
> to create the binding.xml in the order A, B, C, D. 
> I can email you the project, but don't want to upload it publicly.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to