Bug 325399

Summary: NPE in org.eclipse.jdt.internal.core.ExternalFoldersManager$RefreshJob.run()
Product: [Eclipse Project] JDT Reporter: Troy Bishop <tjbishop>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: VERIFIED DUPLICATE QA Contact:
Severity: trivial    
Priority: P3 CC: jarthana, Olivier_Thomann
Version: 3.6   
Target Milestone: 3.7 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Troy Bishop CLA 2010-09-15 17:40:25 EDT
Build Identifier: Eclipse 3.6.0

I am receiving the following NPE when a build is occurring on a workspace:

!ENTRY org.eclipse.core.jobs 4 2 2010-09-15 17:33:03.692
!MESSAGE An internal error occurred during: "Refreshing external folders".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jdt.internal.core.ExternalFoldersManager$RefreshJob.run(ExternalFoldersManager.java:387)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

I debugged into the problem as I really have no idea how this happened as it is looking for a path that does not exist and I don't recall how (or where) it got added.  Nonetheless, it is exposing an NPE that I think can be easily fixed, i.e. looking at the code this is where it fails (in org.eclipse.jdt.internal.core.ExternalFoldersManager$RefreshJob#run()):

IFolder folder = getFolder(externalPath);
folder.refreshLocal(IResource.DEPTH_INFINITE, pm);  // <-- NPE here because folder is null

A simply null check added here to prevent the refreshLocal call when the folder is null would prevent this NPE from happening.

I am marking as trivial since it does not seem to have any negative side-effect and is only an NPE in the .log file.

Reproducible: Always
Comment 1 Jay Arthanareeswaran CLA 2010-09-15 23:57:54 EDT
This has already been fixed for 3.7M2.

*** This bug has been marked as a duplicate of bug 321358 ***
Comment 2 Olivier Thomann CLA 2011-01-25 11:20:21 EST
Verified.