Bug 6011 - NullPointerException starting Eclipse with broken fragments
Summary: NullPointerException starting Eclipse with broken fragments
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: DJ Houghton CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-16 11:18 EST by Adam Schlegel CLA
Modified: 2001-11-20 10:20 EST (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 Adam Schlegel CLA 2001-11-16 11:18:04 EST
Eclipse crashes on startup when it tries to load a fragment that extends a 
plugin that does not exist.

Under Windows, this means that the spash screen turns off, without starting the 
workbench. No log is written when this occurs. No output is printed to the 
command line when invoking using eclipse.exe. Starting Eclipse using the 
command line "java -cp startup.jar org.eclipse.core.launcher.UIMain" will print 
the NPE stack trace to the console.

I am using the Eclipse 20011115 integration build.

To reproduce from a fresh installation of Eclipse:
- Create a fragment called org.eclipse.bug. The fragment.xml should look like:
<?xml version="1.0" encoding="UTF-8"?>
<fragment
   name="Bug Fragment"
   id="org.eclipse.bug"
   version="1.0.0"
   plugin-id="org.eclipse.not.there"
   plugin-version="1.0.0">
   <runtime>
      <library name="bug.jar"/>
   </runtime>
</fragment>

- Start Eclipse from the command prompt using the command:
java -cp startup.jar org.eclipse.core.launcher.UIMain

- The NPE stack trace should get printed to the console.
Comment 1 John Arthorne CLA 2001-11-16 16:39:18 EST
Failure case was bad so I released a fix immediately.  Problem was in this code 
in RegistryResolver#linkFragments:

IndexEntry ix = (IndexEntry) idmap.get(fragment.getPluginId());
byte matchType = fragment.getMatch();
for (Iterator list = ix.versions().iterator(); list.hasNext() && plugin == 
null;) {

It is possible for "ix" to be null, causing the NullPointerException in the for 
loop.  Also released a fix to the message catalog for this case.

Debbie, I CC'd you so you can confirm the fix and add tests if desired.  
Versions for fix in repo are:

org.eclipse.core.internal.plugins.RegistryResolver 1.17
org.eclipse.core.internal.runtime.messages.properties 1.9
Comment 2 Debbie Wilson CLA 2001-11-19 14:39:46 EST
A new test has been added to the class BadPluginsTest (badFragment) to test 
this case.  Other tests in the runtime test package have been examined for 
empty 'catch' clauses in a try/catch construct.
Comment 3 Rodrigo Peretti CLA 2001-11-20 10:20:16 EST
Fixed in v211