aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Munteanu2011-06-29 16:08:00 (EDT)
committerChristian Halstrick2011-06-30 10:47:26 (EDT)
commitbacd63bec848355bccde0b6099a31decb46dbb09 (patch)
tree38fd66e8dd147b248f483a44f85c071db113acd6
parent9e3c2feda5e5535b4ee4f7583a54dca562b4b2ef (diff)
downloadegit-bacd63bec848355bccde0b6099a31decb46dbb09.zip
egit-bacd63bec848355bccde0b6099a31decb46dbb09.tar.gz
egit-bacd63bec848355bccde0b6099a31decb46dbb09.tar.bz2
TaskReferenceFactory: use URIish to extract the hostrefs/changes/92/3692/5
-rw-r--r--org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/TaskReferenceFactory.java12
2 files changed, 6 insertions, 7 deletions
diff --git a/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF
index a024561..b1c428a 100644
--- a/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF
@@ -27,4 +27,5 @@ Import-Package: org.eclipse.egit.ui;version="[1.1.0,1.2.0)",
org.eclipse.egit.ui.internal.synchronize.model;version="[1.1.0,1.2.0)",
org.eclipse.jgit.revwalk;version="[1.1.0,1.2.0)",
org.eclipse.jgit.lib;version="[1.1.0,1.2.0)",
+ org.eclipse.jgit.transport;version="[1.1.0,1.2.0)",
org.eclipse.ui.plugin
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 a03536a..4ae6c24 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$