Title: NullPointerException in SAXWriter
Thanks for your patch.  I will get the latest file from CVS.
 
Another question came in my mind regarding the null strings. 
Wouldn't it be better if we make a check before adding to the doucment instead of checking null in the Writers?
 
Thanks.
----- Original Message -----
To: Kesav Kumar ;    
Sent: Wednesday, September 12, 2001 8:55 PM
Subject: Re: [dom4j-user] NullPointerException in SAXWriter

Hi Kesav
 
I shouldn've read this message before reading the previous one ;-)
 
I've just patched the SAXWriter to be a bit more lenient and quitely ignore null Strings in a dom4j document.

James
----- Original Message -----
Sent: Thursday, September 13, 2001 1:34 AM
Subject: [dom4j-user] NullPointerException in SAXWriter

I found one strange difference between SAXWriter and XMLWriter.

In XMLWriter when ever a text content to be written the text is checked for null condition.

XMLWriter LineNumber 777

    protected void writeString(String text) throws IOException {
        if ( text != null && text.length() > 0 ) {

Where in SAXWriter if the text node doesn't have content which is null, there is no null check for this.  Which is leading to NullPointerException whenever the text node has null content.

SAXWriter LineNumber 411.
            else if ( object instanceof CharacterData ) {
                if ( object instanceof Text ) {
                    Text text = (Text) object;
                    write( text.getText() );
                }
Is in't the text.getText() should be checked for null?

Any ideas???

Kesav Kumar Kolla
Voquette Inc
650 356 3740(W)
510 889 6840(R)
Voquette....Delivering Sound Information


Reply via email to