ok ok ok, now we know when this problem occurs: it only occurs when
nillable="true" is set, which of course can't work with a primitive
(how should jibx set a primitive to null?)! so this behaviour is
correct, but the error message is so confusing that it took quite a
while to get me there ;-)
maybe this should go into the docs that using nillable=true implies
that no primitives can be used in setter and getter.
br,
günther
Am 13.11.2007 um 17:51 schrieb Günther Wieser:
> hold on a second ;-) tried to reproduce this error in a unit test, but
> i can't get the same behaviour now...will check that and come back to
> the mailing list with either a solution or a more detailed test setup
> for reproducing this error.
>
> br,
> günther
>
> Am 13.11.2007 um 14:10 schrieb Günther 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=test;
>> }
>> }
>>
>> here's the binding (snippet):
>>
>> <mapping name="address" class="data.Address" abstract="true"
>> flexible="true"
>> ordered="false">
>> <value name="test" set-method="setJiBXTest"
>> get-method="getJiBXTest" usage="required"
>> nillable="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:
>> 551)
>> [bind] at
>> org
>> .jibx
>> .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:
>> 355)
>> [bind] at
>> org
>> .jibx
>> .binding.def.ObjectBinding.genMarshalContentCall(ObjectBinding.java:
>> 878)
>> [bind] at
>> org
>> .jibx.binding.def.ObjectBinding.genContentMarshal(ObjectBinding.java:
>> 948)
>> [bind] at
>> org
>> .jibx
>> .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:
>> 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:
>> 355)
>> [bind] at
>> org
>> .jibx
>> .binding.def.NestedStructure.genContentMarshal(NestedStructure.java:
>> 355)
>> [bind] at
>> org
>> .jibx
>> .binding.def.ObjectBinding.genMarshalContentCall(ObjectBinding.java:
>> 878)
>> [bind] at
>> org
>> .jibx.binding.def.ObjectBinding.genContentMarshal(ObjectBinding.java:
>> 948)
>> [bind] at
>> org
>> .jibx
>> .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:
>> 856)
>> [bind] at
>> org
>> .jibx
>> .binding.def.DefinitionContext.generateCode(DefinitionContext.java:
>> 669)
>> [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.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ünther
>> --
>> Günther Wieser
>> creative-it
>> Guglgasse 6/1/11/1
>> A-1110 Wien
>> [EMAIL PROTECTED]
>> 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
>> browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> jibx-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>
>
>
>
> --
> Günther Wieser
> creative-it
> Guglgasse 6/1/11/1
> A-1110 Wien
> [EMAIL PROTECTED]
> 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
> browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
--
Günther Wieser
creative-it
Guglgasse 6/1/11/1
A-1110 Wien
[EMAIL PROTECTED]
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 browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users