Bug 34754 Array out of bounds in code assist
Build: 2.1 RC2 I got into a state when invoking code assist where the popup window was empty. I can't reproduce it, but I was typing while the popup was open. When I entered a character that narrowed down the possible search values to zero, I was left with an empty popup window. In my case I had entered resource.getK (and there are no methods starting with "getk" on IResource). This resulted in an ArrayIndexOutOfBoundsException in the log. I will attach the log.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProposal.java
final ReferenceTracker referenceTracker= new ReferenceTracker();
			referenceTracker.preReplace(document, referenceOffset);
			replace(document, fReplacementOffset, fReplacementLength, string);
			referenceOffset= referenceTracker.postReplace(document);			
			fReplacementOffset= referenceOffset - (string == null ? 0 : string.length());
			if (fTextViewer != null && string != null) {
				int index= string.indexOf("()"); 
				if (index != -1 && index + 1 == fCursorPosition) {
					IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
					if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACKETS)) {
						int newOffset= fReplacementOffset + fCursorPosition;
						
						LinkedPositionManager manager= new LinkedPositionManager(document);
						manager.addPosition(newOffset, 0);
		
						LinkedPositionUI editor= new LinkedPositionUI(fTextViewer, manager);
						editor.setExitPolicy(new ExitPolicy(')'));
						editor.setFinalCaretOffset(newOffset + 1);
						editor.enter();							
					}
				}
			}
		} catch (BadLocationException x) {
			
		}		
	}
	/**
	 * A class to simplify tracking a reference position in a document. 
	 */
	private static final class ReferenceTracker {