Binding compile of two classes with same element name fails with NPE in
NameAttributes.equals although output only
------------------------------------------------------------------------------------------------------------------
Key: JIBX-169
URL: http://jira.codehaus.org/browse/JIBX-169
Project: JiBX
Issue Type: Bug
Components: core
Affects Versions: JiBX 1.1.5
Environment: Windows XP, Java 1.5.0_10
Reporter: Andrew Harris
Attachments: outboundBindIssue.zip
Just tried upgrading to JIBX 1.1.5 from 1.0.1 and hit this problem.
I have a binding that is direction="output" and I have three hibernate classes
that map to the same element name.
When I try to bind compile, there is an exception thrown because the equals
method in NameAttributes, when the name is the same, resorts to the namespace
to distinguish the two objects, but the namespace has not been set on either of
them.
[java] Error running binding compiler
[java] java.lang.NullPointerException
[java] at
org.jibx.binding.model.NameAttributes.equals(NameAttributes.java:184)
[java] at java.util.HashMap.eq(HashMap.java:299)
[java] at java.util.HashMap.containsKey(HashMap.java:381)
[java] at
org.jibx.binding.model.DefinitionContext.addMappedName(DefinitionContext.java:551)
[java] at
org.jibx.binding.model.RegistrationVisitor.visit(RegistrationVisitor.java:183)
[java] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:171)
[java] at
org.jibx.binding.model.TreeContext.tourTree(TreeContext.java:232)
[java] at
org.jibx.binding.model.RegistrationVisitor.visitTree(RegistrationVisitor.java:96)
[java] at
org.jibx.binding.model.BindingElement.runValidation(BindingElement.java:755)
[java] at
org.jibx.binding.model.BindingElement.validateBinding(BindingElement.java:819)
[java] at org.jibx.binding.Utility.validateBinding(Utility.java:228)
[java] at org.jibx.binding.Utility.loadBinding(Utility.java:269)
[java] at org.jibx.binding.Utility.loadFileBinding(Utility.java:413)
[java] at org.jibx.binding.Compile.compile(Compile.java:296)
[java] at org.jibx.binding.Compile.main(Compile.java:385)
I understand that it is not possible to unmarshal an incoming element to one of
multiple classes, since there is not enough information to figure out which
class to instantiate. But it would be useful to be able to marshal multiple
classes to the same element name.
The attached code has a target outputIssue that causes the exception
--
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
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs