Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Munteanu2011-06-29 20:08:00 +0000
committerChristian Halstrick2011-06-30 14:47:26 +0000
commitbacd63bec848355bccde0b6099a31decb46dbb09 (patch)
tree38fd66e8dd147b248f483a44f85c071db113acd6 /org.eclipse.egit.mylyn.ui/src/org
parent9e3c2feda5e5535b4ee4f7583a54dca562b4b2ef (diff)
downloadegit-bacd63bec848355bccde0b6099a31decb46dbb09.tar.gz
egit-bacd63bec848355bccde0b6099a31decb46dbb09.tar.xz
egit-bacd63bec848355bccde0b6099a31decb46dbb09.zip
TaskReferenceFactory: use URIish to extract the host
Diffstat (limited to 'org.eclipse.egit.mylyn.ui/src/org')
-rw-r--r--org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/TaskReferenceFactory.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/TaskReferenceFactory.java b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/TaskReferenceFactory.java
index a03536ace5..4ae6c24909 100644
--- a/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/TaskReferenceFactory.java
+++ b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/TaskReferenceFactory.java
@@ -13,7 +13,6 @@ package org.eclipse.egit.internal.mylyn.ui.commit;
import java.net.InetAddress;
import java.net.MalformedURLException;
-import java.net.URI;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.List;
@@ -29,6 +28,7 @@ import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.transport.URIish;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.team.ui.LinkedTaskInfo;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -123,13 +123,11 @@ public class TaskReferenceFactory implements IAdapterFactory {
* @return {@link TaskRepository} associated with this Git repo or <code>null</code> if nothing found
*/
private TaskRepository getTaskRepositoryByGitRepoURL(final String repoUrl) {
+ if (repoUrl == null)
+ return null;
+
try {
- // replacing protocol name to avoid MalformedURIException
- URI uri = repoUrl == null ? null : new URI(repoUrl.replaceFirst("\\w+://", "http://")); //$NON-NLS-1$ //$NON-NLS-2$
- if (uri != null) {
- String gitHost = uri.toURL().getHost();
- return getTaskRepositoryByHost(gitHost);
- }
+ return getTaskRepositoryByHost(new URIish(repoUrl).getHost());
} catch (Exception ex) {
EGitMylynUI.getDefault().getLog().log(
new Status(IStatus.ERROR, EGitMylynUI.PLUGIN_ID, "failed to get repo url", ex)); //$NON-NLS-1$

Back to the top