Bug 51095 - NPE in AprEndpoint.java
Summary: NPE in AprEndpoint.java
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-20 12:51 UTC by Mike Glazer
Modified: 2011-04-23 17:58 UTC (History)
0 users



Attachments
Patch to AprEndpoint.java (540 bytes, application/octet-stream)
2011-04-20 12:51 UTC, Mike Glazer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Glazer 2011-04-20 12:51:05 UTC
Created attachment 26917 [details]
Patch to AprEndpoint.java

OVERVIEW:

In all of the most recent versions of Tomcat 7, including Trunk. When running with APR SSL and the site is accessed using an improper SSL handshake, then a SEVERE NullPointerException will is logged into catalina.out.


STEPS TO REPRODUCE:

It's pretty easy to test this, just type the following:


curl http://localhost:8444/

Where 8444 is the port that SSL is running on for Tomcat 7. 

ACTUAL RESULTS:

If you look in the catalina.out when you do this, you'll see the following stack trace and error message:

Apr 20, 2011 1:55:32 AM org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler process
SEVERE: Error reading request, ignored
java.lang.NullPointerException
	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:208)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
	at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1670)
	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:662)
Exception in thread ""http-apr-8444"-exec-2727" java.lang.NullPointerException
	at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1673)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)



EXPECTED RESULTS:

The expected behavior is for Tomcat to not generate a NullPointerException when someone improperly accesses the SSL port.

BUILD INFO:

Taken from the latest subversion trunk, 1095243.

I've attached a patch that fixes this.
Comment 1 Mark Thomas 2011-04-23 17:58:31 UTC
Many thanks for the report and the patch.

This has been fixed in 7.0.x and will be included in 7.0.13 onwards.