Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JiBX 1.0.1
-
Fix Version/s: JiBX 1.0.2
-
Component/s: core
-
Labels:None
-
Environment:Windows XP
java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)
-
Number of attachments :
Description
I have posted the problem already on jibx-user, but there was no traffic wrt to this entry.
I am not sure whether JIBX-98 is the same problem. At list it looks a little bit different.
Starting last week with jibx I got to some strange problems
java.lang.IllegalStateException: Internal error: Expected jibxproblem.Inner on stack, found jibxproblem.Middle
(see stack below)
May be I made some simple beginners error, but I could reduce to two extremly simple nested structures
:
<binding>
<mapping name="Outer" class="jibxproblem.Outer" >
<structure name="Middle" type="jibxproblem.Middle" >
<structure name="Inner" type="jibxproblem.Inner" >
<value name="myInnerId" style="attribute" field="myInnerId" />
</structure>
</structure>
</mapping>
</binding>
Originally I started with a complex binding with nested collections with items factored into separate mappings
again with nested collections partly in base classes.
As I got first problems with the mappings I moved to structures and collections inside the root mapping.
manfred
btw: the attachment contains the correspondig example classes compilation is possible simply by javac *.java
-
-
- 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 ***
-
java.lang.IllegalStateException: Internal error: Expected jibxproblem.Inner on stack, found jibxproblem.Middle
full stack:
0: jibxproblem.Middle
1: org.jibx.runtime.impl.UnmarshallingContext
at org.jibx.binding.classes.MethodBuilder.verifyCompatible(MethodBuilder.java:393)
at org.jibx.binding.classes.MethodBuilder.verifyCallStack(MethodBuilder.java:510)
at org.jibx.binding.classes.MethodBuilder.appendCallVirtual(MethodBuilder.java:867)
at org.jibx.binding.def.ObjectBinding.genUnmarshalCall(ObjectBinding.java:568)
at org.jibx.binding.def.ObjectBinding.genUnmarshalAttributeCall(ObjectBinding.java:665)
at org.jibx.binding.def.ObjectBinding.genAttributeUnmarshal(ObjectBinding.java:922)
at org.jibx.binding.def.ComponentProperty.genAttributeUnmarshal(ComponentProperty.java:124)
at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:243)
at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:156)
at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:787)
at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:932)
at org.jibx.binding.def.ComponentProperty.genContentUnmarshal(ComponentProperty.java:245)
at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:267)
at org.jibx.binding.def.NestedCollection.genContentUnmarshal(NestedCollection.java:143)
at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:787)
at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:932)
at org.jibx.binding.def.ComponentProperty.genContentUnmarshal(ComponentProperty.java:245)
at org.jibx.binding.def.NestedStructure.genContentUnmarshal(NestedStructure.java:156)
at org.jibx.binding.def.ObjectBinding.genUnmarshalContentCall(ObjectBinding.java:787)
at org.jibx.binding.def.ObjectBinding.genContentUnmarshal(ObjectBinding.java:932)
at org.jibx.binding.def.ElementWrapper.genContentUnmarshal(ElementWrapper.java:267)
at org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:592)
at org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:602)
at org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:611)
at org.jibx.binding.Compile.compile(Compile.java:305)
at org.jibx.binding.Compile.main(Compile.java:385)
The problem occurs because Outer doesn't extend Middle and Middle doesn't extend Inner. If the classes were in this relationship this would be a valid binding; because they're not, the binding is invalid (it's saying to treat the Outer instance as a Middle instance within the first <structure>, then to treat it as an Inner instance within the second <structure> - that's what a <structure> with a type but no property means). I've added checks to the code to catch this type of binding error.