You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Ryo Neyama <ne...@trl.ibm.co.jp> on 2000/10/24 08:56:36 UTC

Bug patch: NullPointerException in MessageRouterServlet

I found a bug in org.apache.soap.server.http.MessageRouterServlet.

A NullPointerException is thrown when I try to run
"samples.messaging.SendMessage," before deploying the service.

Although this is apparently mis-usage, MessageRouterServlet should be
able to handle such an error.

I hope this bug fix is committed to the CVS registry and the bug fix
to QName and AttributeHandler, which I posted some days ago (but there
was no comment and nobody committed it) is also committed. I attached
the both bug fixes at the bottom of this mail.

I'm sure the other committers are busy to do something else as Chris
said yesterday. So I'm also hoping I can just get a login and commit
the bug fix myself. If someone in committee commit it, that would be
OK.

Thanks in advance.

    Ryo Neyama @ IBM Research, Tokyo Research Laboratory
    Internet Technology
    neyama@trl.ibm.co.jp

The stack trace is as follows:
--------------
Context log: path="/soap" Error in messagerouter service() : null
 java.lang.NullPointerException
	at org.apache.soap.server.http.MessageRouterServlet.doPost(MessageRouterServlet.java:157)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:597)
	at org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
	at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
	at java.lang.Thread.run(Thread.java:498)
Context log: path="/soap" <b>Internal Servlet Error:</b><br>
<pre>
java.lang.NullPointerException
	at org.apache.soap.server.http.MessageRouterServlet.doPost(MessageRouterServlet.java:157)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:597)
	at org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:160)
	at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
	at java.lang.Thread.run(Thread.java:498)
</pre>
--------------

Bug patch is as follows:
--------------
Index: java/src/org/apache/soap/server/http/MessageRouterServlet.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/server/http/MessageRouterServlet.java,v
retrieving revision 1.3
diff -r1.3 MessageRouterServlet.java
157c157,158
<       dd.buildFaultRouter().notifyListeners(fault, e);
---
>       if (dd != null)
>           dd.buildFaultRouter().notifyListeners(fault, e);
Index: src/org/apache/soap/AttributeHandler.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/AttributeHandler.java,v
retrieving revision 1.3
diff -r1.3 AttributeHandler.java
131a132
>     if ("" == namespaceURI) return null ;
157c158,159
<       nsStack.addNSDeclaration(namespacePrefix, namespaceURI);
---
>       if (namespacePrefix != null)
>         nsStack.addNSDeclaration(namespacePrefix, namespaceURI);
211,212c213,217
<       sink.write(' ' + getPrefixFromURI(attrQName.getNamespaceURI()) +
<                  ':' + attrQName.getLocalPart() + "=\"" +
---
>       sink.write(' ') ;
>       String nsPrefix ;
>       if ((nsPrefix = getPrefixFromURI(attrQName.getNamespaceURI())) != null)
>         sink.write(nsPrefix + ':') ;
>       sink.write(attrQName.getLocalPart() + "=\"" +
Index: src/org/apache/soap/util/xml/QName.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/util/xml/QName.java,v
retrieving revision 1.4
diff -r1.4 QName.java
108c108
<     this.namespaceURI = namespaceURI.intern();
---
>     this.namespaceURI = (namespaceURI == null ? "" : namespaceURI).intern();