tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 5314] New: - NPE when reading web.xml without DOCTYPE declaration
Date Fri, 07 Dec 2001 13:42:04 GMT
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: tomcat-dev@jakarta.apache.org
        ReportedBy: jochen.wiedmann@softwareag.com


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:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message