Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 379977

Summary: Trying to delete a branch caused CCE
Product: [Eclipse Project] Platform Reporter: Paul Webster <pwebster>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, john.arthorne, Michael_Rennie, ob1.eclipse
Version: 4.2Flags: ob1.eclipse: review+
john.arthorne: review+
Target Milestone: 4.2 RC2   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Paul Webster CLA 2012-05-18 09:48:57 EDT
I was in the Debug perspective.  I selected a breakpoint and hit the delete key.  I got the following 2 exceptions.



!ENTRY org.eclipse.egit.ui 4 0 2012-05-18 09:24:49.301
!MESSAGE Branch deletion failed
!STACK 0
java.lang.ClassCastException: org.eclipse.jdt.internal.debug.core.breakpoints.JavaLineBreakpoint incompatible with org.eclipse.egit.ui.internal.repository.tree.RefNode
	at org.eclipse.egit.ui.internal.repository.tree.command.DeleteBranchCommand$3.run(DeleteBranchCommand.java:99)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
	at org.eclipse.egit.ui.internal.repository.tree.command.DeleteBranchCommand.deleteBranches(DeleteBranchCommand.java:95)
	at org.eclipse.egit.ui.internal.repository.tree.command.DeleteBranchCommand.access$0(DeleteBranchCommand.java:90)
	at org.eclipse.egit.ui.internal.repository.tree.command.DeleteBranchCommand$1.run(DeleteBranchCommand.java:53)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-05-18 09:24:49.320
!MESSAGE 
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:229)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:210)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:276)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:494)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:545)
	at org.eclipse.e4.ui.bindings.keys.OutOfOrderListener.handleEvent(OutOfOrderListener.java:60)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1276)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1300)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1312)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:748)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3050)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:738)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1758)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5116)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:3444)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4369)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8295)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1192)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2332)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3177)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1021)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:915)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.NullPointerException
	at org.eclipse.egit.ui.internal.repository.tree.command.DeleteBranchCommand.execute(DeleteBranchCommand.java:64)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
	at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	... 48 more
Comment 1 Paul Webster CLA 2012-05-18 09:51:57 EDT
Similar problems in the past
Bug 344704
Bug 344698

PW
Comment 2 Michael Rennie CLA 2012-05-18 10:57:59 EDT
I wonder if this is related to the fix for bug 371130.
Comment 3 Paul Webster CLA 2012-05-23 13:37:42 EDT
I can reproduce this by deleting a local branch in the Git Repo view and then switching to Debug and using DEL to delete a breakpoint or switching to the Package Explorer and using DEL to delete a file.

PW
Comment 4 Paul Webster CLA 2012-05-24 11:08:30 EDT
You could get in a state where the property tester was not valid for the selection being evaluated, and that prevented evaluation of the rest of the Expression by throwing a CoreException.  http://git.eclipse.org/c/egit/egit.git/tree/org.eclipse.egit.ui/plugin.xml#n1196

See bug 352938

In 3.x we simply set the active state to false, that's what we should do here.

PW
Comment 5 Paul Webster CLA 2012-05-24 11:16:25 EDT
Oleg, could I get you to review this:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=pwebster/bug379977
Comment 6 Paul Webster CLA 2012-05-24 11:16:45 EDT
John, could you please review this as well?

PW
Comment 7 Oleg Besedin CLA 2012-05-24 13:13:34 EDT
+1, makes sense from the code view point.
Comment 8 John Arthorne CLA 2012-05-24 14:04:11 EDT
My only suggestion is to ensure active=false for all other failure cases as well. We don't want a failing/crashing property tester resulting in a rogue handler that is always active:

try {
	//err on the side of being inactive if anything goes wrong
	active = false;
	active = activeWhen.evaluate(context) != EvaluationResult.FALSE;
... etc ...
Comment 10 Paul Webster CLA 2012-05-25 14:28:08 EDT
In I20120524-2100

PW
Comment 11 Paul Webster CLA 2012-05-25 14:34:26 EDT
.