Bug 14844

Summary: NPE creating binary projects
Product: [Eclipse Project] JDT Reporter: Tod Creasey <Tod_Creasey>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P2    
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
log file none

Description Tod Creasey CLA 2002-04-29 10:43:59 EDT
Build 20020425

When I set up a new workbench for running Eclipse I got the Null Pointer
Exception below

STEPS
1) Load org.eclipse.ui from the repository
2) Import all of the other plugins in Eclipse using the PDE plugin import
wizard.

I had auto build on and at one point during the build I got the following
exception (see attached log)
Comment 1 Tod Creasey CLA 2002-04-29 10:45:47 EDT
Created attachment 719 [details]
log file
Comment 2 Kent Johnson CLA 2002-04-30 13:22:06 EDT
Could on reproduce on Sun's VM 1.3.1. Tod was using IBM's 1.3.1 which we have 
seen produce a few NPE that are very suspect.

As for a NPE in SimpleLookupTable.rehash()... this code is unchanged in 2 
months:

private void rehash() {
	SimpleLookupTable newLookupTable = new SimpleLookupTable(elementSize);
	Object currentKey;
	for (int i = keyTable.length; --i >= 0;)
		if ((currentKey = keyTable[i]) != null)
			newLookupTable.put(currentKey, valueTable[i]);

	this.keyTable = newLookupTable.keyTable;
	this.valueTable = newLookupTable.valueTable;
	this.elementSize = newLookupTable.elementSize;
	this.threshold = newLookupTable.threshold;
}

And was called from:

public Object put(Object key, Object value) {
	int length = keyTable.length;
	int index = (key.hashCode() & 0x7FFFFFFF) % length;
	Object currentKey;
	while ((currentKey = keyTable[index]) != null) {
		if (currentKey.equals(key)) return valueTable[index] = value;
		if (++index == length) index = 0;
	}
	keyTable[index] = key;
	valueTable[index] = value;

	// assumes the threshold is never equal to the size of the table
	if (++elementSize > threshold) rehash();
	return value;
}

Cannot see how a NPE is possible.