Bug 89817 [content assist] NPE in JavaTypeCompletionProposal
I20050331-0010 Got the following NPE in my .log: !ENTRY org.eclipse.ui 4 0 2005-03-30 16:00:17.523 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.ui.text.java.JavaTypeCompletionProposal.apply(JavaTypeCompletionProposal.java:120) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposal.apply(JavaCompletionProposal.java:554) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:420) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.selectProposalWithMask(CompletionProposalPopup.java:367) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:750) at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:622) at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:415) at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:55) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:659) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5059) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4806) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:879) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:875) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1182) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3126) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3029) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3466) at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1549) at org.eclipse.swt.internal.BidiUtil.windowProc(BidiUtil.java:648) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1625) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2525) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1570) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1534) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:338) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:151) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:268) at org.eclipse.core.launcher.Main.basicRun(Main.java:260) at org.eclipse.core.launcher.Main.run(Main.java:887) at org.eclipse.core.launcher.Main.main(Main.java:871)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/AnonymousTypeCompletionProposal.java
}
					ASTRewrite rewrite= ASTRewrite.create(unit.getAST());
					ListRewrite rewriter= rewrite.getListRewrite(declaration, declaration.getBodyDeclarationsProperty());
					String key= null;
					MethodDeclaration stub= null;
					for (int index= 0; index < keys.length; index++) {
						key= keys[index];
						for (int offset= 0; offset < bindings.length; offset++) {
							if (key.equals(bindings[offset].getKey())) {
								stub= StubUtility2.createImplementationStub(workingCopy, rewrite, structure, unit.getAST(), bindings[offset], binding.getName(), settings, annotations, binding.isInterface());
								if (stub != null)
									rewriter.insertFirst(stub, null);
								break;
							}
						}
					}
					IDocument document= new Document(workingCopy.getBuffer().getContents());
					try {
						rewrite.rewriteAST(document, fCompilationUnit.getJavaProject().getOptions(true)).apply(document, TextEdit.UPDATE_REGIONS);
						buf.append(document.get(start, document.getLength() - start));
					} catch (MalformedTreeException exception) {
						JavaPlugin.log(exception);
					} catch (IllegalArgumentException exception) {
						JavaPlugin.log(exception);
					} catch (BadLocationException exception) {
						JavaPlugin.log(exception);
					}
				}
			}
			return true;