Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322575 - NPE in HotSwapHandler if changing handler when started and no old handler set
Summary: NPE in HotSwapHandler if changing handler when started and no old handler set
Status: CLOSED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 7.1.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 7.1.x   Edit
Assignee: Jesse McConnell CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-12 15:06 EDT by Gunnar Wagenknecht CLA
Modified: 2010-08-16 12:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2010-08-12 15:06:38 EDT
java.lang.NullPointerException
	at org.eclipse.jetty.server.handler.HotSwapHandler.setHandler(HotSwapHandler.java:84)
	at org.eclipse.gyrex.http.jetty.internal.app.UrlToApplicationHandler$ApplicationDelegator.handle(UrlToApplicationHandler.java:53)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:932)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:870)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:214)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
	at org.eclipse.jetty.server.Server.handle(Server.java:333)
	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:595)
	at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1038)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
	at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:424)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:489)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
	at java.lang.Thread.run(Thread.java:619)


old_handler maybe null in that case if not set before but already started. Workaround is to set a handler first before starting.
Comment 1 Jesse McConnell CLA 2010-08-16 12:02:25 EDT
> svn commit -m "Bug 322575 resolve potential NPE in hot swap handler if old handler was null.  added a null check since existing doStart and doStop methods specifically handle cases where wrapped handler is null on start/stop" 

VERSION.txt 
jetty-server/src/main/java/org/eclipse/jetty/server/handler/HotSwapHandler.java

Committed revision 2216.
Comment 2 Gunnar Wagenknecht CLA 2010-08-16 12:08:14 EDT
Sweet. That was fast. :)