1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 13:35:22 +02:00

Fox for 138886 - If indexerId is for an unknown indexer, default to the Null indexer instead of causing an NPE.

This commit is contained in:
Doug Schaefer 2006-05-11 13:30:11 +00:00
parent 33160cd843
commit cff21a926b

View file

@ -22,6 +22,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementDelta; import org.eclipse.cdt.core.model.ICElementDelta;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IElementChangedListener; import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.internal.core.pdom.indexer.nulli.PDOMNullIndexer;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -219,14 +220,16 @@ public class PDOMManager implements IPDOMManager, IElementChangedListener {
// Look up in extension point // Look up in extension point
IExtension indexerExt = Platform.getExtensionRegistry() IExtension indexerExt = Platform.getExtensionRegistry()
.getExtension(CCorePlugin.INDEXER_UNIQ_ID, indexerId); .getExtension(CCorePlugin.INDEXER_UNIQ_ID, indexerId);
IConfigurationElement[] elements = indexerExt.getConfigurationElements(); if (indexerExt != null) {
for (int i = 0; i < elements.length; ++i) { IConfigurationElement[] elements = indexerExt.getConfigurationElements();
IConfigurationElement element = elements[i]; for (int i = 0; i < elements.length; ++i) {
if ("run".equals(element.getName())) //$NON-NLS-1$ IConfigurationElement element = elements[i];
return (IPDOMIndexer)element.createExecutableExtension("class"); //$NON-NLS-1$ if ("run".equals(element.getName())) //$NON-NLS-1$
return (IPDOMIndexer)element.createExecutableExtension("class"); //$NON-NLS-1$
}
} }
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, // Unknown index, default to the null one
0, CCorePlugin.getResourceString("indexer.notFound"), null)); //$NON-NLS-1$ return new PDOMNullIndexer();
} }
public ISchedulingRule getIndexerSchedulingRule() { public ISchedulingRule getIndexerSchedulingRule() {