[
http://jira.codehaus.org/browse/JIBX-232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nigel Charman updated JIBX-232:
-------------------------------
Attachment: jibx-232-patch.txt
Patch attached
> NPE in DomMapperBase using DOM Element with no namespace
> --------------------------------------------------------
>
> Key: JIBX-232
> URL: http://jira.codehaus.org/browse/JIBX-232
> Project: JiBX
> Issue Type: Bug
> Components: core
> Affects Versions: JiBX 1.1.6
> Reporter: Nigel Charman
> Attachments: DomNoNSTest.java, jibx-232-patch.txt
>
>
> Marshalling a DOM element with org.jibx.extras.DomElementMapper caused:
> [junit] java.lang.NullPointerException
> [junit] at
> org.jibx.runtime.impl.UTF8StreamWriter.writeMarkup(UTF8StreamWriter.java:96)
> [junit] at
> org.jibx.runtime.impl.XMLWriterBase.startTagOpen(XMLWriterBase.java:196)
> [junit] at
> org.jibx.extras.DomMapperBase.marshalElement(DomMapperBase.java:236)
> [junit] at
> org.jibx.extras.DomElementMapper.marshal(DomElementMapper.java:129)
> The DOM document was created with no namespaces.
> The supplied test case fails with null element and attribute names rather
> than a NPE, but is the same problem. The test case uses the existing classes
> and bindings from the extras test package.
> A patch based on the JIBX1_1_6 branch follows:
> ### Eclipse Workspace Patch 1.0
> #P jibx_extras_116
> Index: org/jibx/extras/DomMapperBase.java
> ===================================================================
> RCS file: /cvsroot/jibx/core/build/extras/org/jibx/extras/DomMapperBase.java,v
> retrieving revision 1.3
> diff -u -r1.3 DomMapperBase.java
> --- org/jibx/extras/DomMapperBase.java 21 May 2006 20:53:53 -0000
> 1.3
> +++ org/jibx/extras/DomMapperBase.java 28 Aug 2008 07:03:27 -0000
> @@ -233,7 +233,7 @@
> // check for namespace declarations required
> String[] uris = null;
> if (nss == null) {
> - m_xmlWriter.startTagOpen(nsi, element.getLocalName());
> + m_xmlWriter.startTagOpen(nsi, element.getLocalName() != null ?
> element.getLocalName() : element.getNodeName());
> } else {
> int base = getNextNamespaceIndex();
> if (defind >= 0) {
> @@ -273,8 +273,8 @@
> if (apref != null) {
> index = findNamespaceIndex(apref,
> attr.getNamespaceURI());
> }
> - m_xmlWriter.addAttribute(index, attr.getLocalName(),
> - attr.getValue());
> + m_xmlWriter.addAttribute(index, attr.getLocalName() != null
> ? attr.getLocalName() : attr.getNodeName(),
> + attr.getValue());
> }
> }
>
> @@ -284,7 +284,7 @@
> if (size > 0) {
> m_xmlWriter.closeStartTag();
> marshalContent(element.getChildNodes());
> - m_xmlWriter.endTag(nsi, element.getLocalName());
> + m_xmlWriter.endTag(nsi, element.getLocalName() != null ?
> element.getLocalName() : element.getNodeName());
> } else {
> m_xmlWriter.closeEmptyTag();
> }
--
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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs