Bug 418075 - NullPointerException in CModelManager.createBinaryFile()
Summary: NullPointerException in CModelManager.createBinaryFile()
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: Next   Edit
Hardware: PC Windows 8
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
: 409898 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-26 05:45 EDT by Serge Beauchamp CLA
Modified: 2020-09-04 15:16 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 Serge Beauchamp CLA 2013-09-26 05:45:33 EDT
This is a rare exception thrown based on a race condition when the project is closed in the middle of a a background thread execution.

The root cause of the Exception is the method IFile.getLocationURI() returning null in CModelManager.createBinaryFile().

The stack trace reported is as follows:

!ENTRY org.eclipse.core.jobs 4 2 2013-05-31 07:19:21.611
!MESSAGE An internal error occurred during: "Reading Debug Symbol Information: libexample.so".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.core.internal.filesystem.InternalFileSystemCore.getStore(InternalFileSystemCore.java:104)
	at org.eclipse.core.filesystem.EFS.getStore(EFS.java:470)
	at org.eclipse.cdt.internal.core.model.Util.isNonZeroLengthFile(Util.java:445)
	at org.eclipse.cdt.internal.core.model.CModelManager.createBinaryFile(CModelManager.java:675)
	at org.eclipse.cdt.debug.internal.core.executables.StandardSourceFilesProvider.createBinaryFile(StandardSourceFilesProvider.java:41)
	at org.eclipse.cdt.debug.internal.core.executables.StandardSourceFilesProvider.getSourceFiles(StandardSourceFilesProvider.java:117)
	at org.eclipse.cdt.debug.core.executables.ExecutablesManager.getSourceFiles(ExecutablesManager.java:549)
	at org.eclipse.cdt.debug.core.executables.Executable.getSourceFiles(Executable.java:206)
	at org.eclipse.cdt.debug.internal.ui.views.executables.SourceFilesContentProvider$QuickParseJob.run(SourceFilesContentProvider.java:53)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Serge Beauchamp CLA 2013-09-26 05:47:28 EDT
Fix pushed through gerrit as:

https://git.eclipse.org/r/16789
Comment 2 Andrew Eidsness CLA 2013-12-16 12:06:23 EST
I just ran into the same problem (on a branch that was made before this fix went in).  I found this bug when I tried to create one of my own.

Although this patch fixes the exact problem, my patch was slightly different.  I put the null check at the top of Util.isNonZeroLengthFile so that it would get all possible callers, not just the #createBinaryFile case.

The two other callers are:

Util.isNonZeroLengthFile(IPath) which I think could have the exact same problem.  When this method receives a null IPath, it will pass the null to the #isNonZeroLengthFile(URI) implementation.

CModelManager.createTranslationUnitFrom, which has a few callers, but I didn't follow back far enough to see if they could wind up passing in null.
Comment 3 Nathan Ridge CLA 2017-02-23 00:03:16 EST
*** Bug 409898 has been marked as a duplicate of this bug. ***