Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352856 - Eclipse refuses to exit because of NPE when no language toolkit could be found in findAppropriateToolkitByObject()
Summary: Eclipse refuses to exit because of NPE when no language toolkit could be foun...
Status: RESOLVED FIXED
Alias: None
Product: DLTK
Classification: Technology
Component: Common (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: dltk.common-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-22 09:14 EDT by patrick.stiegeler CLA
Modified: 2011-07-22 15:13 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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