You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by eurotrans-Verlag <ve...@t-online.de> on 2011/02/04 02:21:45 UTC
NPE instead of '400 Bad Request' response when sending invalid request on Tomcat 7.0.7
Hi all,
I noticed that when sending an invalid request to Tomcat 7.0.7 (e.g. without
a HTTP method), Tomcat throws a NullPointerException, instead of responding
with a "400 Bad Request".
If you do a request like this for example:
/invalidRequest HTTP/1.1
Host: localhost
Then Tomcat prints:
04.02.2011 02:16:44 org.apache.catalina.connector.CoyoteAdapter service
SCHWERWIEGEND: An exception or error occurred in the container during the
request processing
java.lang.NullPointerException
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http
11Protocol.java:188)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http
11Protocol.java:166)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:
288)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
and closes the connection without sending a response.
Shouldn't Tomcat respond with "400 Bad Request" instead of throwing a NPE?
;)
(I don't think this is a big issue, just wanted to note that behavior.)
Cheers
Konstantin Preißer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: NPE instead of '400 Bad Request' response when sending invalid
request on Tomcat 7.0.7
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Konstantin,
On 2/3/2011 8:21 PM, eurotrans-Verlag wrote:
> I noticed that when sending an invalid request to Tomcat 7.0.7 (e.g. without
> a HTTP method), Tomcat throws a NullPointerException, instead of responding
> with a "400 Bad Request".
>
> If you do a request like this for example:
>
> /invalidRequest HTTP/1.1
> Host: localhost
>
> Then Tomcat prints:
>
> 04.02.2011 02:16:44 org.apache.catalina.connector.CoyoteAdapter service
> SCHWERWIEGEND: An exception or error occurred in the container during the
> request processing
> java.lang.NullPointerException
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
[snip]
> and closes the connection without sending a response.
>
> Shouldn't Tomcat respond with "400 Bad Request" instead of throwing a NPE?
> ;)
> (I don't think this is a big issue, just wanted to note that behavior.)
Looks like a bug to me: please file this in Bugzilla. Testing against
Tomcat 6.0.x and mentioning the results would also be helpful.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk1MPbQACgkQ9CaO5/Lv0PCYMQCfXID646/5tzSkAjAJQWXhGot/
aUgAoJXIw5zbLQgHMMPWAtUixr+f25dv
=3gur
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org