[ http://jira.codehaus.org/browse/JIBX-117?page=comments#action_68274 ] 

Joshua Davies commented on JIBX-117:
------------------------------------

The issue appears to be the inclusion of two back-to-back "ordered=false" 
structures inside another "ordered=false" structuer.  Tracing through the code, 
I beleive I've narrowed it down to line 305 of the file 
build/src/org/jibx/binding/def/NestedStructure.java, in function 
"genContentUnmarshal":

                mb.freeSlot(FLAG_ARRAY_SLOT);

This will be invoked early, when the second structure completes its binding, 
because of line 259 of the same function:

                    child.genContentUnmarshal(mb);

This will end up recursively calling itself, but it doesn't change the "mb" 
(ContextMethodBuilder) parameter (and it doesn't look like it's supposed to).  
When it completes (generating unmarshal for "element1"), it will execute line 
305 on the containing contextMethodBuilder, remove the FLAG_ARRAY_SLOT, and 
then the "for" loop that started on line 234 will continue on to try to 
generate unmarshal content for "element2", but will throw a null pointer 
exception when it no longer finds the "FLAG_ARRAY_SLOT".

I can see the issue, but I can't see how to resolve it; it seems like you'd 
want to put off freeing the FLAG_ARRAY_SLOT until after you had processed 
everything relative to the current ContextMethodBuilder, but I can't see any 
way to figure out that you're at the "top" of the stack.

> receive and error from the compiler when adding more elements (value or 
> structure) to my binding definition.
> ------------------------------------------------------------------------------------------------------------
>
>          Key: JIBX-117
>          URL: http://jira.codehaus.org/browse/JIBX-117
>      Project: JiBX
>         Type: Bug

>   Components: core
>     Versions: JiBX 1.1
>  Environment: Windows XP
>     Reporter: Seb boudreau

>
>
> in the following binding definition:
> <binding>
>     <mapping 
> name="ca.promutuel.transformation.copybook.sadg.PoliceHabitation" 
> class="ca.promutuel.transformation.copybook.PoliceHabitation" ordered="false" 
> flexible="true">
>         <value name="codeAssureurPrecedent" field="codeAssPrecedent" 
> usage="optional"/>
>         <value name="classeFiscale" field="classeFiscale" usage="optional"/>
>         <value name="etatCompteUnique" field="codeEtatCompte" 
> usage="optional"/>
>         <value name="nbrSinistresEnCours" field="nbSinistresEnCours" 
> usage="optional"/>
>         <value name="codeSuccursale" field="succursale" usage="optional"/>
>         <value name="typePolice" field="typePolice" usage="optional"/>
>         <value name="dateAnnulation" field="dateAnnulation" 
> usage="optional"/>   
>         <value name="causeAnnulation" field="causeAnnulation" 
> usage="optional"/>
>         <value name="statut" field="statut" usage="optional"/>
>         <value name="datePremiereAssurance" field="dateEntreeVigueur" 
> usage="optional"/>
>         <value name="dateEntreeSysteme" field="dateEntreeSysteme" 
> usage="optional"/>
>         <value name="ancienNoPolice" field="ancienNoPolice" usage="optional"/>
>         <value name="noPolice" field="noPolice" usage="optional"/>
>        
>         <structure name="terme" usage="optional" flexible="true" 
> ordered="false">
>             <value name="dateProduction" field="dateProductionImage" 
> usage="optional"/>
>             <value name="montantCommission" field="montantCommissionImage" 
> usage="optional"/>
>             <value name="tauxCommission" field="tauxCommissionImage" 
> usage="optional"/>
>             <value name="typeRabais" field="typeRabais" usage="optional"/>
>             <value name="montantRabais" field="montantRabais" 
> usage="optional"/>
>             <value name="tauxRabais" field="tauxRabais" usage="optional"/>
>             <value name="montantDejaPercu" field="montantDejaPercu" 
> usage="optional"/>
>             <value name="totalPrimesSouscrites" 
> field="primeSouscriteCumulative" usage="optional"/>
>             <value name="primeSouscrite" field="primeSouscriteImage" 
> usage="optional"/>
>             <value name="dateEcheance" field="dateExpirationTerme" 
> usage="optional"/>
>             <value name="dateEffective" field="dateEffectiveTransaction" 
> usage="optional"/>
>             <value name="dateEntreeVigueur" field="dateEntreeVigueurTerme" 
> usage="optional"/>
>             <value name="noImage" field="noImage" usage="optional"/>
>             <value name="noTerme" field="noTerme" usage="optional"/>
>             <value name="noFlotte" field="noFlotte" usage="optional"/>   
>                    
>             <structure name="repres" usage="optional" ordered="false" 
> flexible="true">
>                 <!-- Can add value element here-->   
>                 <value name="noRepresentant" field="noRepresentantImage" 
> usage="optional"/>
>                 <!-- Can't add any value element here-->   
>             </structure>
>            
>             <!-- Unable to add any structure or value element here-->
>         </structure>
>     </mapping>
> </binding>,
> it is impossible to add any element after the last value element.  However, 
> it is possible to add a value element between two existing element, but the 
> same is not true for a structure element: it cannot be added anywhere in the 
> binding definition.
> The error I receive from the compiler is: 
> bind:
>      [echo] Running JiBX binding compiler
>      [bind] Error running binding compiler
>      [bind] *** Error during code generation - please enter a bug report for 
> this error in Jira if the problem is not listed as fixed on the online status 
> page ***
>      [bind] java.lang.ArrayIndexOutOfBoundsException: -1
>      [bind] at java.util.ArrayList.get(Unknown Source)
>      [bind] at 
> org.jibx.binding.classes.MethodBuilder.appendLoadLocal(MethodBuilder.java:1094)
>      [bind] at 
> org.jibx.binding.def.NestedStructure.genFlagTest(NestedStructure.java:327)
>      [bind] at 
> org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:244)
>      [bind] at 
> org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:795)
>      [bind] at 
> org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:940)
>      [bind] at 
> org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:315)
>      [bind] at 
> org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:582)
>      [bind] at 
> org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:603)
>      [bind] at 
> org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:661)
>      [bind] at org.jibx.binding.Compile.compile(Compile.java:305)
>      [bind] at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
>      [bind] at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>      [bind] at org.apache.tools.ant.Task.perform(Task.java:364)
>      [bind] at org.apache.tools.ant.Target.execute(Target.java:341)
>      [bind] at org.apache.tools.ant.Target.performTasks(Target.java:369)
>      [bind] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
>      [bind] at 
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
>      [bind] at 
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
> BUILD FAILED: C:\Documents and Settings\Sebastien\My 
> Documents\workspaces\esb\esb\src\build.xml:76: JiBXException in JiBX binding 
> compilation
> Total time: 1 second
> If you need more information or if this error is due to a bad use or 
> understanding of JiBX, please let me know.

-- 
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


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to