Buggy code:
public class IndexManager extends JobManager implements IIndexConstants { public static int MAX_FILES_IN_MEMORY = 0 ; public IWorkspace workspace ; public SimpleLookupTable indexNames = new SimpleLookupTable ( ) ; private Map indexes = new HashMap ( 5 ) ; private Map monitors = new HashMap ( 5 ) ; private boolean needToSave = false ; private static final CRC32 checksumCalculator = new CRC32 ( ) ; private IPath javaPluginLocation = null ; private SimpleLookupTable indexStates = null ; private File savedIndexNamesFile = new File ( getJavaPluginWorkingLocation ( ) . append ( "savedIndexNames.txt" ) . toOSString ( ) ) ; public static Integer SAVED_STATE = new Integer ( 0 ) ; public static Integer UPDATING_STATE = new Integer ( 1 ) ; public static Integer UNKNOWN_STATE = new Integer ( 2 ) ; public static Integer REBUILDING_STATE = new Integer ( 3 ) ; public synchronized void aboutToUpdateIndex ( IPath path , Integer newIndexState ) { } public void addBinary ( IFile resource , IPath indexedContainer ) { } public void addSource ( IFile resource , IPath indexedContainer ) { } String computeIndexName ( IPath path ) { } public synchronized IIndex getIndex ( IPath path , boolean reuseExistingFile , boolean createIfMissing ) { } public synchronized IIndex getIndexForUpdate ( IPath path , boolean reuseExistingFile , boolean createIfMissing ) { } private SimpleLookupTable getIndexStates ( ) { } private IPath getJavaPluginWorkingLocation ( ) { } public ReadWriteMonitor getMonitorFor ( IIndex index ) { } public void indexAll ( IProject project ) { } public void indexLibrary ( IPath path , IProject requestingProject ) { } public void indexSourceFolder ( JavaProject javaProject , IPath sourceFolder , final char [ ] [ ] exclusionPattern ) { } public void jobWasCancelled ( IPath path ) { } protected synchronized void moveToNextJob ( ) { } protected void notifyIdle ( long idlingTime ) { } public IIndex peekAtIndex ( IPath path ) { } public String processName ( ) { } private void rebuildIndex ( String indexName , IPath path ) { } public synchronized IIndex recreateIndex ( IPath path ) { } public void remove ( String resourceName , IPath indexedContainer ) { } public synchronized void removeIndex ( IPath path ) { } public synchronized void removeIndexFamily ( IPath path ) { } public void removeSourceFolderFromIndex ( JavaProject javaProject , IPath sourceFolder , char [ ] [ ] exclusionPatterns ) { } public void reset ( ) { } public void saveIndex ( IIndex index ) throws IOException { } public void saveIndexes ( ) { } public void shutdown ( ) { if ( JobManager . VERBOSE ) JobManager . verbose ( "Shutdown" ) ; <START_BUG> IndexSelector indexSelector = new IndexSelector ( new JavaWorkspaceScope ( ) , null , false , this ) ; <END_BUG> IIndex [ ] selectedIndexes = indexSelector . getIndexes ( ) ; SimpleLookupTable knownPaths = new SimpleLookupTable ( ) ; for ( int i = 0 , max = selectedIndexes . length ; i < max ; i ++ ) { String path = selectedIndexes [ i ] . getIndexFile ( ) . getAbsolutePath ( ) ; knownPaths . put ( path , path ) ; } if ( ( indexStates ) != null ) { Object [ ] keys = indexStates . keyTable ; for ( int i = 0 , l = keys . length ; i < l ; i ++ ) { String key = ( ( String ) ( keys [ i ] ) ) ; if ( ( key != null ) && ( ! ( knownPaths . containsKey ( key ) ) ) ) updateIndexState ( key , null ) ; } } File indexesDirectory = new File ( getJavaPluginWorkingLocation ( ) . toOSString ( ) ) ; if ( indexesDirectory . isDirectory ( ) ) { File [ ] indexesFiles = indexesDirectory . listFiles ( ) ; if ( indexesFiles != null ) { for ( int i = 0 , indexesFilesLength = indexesFiles . length ; i < indexesFilesLength ; i ++ ) { String fileName = indexesFiles [ i ] . getAbsolutePath ( ) ; if ( ( ! ( knownPaths . containsKey ( fileName ) ) ) && ( fileName . toLowerCase ( ) . endsWith ( ".index" ) ) ) { if ( JobManager . VERBOSE ) JobManager . verbose ( ( "Deleting<seq2seq4repair_space>index<seq2seq4repair_space>file<seq2seq4repair_space>" + ( indexesFiles [ i ] ) ) ) ; indexesFiles [ i ] . delete ( ) ; } } } } super . shutdown ( ) ; } public String toString ( ) { } private char [ ] readIndexState ( ) { } private void updateIndexState ( String indexName , Integer indexState ) { } }

Fix:
IndexSelector indexSelector = new IndexSelector ( new JavaWorkspaceScope ( ) , null , this ) ;