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

Bug 343474

Summary: [org.eclipse.core.internal.runtime] Potential NPE in Activator#getURLConverter()
Product: [Eclipse Project] Platform Reporter: Karsten Thoms <karsten.thoms>
Component: User AssistanceAssignee: platform-ua-inbox <platform-ua-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: minor    
Priority: P3 CC: cgold, daniel_megert, tjwatson
Version: 3.6.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Screenshot: Debugger
none
Screenshot: Debugger
none
Screenshot: Debugger none

Description Karsten Thoms CLA 2011-04-21 00:35:37 EDT
Created attachment 193774 [details]
Screenshot: Debugger

Just invoked Eclipse Help and stopped with a NPE in this method. If the passed url is null the method should return null. However, the problem arised also before in FileLocator#resolve(URL), but there it would handle the null pointer properly if the Activator returns it.

Maybe attached screenshots from the debugger help to locate the original cause.

Thread [438284608@qtp-340964251-6 - /help/topic/org.eclipse.help.base/doc/help_home.html] (Suspended (exception NullPointerException))	
	Activator.getURLConverter(URL) line: 313	
	FileLocator.resolve(URL) line: 227	
	ResourceLocator.getErrorPath(String, String, String) line: 483	
	TocFileProvider.getTocContributions(String) line: 60	
	TocManager.getAndCacheTocContributions(String, Map) line: 210	
	TocManager.getTocContributionsForToc(String) line: 199	
	TocManager.getRootTocContributions(String, Set) line: 306	
	TocManager.getTocs(String) line: 68	
	TocManager.getTopic(String, String) line: 123	
	TocManager.getTopicPath(String, String) line: 138	
	UrlUtil.getTopicPath(String, String) line: 190	
	BreadcrumbsFilter.filter(HttpServletRequest, OutputStream) line: 75	
	EclipseConnector.transfer(HttpServletRequest, HttpServletResponse) line: 185	
	ContentServlet.doGet(HttpServletRequest, HttpServletResponse) line: 45	
	ContentServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 707	
	ContentServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 820	
	ServletManager$ServletWrapper.service(ServletRequest, ServletResponse) line: 180	
	ServletRegistration.service(HttpServletRequest, HttpServletResponse) line: 61	
	HttpServiceServlet(ProxyServlet).processAlias(HttpServletRequest, HttpServletResponse, String, String) line: 126	
	HttpServiceServlet(ProxyServlet).service(HttpServletRequest, HttpServletResponse) line: 68	
	HttpServiceServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 820	
	HttpServerManager$InternalHttpServiceServlet.service(ServletRequest, ServletResponse) line: 318	
	ServletHolder.handle(ServletRequest, ServletResponse) line: 511	
	ServletHandler.handle(String, HttpServletRequest, HttpServletResponse, int) line: 390	
	SessionHandler.handle(String, HttpServletRequest, HttpServletResponse, int) line: 182	
	Context(ContextHandler).handle(String, HttpServletRequest, HttpServletResponse, int) line: 765	
	Server(HandlerWrapper).handle(String, HttpServletRequest, HttpServletResponse, int) line: 152	
	Server.handle(HttpConnection) line: 322	
	HttpConnection.handleRequest() line: 542	
	HttpConnection$RequestHandler.headerComplete() line: 924	
	HttpParser.parseNext() line: 549	
	HttpParser.parseAvailable() line: 212	
	HttpConnection.handle() line: 404	
	SelectChannelConnector$ConnectorEndPoint(SelectChannelEndPoint).run() line: 409	
	QueuedThreadPool$PoolThread.run() line: 582
Comment 1 Karsten Thoms CLA 2011-04-21 00:36:06 EDT
Created attachment 193775 [details]
Screenshot: Debugger
Comment 2 Karsten Thoms CLA 2011-04-21 00:36:30 EDT
Created attachment 193776 [details]
Screenshot: Debugger
Comment 3 Thomas Watson CLA 2011-04-21 08:34:37 EDT
Moving to user assistance for comment or close.

org.eclipse.help.internal.util.ResourceLocator.getErrorPath(String, String, String) may call org.eclipse.core.runtime.FileLocator.resolve(URL) with a null URL.  The javadoc for FileLocator.resolve does not indicate that null is a valid argument and it is valid to throw a NullPointerException in my opinion.  ResourceLocator.getErrorPath catches all exceptions so this NPE is never surfaced to the user.
Comment 4 Chris Goldthorpe CLA 2011-04-21 12:37:14 EDT
I agree with Tom, the exception is caught and not written out to the log so a user would not run into this outside of the debugger.