Bug 562386 - GitCloneDropAdapter fails due to NPE
Summary: GitCloneDropAdapter fails due to NPE
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 5.7   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 5.8   Edit
Assignee: Thomas Wolf CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-22 04:41 EDT by Thomas Wolf CLA
Modified: 2020-04-24 04:51 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wolf CLA 2020-04-22 04:41:20 EDT
DND of a git link doesn't work anymore but produces an NPE:

!ENTRY org.eclipse.ui 4 0 2020-04-21 19:25:12.063
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
  at org.eclipse.swt.SWT.error(SWT.java:4533)
  at org.eclipse.swt.SWT.error(SWT.java:4448)
  at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
  at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4032)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3708)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
  at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
  at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
  at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: java.lang.NullPointerException
  at org.eclipse.ui.handlers.HandlerUtil.noVariableFound(HandlerUtil.java:46)
  at org.eclipse.ui.handlers.HandlerUtil.getVariableChecked(HandlerUtil.java:93)
  at org.eclipse.ui.handlers.HandlerUtil.getActivePartChecked(HandlerUtil.java:349)
  at org.eclipse.egit.ui.internal.repository.tree.command.RepositoriesViewCommandHandler.getSelectedRepositoryGroup(RepositoriesViewCommandHandler.java:80)
  at org.eclipse.egit.ui.internal.repository.tree.command.CloneCommand.getSelectedRepositoryGroup(CloneCommand.java:1)
  at org.eclipse.egit.ui.internal.repository.tree.command.CloneCommand.execute(CloneCommand.java:54)
  at org.eclipse.egit.ui.internal.clone.GitCloneDropAdapter.proceedClone(GitCloneDropAdapter.java:177)
  at org.eclipse.egit.ui.internal.clone.GitCloneDropAdapter$GitDropTargetListener$1.run(GitCloneDropAdapter.java:286)
  at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
  at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
  ... 24 more
Comment 1 Thomas Wolf CLA 2020-04-22 04:46:38 EDT
This is fallout from https://git.eclipse.org/r/#/c/157762/ (bug 553501). Before that commit, CloneCommand just opened the git clone wizard. Since that commit, it also tries to obtain the selection from the ExecutionEvent.

GitCloneDropAdapter invokes the CloneCommand with a "fake" empty ExecutionEvent. This is wrong; it needs to invoke the command properly with a proper event with all relevant fields and variables filled in.

So the problem is not with the changes in CloneCommand but with the wrong way it's being invoked in GitCloneDropAdapter. Luckily bug 562323 gives us a mechanism to fix this easily.
Comment 2 Eclipse Genie CLA 2020-04-22 05:10:29 EDT
New Gerrit change created: https://git.eclipse.org/r/161363
Comment 3 Eclipse Genie CLA 2020-04-24 04:47:50 EDT
Gerrit change https://git.eclipse.org/r/161363 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=efd6b2e249ba454b0cfc71678f1ca666e797cdac