From: <gw...@cr...> - 2007-11-13 16:51:48
|
hold on a second ;-) tried to reproduce this error in a unit test, but =20= i can't get the same behaviour now...will check that and come back to =20= the mailing list with either a solution or a more detailed test setup =20= for reproducing this error. br, g=FCnther Am 13.11.2007 um 14:10 schrieb G=FCnther Wieser: > hi, > > using jibx 1.1.5, we found a problem with using getters and setters > and primitive types. > > here's an example class: > > public class Address { > > private int test; > > private int getJiBXTest() { > return this.test; > } > > private void setJiBXTest(int test) { > this.test=3Dtest; > } > } > > here's the binding (snippet): > > <mapping name=3D"address" class=3D"data.Address" abstract=3D"true"= > flexible=3D"true" > ordered=3D"false"> > <value name=3D"test" set-method=3D"setJiBXTest" > get-method=3D"getJiBXTest" usage=3D"required" = nillable=3D"true" /> > </mapping> > > when compiling this, i get the following output: > > [bind] object binding for data.Address create class data.Address > [bind] structure unordered, flexible > [bind] element id from property from getJiXBId to setJiXBId > (java.lang.Long) > [bind] element street from property from getJiXBStreet to > setJiXBStreet (java.lang.String) > [bind] element city from property from getJiXBCity to setJiXBCity > (java.lang.String) > [bind] element yn from property from getJiBXYn to setJiBXYn > (boolean) > [bind] element test from property from getJiBXTest to setJiBXTest > (int) > [bind] Generating code for mapping data.Customer > [bind] Error running binding compiler > [bind] *** Error during code generation for file 'C:/JavaDev322/ > JiXB Test/src/customer_binding.xml' - 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.IllegalStateException: Internal error: Expected > object reference on stack , found boolean > [bind] full stack: > [bind] 0: org.jibx.runtime.impl.MarshallingContext > [bind] 1: boolean > [bind] at > org > .jibx > .binding.classes.MethodBuilder.verifyStackObject(MethodBuilder.java:=20= > 551) > [bind] at > org > .jibx=20 > .binding.classes.MethodBuilder.appendIFNONNULL(MethodBuilder.java: > 620) > [bind] at > org.jibx.binding.def.ValueChild.genMarshal(ValueChild.java:622) > [bind] at > org.jibx.binding.def.ValueChild.genContentMarshal(ValueChild.java:818) > [bind] at > org > .jibx > .binding.def.NestedStructure.genContentMarshal(NestedStructure.java:=20= > 355) > [bind] at > org > .jibx > .binding.def.ObjectBinding.genMarshalContentCall(ObjectBinding.java:=20= > 878) > [bind] at > org > .jibx.binding.def.ObjectBinding.genContentMarshal(ObjectBinding.java: > 948) > [bind] at > org > .jibx=20 > .binding.def.ElementWrapper.genContentMarshal(ElementWrapper.java: > 464) > [bind] at > org > .jibx > .binding > .def.ComponentProperty.genContentMarshal(ComponentProperty.java:318) > [bind] at > org > .jibx > .binding > .def.PassThroughComponent.genContentMarshal(PassThroughComponent.java: > 116) > [bind] at > org > .jibx > .binding.def.NestedCollection.genContentMarshal(NestedCollection.java: > 269) > [bind] at > org > .jibx > .binding.def.ObjectBinding.genMarshalContentCall(ObjectBinding.java:=20= > 878) > [bind] at > org > .jibx.binding.def.ObjectBinding.genContentMarshal(ObjectBinding.java: > 948) > [bind] at > org > .jibx > .binding > .def.ComponentProperty.genContentMarshal(ComponentProperty.java:318) > [bind] at > org > .jibx > .binding.def.NestedStructure.genContentMarshal(NestedStructure.java:=20= > 355) > [bind] at > org > .jibx > .binding.def.NestedStructure.genContentMarshal(NestedStructure.java:=20= > 355) > [bind] at > org > .jibx > .binding.def.ObjectBinding.genMarshalContentCall(ObjectBinding.java:=20= > 878) > [bind] at > org > .jibx.binding.def.ObjectBinding.genContentMarshal(ObjectBinding.java: > 948) > [bind] at > org > .jibx=20 > .binding.def.ElementWrapper.genContentMarshal(ElementWrapper.java: > 464) > [bind] at > org > .jibx > .binding > .def > .MappingDefinition > .generateMarshalImplementation(MappingDefinition.java:797) > [bind] at > org > .jibx > .binding.def.MappingDefinition.generateCode(MappingDefinition.java:=20 > 856) > [bind] at > org > .jibx > .binding.def.DefinitionContext.generateCode(DefinitionContext.java:=20 > 669) > [bind] at > org > .jibx > .binding.def.BindingDefinition.generateCode(BindingDefinition.java:=20 > 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:=20 > 369) > [bind] at > org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) > [bind] at org.apache.tools.ant.Project.executeTarget(Project.java: > 1185) > [bind] at > org > .apache > .tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java: > 40) > [bind] at > org > .eclipse > .ant > .internal > .ui > .antsupport > .EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) > [bind] at > org.apache.tools.ant.Project.executeTargets(Project.java:1068) > [bind] at > org > .eclipse > .ant > .internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java: > 423) > [bind] at > org > .eclipse > .ant > .internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java: > 137) > > > when i change the type of the getter/setter parameter/return value to > Integer instead of int, everything works fine. so from the error > message and from the workaround, i think jibx expects no primitives. > if this is the case and this is something that cannot be changed, it > should be stated in the documentation. > > you may ask why we need setter and getter for an int value? well, of > course we don't store the value in an int like in this example, we > store it in a (very weird) data class that takes a primitive in its > set method. so changing to field access won't help, because even a > self-written serializer/deserializer won't help (accessing these data > classes is very weird!). > > br, > g=FCnther > --=20 > G=FCnther Wieser > creative-it > Guglgasse 6/1/11/1 > A-1110 Wien > gw...@cr... > http://www.creative-it.com > > > > > = ------------------------------------------------------------------------- > 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 =20 > browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > jibx-users mailing list > jib...@li... > https://lists.sourceforge.net/lists/listinfo/jibx-users > --=20 G=FCnther Wieser creative-it Guglgasse 6/1/11/1 A-1110 Wien gw...@cr... http://www.creative-it.com |