Bug 188684 - NPE in IPDOMManager#setDefaultIndexerId
Summary: NPE in IPDOMManager#setDefaultIndexerId
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.0 RC2   Edit
Assignee: Markus Schorn CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-05-23 12:43 EDT by Warren Paul CLA
Modified: 2008-06-22 01:10 EDT (History)
1 user (show)

See Also:


Attachments
patch file (1.70 KB, patch)
2007-05-23 12:45 EDT, Warren Paul CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Warren Paul CLA 2007-05-23 12:43:18 EDT
Build ID: I20070503-1400

Steps To Reproduce:
1. Calling IPDOMManager#setDefaultIndexerId results in a null pointer exception


More information:
Some of our JUnit tests disable the indexer in during setup so it's not running while we're testing project creation, etc..

We do something like this:

		CCorePlugin.getIndexManager().setDefaultIndexerId(IPDOMManager.ID_NO_INDEXER);

But that causes a NPE as easily seen by the code below.


	public void setDefaultIndexerId(String indexerId) {
		setIndexerId(null, indexerId);
	}
	
    public void setIndexerId(final ICProject project, String indexerId) {
    	IProject prj= project.getProject();
    	IndexerPreferences.set(prj, IndexerPreferences.KEY_INDEXER_ID, indexerId);
    	CCoreInternals.savePreferences(prj);
    }

The attached patch should fix the problem.
Comment 1 Warren Paul CLA 2007-05-23 12:45:12 EDT
Created attachment 68383 [details]
patch file
Comment 2 Markus Schorn CLA 2007-05-24 03:41:17 EDT
Thanks, I have applied your patch.
Comment 3 Doug Schaefer CLA 2008-06-03 15:06:23 EDT
assigning
Comment 4 Doug Schaefer CLA 2008-06-03 15:06:55 EDT
done