]> source.dussan.org Git - jgit.git/commitdiff
Split URI regex strings differently 99/1699/2
authorChristian Halstrick <christian.halstrick@sap.com>
Wed, 6 Oct 2010 10:15:30 +0000 (12:15 +0200)
committerChris Aniszczyk <caniszczyk@gmail.com>
Wed, 6 Oct 2010 19:10:24 +0000 (14:10 -0500)
The strings used to construct the regex to parse
URIs are split differently. This makes it easier
to introduce meaningful String constants later on.

Change-Id: I9355fd42e57e0983204465c5d6fe5b6b93655074
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java

index 44160c0d1d26fb793feaf096b1652014f3df6c89..206cc823a421843e64a516a7f2f219ebf2735f80 100644 (file)
@@ -63,16 +63,23 @@ import org.eclipse.jgit.lib.Constants;
 public class URIish implements Serializable {
        private static final long serialVersionUID = 1L;
 
-       private static final Pattern FULL_URI = Pattern
-                       .compile("^(?:([a-z][a-z0-9+-]+)://" // optional http://
-                                       + "(?:([^/]+?)(?::([^/]+?))?@)?" // optional user:password@
-                                       + "(?:([^/]+?))?(?::(\\d+))?)?" // optional example.com:1337
-                                       + "((?:[A-Za-z]:)?" // optional drive-letter:
-                                       + "(?:\\.\\.)?" // optionally a relative path
-                                       +"/.+)$"); // /anything
-
-       private static final Pattern SCP_URI = Pattern
-                       .compile("^(?:([^@]+?)@)?([^:]+?):(.+)$");
+       private static final Pattern FULL_URI = Pattern.compile("^" //
+                       + "(?:" //
+                       + "([a-z][a-z0-9+-]+)://" // optional http://
+                       + "(?:([^/]+?)(?::([^/]+?))?@)?" // optional user:password@
+                       + "(?:([^/]+?))?(?::(\\d+))?" // optional example.com:1337
+                       + ")?" //
+                       + "(" + "(?:[A-Za-z]:)?" // optional drive-letter:
+                       + "(?:\\.\\.)?" // optionally a relative path
+                       + "/.+" //
+                       + ")$"); // /anything
+
+       private static final Pattern SCP_URI = Pattern.compile("^" //
+                       + "(?:([^@]+?)@)?" //
+                       + "([^:]+?)" //
+                       + ":" //
+                       + "(.+)" //
+                       + "$"); //
 
        private String scheme;