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

Bug 352856

Summary: Eclipse refuses to exit because of NPE when no language toolkit could be found in findAppropriateToolkitByObject()
Product: [Technology] DLTK Reporter: patrick.stiegeler
Component: CommonAssignee: dltk.common-inbox <dltk.common-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: alex.panchenko
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description patrick.stiegeler CLA 2011-07-22 09:14:29 EDT
Build Identifier: 3.0.0.v20101211-0331-7l--ED-z0UkgZToe6HfMg

org.eclipse.dltk.core.DLTKLanguageManager::findAppropriateToolkitByObject()
throws a NullpointerException - instead of returning null - when no language toolkit is found by toolkitManager.

Suggestion: In findAppropriateToolkitByObject(), please insert the following line for (***) in findAppropriateToolkitByObject().

------------- replacement for (***)...

        if( toolkit == null ) {
            return null;
        }

------------- location of (***) in ...

... IDLTKLanguageToolkit findAppropriateToolkitByObject(...) {
    ...
    final PriorityClassDLTKExtensionManager toolkitManager = ...;
    ...
    for (...) {
        IDLTKLanguageToolkit toolkit = ...;
        (***)
        if (object instanceof IResource) {
            ...
        } else if (object instanceof IPath) {
            ...
        } else {
            return null;
        }
    }
    
    return null;
}

Reproducible: Always

Steps to Reproduce:
Happens every time in our setting, where some of our plugins (which provide DLTK extensions) fail on purpose to activate in their Activator (license issues).
Comment 1 patrick.stiegeler CLA 2011-07-22 10:13:47 EDT
The NPE occurs e.g. when the user tries to quit Eclipse while still having a DLTK-supported file open in an editor. Eclipse then refuses to exit because of this NPE.
Comment 2 Alex Panchenko CLA 2011-07-22 15:13:42 EDT
Fixed in CVS HEAD & 3.0 branch