Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitURITest.java8
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/GitURI.java7
2 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitURITest.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitURITest.java
index db560774e..0d3df1a6d 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitURITest.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitURITest.java
@@ -40,6 +40,14 @@ public class GitURITest {
@SuppressWarnings("unused")
@Test(expected = IllegalArgumentException.class)
+ public void testInvalidScmUriWithoutPath() throws Exception {
+ new GitURI(URI
+ .create("scm:git:git://git.eclipse.org/gitroot/cdo/cdo.git"));
+ // expected IAE, it doesn't contain semicolon and path part
+ }
+
+ @SuppressWarnings("unused")
+ @Test(expected = IllegalArgumentException.class)
public void testInvalidScmUriForCVS() throws Exception {
new GitURI(URI.create("scm:cvs:pserver:dev.eclipse.org:/cvsroot/eclipse:org.eclipse.compare"));
// expected IAE, it's a CVS SCM URL
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/GitURI.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/GitURI.java
index 525efbe22..2d21f4058 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/GitURI.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/GitURI.java
@@ -56,8 +56,13 @@ public class GitURI {
try {
if (SCHEME_SCM.equals(uri.getScheme())) {
final String ssp = uri.getSchemeSpecificPart();
+ int indexOfSemicolon = ssp.indexOf(';');
+ if (indexOfSemicolon < 0) {
+ throw new IllegalArgumentException(
+ NLS.bind(CoreText.GitURI_InvalidSCMURL,
+ new String[] { uri.toString() }));
+ }
if (ssp.startsWith(SCHEME_GIT)) {
- int indexOfSemicolon = ssp.indexOf(';');
URIish r = new URIish(ssp.substring(
SCHEME_GIT.length() + 1, indexOfSemicolon));
IPath p = null;

Back to the top