[Yanel-dev] Problem with XMLHelper.documentToString

Michael Wechner michael.wechner at wyona.com
Sun Dec 22 16:45:48 CET 2013


It seems that this can also be caused when one sets a text node to null,
e.g.

String text = null;
element.appendChild(doc.createTextNode(text))

(also see https://community.oracle.com/thread/1627122?start=0&tstart=0)

Thanks

Michael

Am 03.03.09 16:11, schrieb Michael Wechner:
> Michael Wechner schrieb:
>> Hi
>>
>> I receive the following error when using
>>
>> ERROR org.wyona.commons.xml.XMLHelper.documentToString():66  -
>> java.lang.NullPointerException
>> java.lang.NullPointerException
>>        at
>> org.apache.xml.serializer.TreeWalker.dispatachChars(TreeWalker.java:244)
>>        at
>> org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:414)
>>        at
>> org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:143)
>>        at
>> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:389)
>>
>>        at
>> org.wyona.commons.xml.XMLHelper.documentToString(XMLHelper.java:64)
>>
>> which is similar
>>
>> https://jira.jboss.org/jira/browse/JSFUNIT-70
>>
>> I have not observed this before. Is it possible that this because of
>> the recent XML lib changes?
>
> It seems that this method fails in case of empty nodes/tags, for
> example <my-tag/>
>
> Using the Apache XMLSerializer it works, but I am afraid that
> something else might break and also I actually
> do not want to introduce an explicit Apache XMLSerializer dependecy.
>
> WDYT?
>
> Thanks
>
> Michi
>>
>> Thanks
>>
>> Michi
>



More information about the Yanel-development mailing list