DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5314>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5314

NPE when reading web.xml without DOCTYPE declaration

           Summary: NPE when reading web.xml without DOCTYPE declaration
           Product: Tomcat 3
           Version: 3.3 Final
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Config
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hi,

the following patch fixes an NPE in org.apache.tomcat.util.xml.XmlMapper
that occurs when an Exception is thrown outside of the root element.
This applies in particular, if the web.xml doesn't contain a DOCTYPE
declaration, because in that case an Exception is thrown for warning
purposes.

--- org\apache\tomcat\util\xml\XmlMapper.java.orig      Fri Dec  7 13:29:12 2001

+++ org\apache\tomcat\util\xml\XmlMapper.java   Fri Dec  7 13:29:58 2001
@@ -98,12 +98,14 @@
        sb.append("/");
        for( int i=0; i< sp ; i++ ) sb.append( tagStack[i] ).append( "/" );
        sb.append(" ");
+       if (sp > 0) {
        AttributeList attributes=(AttributeList) attributeStack[sp-1];
        if( attributes!=null)
            for (int i = 0; i < attributes.getLength (); i++) {
                sb.append(attributes.getName(i)).append( "=" ).append(attributes
.getValue(i));
                sb.append(" ");
            }
+       }

        return sb.toString();
     }

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to