Browse Source

Split URI regex strings differently

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>
tags/v0.10.1
Christian Halstrick 13 years ago
parent
commit
0a2b4c1455
1 changed files with 17 additions and 10 deletions
  1. 17
    10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java

+ 17
- 10
org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java View 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;


Loading…
Cancel
Save