Bug 297248 - NPE when setting breakpoint
Summary: NPE when setting breakpoint
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 297611 297888 298927 301404 (view as bug list)
Depends on: 297757
Blocks:
  Show dependency tree
 
Reported: 2009-12-08 13:30 EST by Michael Schneider CLA
Modified: 2010-02-01 12:05 EST (History)
6 users (show)

See Also:
Michael_Rennie: review? (darin.eclipse)


Attachments
proposed fix (1.02 KB, patch)
2009-12-08 16:00 EST, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Schneider CLA 2009-12-08 13:30:53 EST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Build Identifier: I20091030-1201

when trying to set a breakpoint in an anonymous inner class, the NPE below is thrown

java.lang.NullPointerException
	at org.eclipse.jdt.internal.debug.ui.actions.ToggleBreakpointAdapter.getQualifiedName(ToggleBreakpointAdapter.java:444)
	at org.eclipse.jdt.internal.debug.ui.actions.ToggleBreakpointAdapter.toggleBreakpoints(ToggleBreakpointAdapter.java:1187)
	at org.eclipse.debug.ui.actions.ToggleBreakpointAction.run(ToggleBreakpointAction.java:101)
	at org.eclipse.ui.texteditor.AbstractRulerActionDelegate.run(AbstractRulerActionDelegate.java:103)
	at org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.execute(ActionDelegateHandlerProxy.java:289)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.actions.ContributedAction.runWithEvent(ContributedAction.java:185)
	at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:171)
	at org.eclipse.ui.texteditor.AbstractTextEditor$14.triggerAction(AbstractTextEditor.java:2900)
	at org.eclipse.ui.texteditor.AbstractTextEditor$14.mouseDoubleClick(AbstractTextEditor.java:2925)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:183)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3917)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3510)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2404)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2368)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:367)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1363)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1339)


Reproducible: Always

Steps to Reproduce:
1.try setting the breakpoint on the return null; line
private void test() {
 fScriptEnvironment.execute(new IScriptRunnable<Void, RuntimeException>() {
  public Void run(Context cx, Scriptable scope) throws RuntimeException {
   return null;
  }
 });
}

fScriptEnvironment defines the execute method:
public <V, E extends Exception> V execute(IScriptRunnable<V, E> code) throws E;

IScriptRunnable is a simple interface
public interface IScriptRunnable<V, E extends Exception> {
 public V run(Context cx, Scriptable scope) throws E;
}

2.
3.
Comment 1 Michael Rennie CLA 2009-12-08 16:00:27 EST
Created attachment 154057 [details]
proposed fix

it is spec'd that the parser can return an array with corresponding null entries for IJavaElements that could not have their bindings resolved. In this case we have to fall back to composing the name ourselves.
Comment 2 Olivier Thomann CLA 2009-12-15 09:26:46 EST
*** Bug 297611 has been marked as a duplicate of this bug. ***
Comment 3 Michael Rennie CLA 2009-12-15 12:32:13 EST
Applied patch to HEAD, please verify Darin W
Comment 4 Michael Rennie CLA 2009-12-15 15:51:34 EST
*** Bug 297888 has been marked as a duplicate of this bug. ***
Comment 5 Michael Rennie CLA 2010-01-06 09:36:56 EST
*** Bug 298927 has been marked as a duplicate of this bug. ***
Comment 6 Timothy Mowlem CLA 2010-02-01 06:03:14 EST
(In reply to comment #0)
> User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5)
> Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
> Build Identifier: I20091030-1201
> 
> when trying to set a breakpoint in an anonymous inner class, the NPE below is
> thrown
> 
> java.lang.NullPointerException
>     at
> org.eclipse.jdt.internal.debug.ui.actions.ToggleBreakpointAdapter.getQualifiedName(ToggleBreakpointAdapter.java:444)
>     at
> org.eclipse.jdt.internal.debug.ui.actions.ToggleBreakpointAdapter.toggleBreakpoints(ToggleBreakpointAdapter.java:1187)
>     at
> org.eclipse.debug.ui.actions.ToggleBreakpointAction.run(ToggleBreakpointAction.java:101)
>     at
> org.eclipse.ui.texteditor.AbstractRulerActionDelegate.run(AbstractRulerActionDelegate.java:103)
>     at
> org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.execute(ActionDelegateHandlerProxy.java:289)
>     at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
>     at
> org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
>     at
> org.eclipse.ui.actions.ContributedAction.runWithEvent(ContributedAction.java:185)
>     at
> org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:171)
>     at
> org.eclipse.ui.texteditor.AbstractTextEditor$14.triggerAction(AbstractTextEditor.java:2900)
>     at
> org.eclipse.ui.texteditor.AbstractTextEditor$14.mouseDoubleClick(AbstractTextEditor.java:2925)
>     at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:183)
>     at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
>     at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
>     at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3917)
>     at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3510)
>     at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2404)
>     at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2368)
>     at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220)
>     at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
>     at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>     at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
>     at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>     at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
>     at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
>     at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
>     at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
>     at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:367)
>     at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611)
>     at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566)
>     at org.eclipse.equinox.launcher.Main.run(Main.java:1363)
>     at org.eclipse.equinox.launcher.Main.main(Main.java:1339)
> 
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1.try setting the breakpoint on the return null; line
> private void test() {
>  fScriptEnvironment.execute(new IScriptRunnable<Void, RuntimeException>() {
>   public Void run(Context cx, Scriptable scope) throws RuntimeException {
>    return null;
>   }
>  });
> }
> 
> fScriptEnvironment defines the execute method:
> public <V, E extends Exception> V execute(IScriptRunnable<V, E> code) throws E;
> 
> IScriptRunnable is a simple interface
> public interface IScriptRunnable<V, E extends Exception> {
>  public V run(Context cx, Scriptable scope) throws E;
> }
> 
> 2.
> 3.

This is NOT fixed as of 3.5M6 for MacOX Cocoa 64-bit
Comment 7 Michael Rennie CLA 2010-02-01 09:52:54 EST
*** Bug 301404 has been marked as a duplicate of this bug. ***
Comment 8 Michael Rennie CLA 2010-02-01 09:55:48 EST
reopening to investigate the reported failure on Mac
Comment 9 Timothy Mowlem CLA 2010-02-01 11:21:12 EST
(In reply to comment #8)
> reopening to investigate the reported failure on Mac

Apologies but it is fixed in that it now works, i.e. the breakpoint is set. What threw me was that it takes a couple of seconds or so before the breakpoint appears in the margin having click to set a breakpoint.

So this does now work but it is very slow which is a bug (IMHO) although lower priority.

Not sure whether this should be closed and a separate bug raised or just use this one for the problem? I don't seem to have access to change priority or status so over to you...
Comment 10 Dani Megert CLA 2010-02-01 12:05:20 EST
>Not sure whether this should be closed and a separate bug raised
I suspect you are seeing 301113.