Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JiBX 1.1.6
-
Fix Version/s: JiBX 1.2.1
-
Component/s: core
-
Labels:None
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
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 {
{ index = findNamespaceIndex(apref, attr.getNamespaceURI()); }
int base = getNextNamespaceIndex();
if (defind >= 0) {
@@ -273,8 +273,8 @@
if (apref != null)
- Eclipse Workspace Patch 1.0
-
- 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)
else
{ m_xmlWriter.closeEmptyTag(); }Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | jibx-232-patch.txt [ 36729 ] |
| Assignee | Dennis Sosnoski [ dsosnoski ] |
| Fix Version/s | JiBX 1.2.1 [ 15067 ] | |
| Resolution | Fixed [ 1 ] | |
| Status | Open [ 1 ] | Closed [ 6 ] |
Patch attached