Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355546

Summary: NPE using servlet bridge on Weblogic Server
Product: [Eclipse Project] Equinox Reporter: Arnaud MERGEY <a_mergey>
Component: Server-SideAssignee: Simon Kaegi <simon_kaegi>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: simon_kaegi, tjwatson
Version: 3.7Keywords: contributed
Target Milestone: Juno M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
proposed patch allowing to fix the issue simon_kaegi: iplog+

Description Arnaud MERGEY CLA 2011-08-23 13:55:55 EDT
Deploying an OSGI application packaged as a legacy WAR using equinox servlet bridge, above NPE occurs by requesting following
http://myServer:7001/myApp

It works perfectly with http://myServer:7001/myApp/ (notice the last '/')

Debugging the code, I noticed following in 

org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(HttpServletRequest, HttpServletResponse)

		String alias = HttpServletRequestAdaptor.getDispatchPathInfo(req);
		if (alias == null)
			alias = "/"; //$NON-NLS-1$
			
So there should probably be similar code here:
org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(HttpServletRequest, HttpServletResponse, String, String)

String dispatchPathInfo = HttpServletRequestAdaptor.getDispatchPathInfo(req);
if (dispatchPathInfo == null)
			dispatchPathInfo = "/"; //$NON-NLS-1$

The exception is:
java.lang.NullPointerException
	at org.eclipse.equinox.http.servlet.internal.FilterRegistration.matches(FilterRegistration.java:96)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:114)
	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:120)
Comment 1 Arnaud MERGEY CLA 2011-08-23 13:56:54 EDT
Created attachment 202023 [details]
proposed patch allowing to fix the issue
Comment 2 Simon Kaegi CLA 2011-08-25 00:54:24 EDT
Good catch. We always want to match on "/". Your patch is fine but we might want the logic in filter registration or else change some variable names or both.
Comment 3 Simon Kaegi CLA 2011-08-29 09:25:28 EDT
Fixed in HEAD.

I've played around with this but in the end I think your patch is the simplest fix. Thanks Arnaud.
Comment 4 Thomas Watson CLA 2011-08-29 11:47:10 EDT
(In reply to comment #3)
> Fixed in HEAD.

Of coarse Simon mean master in git ;-) and used the following commit:

http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/commit/?id=d7f324c4f04586b3e1a32284a9dc0923fd8c5103


I also update the version of the bundle with the following commit:

http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/commit/?id=b097c3ae07571f990b7f8ee4d179d418c828b174