Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Java-SCA-1.6
-
None
-
None
Description
With a malformed POST request to a binding.atom service a NPE is thrown as follows:
devmac:~ jacek$ curl -s -X POST -H "Content-type: application/atom+xml; type=entry" --data @ranek.xml http://devmac.local:8080/slownik/pl-de/
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 INTERNAL_SERVER_ERROR</title>
</head>
<body><h2>HTTP ERROR: 500</h2><pre>INTERNAL_SERVER_ERROR</pre>
<p>RequestURI=/slownik/pl-de/</p><h3>Caused by:</h3><pre>java.lang.NullPointerException
at org.apache.tuscany.sca.binding.atom.provider.AtomBindingListenerServlet.doPost(AtomBindingListenerServlet.java:590)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.apache.tuscany.sca.core.work.Work.run(Work.java:63)
at org.apache.tuscany.sca.core.work.ThreadPoolWorkManager$DecoratingWork.run(ThreadPoolWorkManager.java:215)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
it is because AtomBindingUtil.entry is allowed to return null which is not checked by the AtomBindingListenerServlet when getting the values out of it.
The "fix" is to fix the POST request (hence the quotes)