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

Bug 352647

Summary: fetch fails if URL of Git server does not match Gerrit server
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Sascha Scholz <sascha.scholz>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: peter.p.jonsson, sascha.scholz
Version: unspecified   
Target Milestone: 0.9   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
mylyn/context/zip none

Description Steffen Pingel CLA 2011-07-20 14:42:50 EDT
If the Git repository is located on a different host the repository lookup fails when fetching patch sets: http://tasktop.com/blog/eclipse/stage-build-review-with-git-gerrit-hudson-and-mylyn#comment-137721 .
Comment 1 Steffen Pingel CLA 2011-07-20 14:44:08 EDT
Sascha, to fix this could we use GerritConfig.gitDaemonUrl to search for the local Git repository instead of the URL of the Gerrit repository?
Comment 2 Sascha Scholz CLA 2011-07-27 06:01:36 EDT
I'm not sure that use of gitDaemonUrl would help, but I'll have a look.
Comment 3 Sascha Scholz CLA 2011-08-12 07:07:56 EDT
Fixed with http://git.eclipse.org/c/mylyn/org.eclipse.mylyn.reviews.git/commit/?id=e7c8e6adee6790ee9504056963b20822d8cc1620

Steffen, is this the correct way to access the GerritConfig instance:

	private String getGerritGitUrl() {
		GerritConfig config = GerritClient.configFromString(getTaskEditorPage().getTaskRepository().getProperty(
				GerritConnector.KEY_REPOSITORY_CONFIG));
		return config.getGitDaemonUrl();
	}
Comment 4 Steffen Pingel CLA 2011-08-12 09:02:33 EDT
Thanks for working on this! I would suggest that we move ReviewSection.getConfig() up to AbstractGerritSection. The persistence mechanism should be internal to the connector.
Comment 5 Steffen Pingel CLA 2011-08-12 09:02:59 EDT
Created attachment 201394 [details]
mylyn/context/zip
Comment 6 Sascha Scholz CLA 2011-09-04 12:53:41 EDT
Done in commit 1ea0f7ab3ec9fa4eff52c23d4a4de27b01f6a33b
Comment 7 Steffen Pingel CLA 2011-09-05 08:34:36 EDT
I noticed that I get an NPE when trying to fetch a patch set from this review: http://review.mylyn.org/#change,5

!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at java.net.URI$Parser.parse(URI.java:3003)
	at java.net.URI.<init>(URI.java:578)
	at org.eclipse.mylyn.internal.gerrit.ui.editor.PatchSetSection.getHostFromUrl(PatchSetSection.java:379)
	at org.eclipse.mylyn.internal.gerrit.ui.editor.PatchSetSection.doFetch(PatchSetSection.java:336)
	at org.eclipse.mylyn.internal.gerrit.ui.editor.PatchSetSection$2.widgetSelected(PatchSetSection.java:200)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
...
Comment 8 Sascha Scholz CLA 2011-09-05 11:18:16 EDT
Fixed with 3c9cc4f3b94481dd89a28a382ebc007e7e3a13a7
Comment 9 Sascha Scholz CLA 2011-09-05 11:18:49 EDT
Could you please verify?
Comment 10 Steffen Pingel CLA 2011-09-05 16:06:33 EDT
Looks good to me. Thanks!