Community
Participate
Working Groups
Build: 3.0M7 I launched a runtime workbench in debug mode on an existing workspace containing two Hello world plug-ins. When the runtime workbench appeared, I got the first stack pasted below in my log complaining about background indexer crashing. In the threads view of my host workbench, two threads paused, when I pressed 'continue' on both of them. The first thread dumped a stack to the console that is identical to the one I found in the log. The second thread dumped an NPE. It's the second stack pasted below. Error Feb 13, 2004 21:06:32.281 Background Indexer Crash Recovery java.lang.ArrayIndexOutOfBoundsException: 16777425 at org.eclipse.jdt.internal.core.index.impl.WordEntry.mapRefs (WordEntry.java:136) at org.eclipse.jdt.internal.core.index.impl.MergeFactory.mergeReferences (MergeFactory.java:180) at org.eclipse.jdt.internal.core.index.impl.MergeFactory.merge (MergeFactory.java:87) at org.eclipse.jdt.internal.core.index.impl.IndexImpl.merge(IndexImpl.java:221) at org.eclipse.jdt.internal.core.index.impl.IndexImpl.save(IndexImpl.java:315) at org.eclipse.jdt.internal.core.search.indexing.IndexManager.saveIndex (IndexManager.java:450) at org.eclipse.jdt.internal.core.search.indexing.AddJarFileToIndex.execute (AddJarFileToIndex.java:176) at org.eclipse.jdt.internal.core.search.processing.JobManager.run (JobManager.java:344) at java.lang.Thread.run(Thread.java:534) java.lang.NullPointerException at org.eclipse.jdt.internal.core.search.indexing.IndexManager.updateIndexState (IndexManager.java:616) at org.eclipse.jdt.internal.core.search.indexing.IndexManager.rebuildIndex (IndexManager.java:331) at org.eclipse.jdt.internal.core.search.indexing.IndexManager.getIndex (IndexManager.java:125) at org.eclipse.jdt.internal.core.search.PatternSearchJob.getIndexes (PatternSearchJob.java:103) at org.eclipse.jdt.internal.core.search.PatternSearchJob.execute (PatternSearchJob.java:65) at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob (JobManager.java:261) at org.eclipse.jdt.core.search.SearchEngine.searchAllTypeNames (SearchEngine.java:825) at org.eclipse.jdt.internal.corext.util.AllTypesCache.search (AllTypesCache.java:440) at org.eclipse.jdt.internal.corext.util.AllTypesCache$TypeCacher.doSearchTypes (AllTypesCache.java:129) at org.eclipse.jdt.internal.corext.util.AllTypesCache$TypeCacher.run (AllTypesCache.java:98)
This is the code for the method: private void updateIndexState(String indexName, Integer indexState) { getIndexStates(); // ensure the states are initialized if (indexState != null) { if (indexState.equals(indexStates.get(indexName))) return; indexStates.put(indexName, indexState); } else { if (!indexStates.containsKey(indexName)) return; indexStates.removeKey(indexName); } BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter (savedIndexNamesFile)); Object[] keys = indexStates.keyTable; 'indexStates' cannot be null here since it wasn't null 5 lines above. Likely a VM problem.
Unlikely to be VM-related. It is possible for 'indexStates' to be null, because the if check is for 'indexState' (i.e. singular).
Look at the then AND else blocks, both access indexStates... it cannot be null on a few lines later.
Please indicate exactly which line from your snippet corresponds to the line throwing the NPE, so I could try to figure out where the NPE could be coming from. What I know is that I got an NPE and I have got the stack trace to prove it, so I'm not sure that closing it without further investigation is a good idea.
Without further investigation? Did you even try to read thru the code in the stack trace? The very first method called in updateIndexState is: private void updateIndexState(String indexName, Integer indexState) { getIndexStates(); // ensure the states are initialized Here's the code for it: private SimpleLookupTable getIndexStates() { if (indexStates != null) return indexStates; this.indexStates = new SimpleLookupTable(); char[] savedIndexNames = readIndexState(); if (savedIndexNames.length > 0) { char[][] names = CharOperation.splitOn('\n', savedIndexNames); for (int i = 0, l = names.length; i < l; i++) { char[] name = names[i]; if (name.length > 0) this.indexStates.put(new String(name), SAVED_STATE); } } return this.indexStates; } So how is indexStates null a few lines later?