Details
Description
The following (simplified) bindings file is causing an "Internal error":
<binding>
<mapping name="top" class="Top">
<structure name="level2" ordered="false">
<collection item-type="Level3" set-method="setLevel3" get-method="getLevel3" usage="optional" />
</structure>
</mapping>
<mapping name="level3" class="Level3" value-style="attribute">
<value name="name" field="name" />
</mapping>
</binding>
The error disappears if the "collection" element is removed, or if the "ordered='false'" clause is remove from the structure. Although it's obviously meaningless to set "ordered='false'" for a single-element structure, it took us quite a while to track this issue down, since the error message is misleading.
Here's the full stack trace we get:
java.lang.IllegalStateException: Internal error - content not ordered
at org.jibx.binding.def.NestedBase.genContentPresentTest(NestedBase.java:174)
at org.jibx.binding.def.PassThroughComponent.genContentPresentTest(PassT
hroughComponent.java:106)
at org.jibx.binding.def.PassThroughComponent.genContentPresentTest(PassT
hroughComponent.java:106)
at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:166)
at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:272)
at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:150)
at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:611)
at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:723)
at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:272)
at org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:498)
at org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:600)
at org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:555)
at org.jibx.binding.Compile.compile(Compile.java:299)
at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:238)
at org.apache.tools.ant.Task.perform(Task.java:319)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
at org.apache.tools.ant.Main.runBuild(Main.java:610)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)