Bug 437845

Summary: Gerrit connector fails on custom approval categories with spaces in name
Product: z_Archived Reporter: Steve Elsemore <selsemore>
Component: MylynAssignee: Steve Elsemore <selsemore>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 Keywords: contributed
Version: unspecified   
Target Milestone: 2.5   
Hardware: PC   
OS: All   
Whiteboard:

Description Steve Elsemore CLA 2014-06-20 16:28:33 EDT
The sync freezes with the following error when trying to sync tasks with an custom gerrit label with spaces in the name(i.e., "Sum Code Review >=2 and +1 Verified enables submit").

This is the same bug as https://bugs.eclipse.org/bugs/show_bug.cgi?id=417809, however the fix for that bug does not work when the label includes spaces.

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.RuntimeException: Internal Error, no approval type found for: Sum Code Review >=2 and +1 Verified enables submit)
	at org.eclipse.swt.SWT.error(SWT.java:4397)
	at org.eclipse.swt.SWT.error(SWT.java:4312)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4145)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3762)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	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:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.RuntimeException: Internal Error, no approval type found for: Sum Code Review >=2 and +1 Verified enables submit
	at org.eclipse.mylyn.internal.gerrit.core.remote.GerritReviewRemoteFactory.updateRequirements(GerritReviewRemoteFactory.java:375)
	at org.eclipse.mylyn.internal.gerrit.core.remote.GerritReviewRemoteFactory.updateApprovalsAndRequirements(GerritReviewRemoteFactory.java:290)
	at org.eclipse.mylyn.internal.gerrit.core.remote.GerritReviewRemoteFactory.updateModel(GerritReviewRemoteFactory.java:216)
	at org.eclipse.mylyn.internal.gerrit.core.remote.GerritReviewRemoteFactory.updateModel(GerritReviewRemoteFactory.java:1)
	at org.eclipse.mylyn.reviews.core.spi.remote.emf.RemoteEmfConsumer.applyModel(RemoteEmfConsumer.java:184)
	at org.eclipse.mylyn.reviews.core.spi.remote.JobRemoteService$2$1.run(JobRemoteService.java:77)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	... 24 more
Comment 1 Steve Elsemore CLA 2014-06-20 17:01:13 EDT
Code Review: https://git.eclipse.org/r/28837/
Comment 2 Sam Davis CLA 2014-07-30 14:54:40 EDT
According to http://gerrit-review.googlesource.com/Documentation/config-labels.html, spaces in the label name are not allowed.
Comment 3 Miles Parker CLA 2014-09-24 16:41:20 EDT
Still, it looks like the Gerrit API must allow it somewhere or it wouldn't occur, and we shouldn't fail when it does. As we're already handling that case in https://git.eclipse.org/r/#/c/14957/ So I think it's a good fix and couldn't cause harm.

Steve, you should accept this task and then mark it closed when the review is merged. Sorry it took so long to respond to this!
Comment 4 Sam Davis CLA 2014-10-15 19:14:51 EDT
Might as well I guess.
Comment 5 Sam Davis CLA 2014-10-15 19:40:39 EDT
Steve, thanks very much for the contribution!