From 0a2b4c14559b1c94f9600394ccb79de1985c04d8 Mon Sep 17 00:00:00 2001 From: Christian Halstrick Date: Wed, 6 Oct 2010 12:15:30 +0200 Subject: [PATCH] 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 --- .../org/eclipse/jgit/transport/URIish.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java index 44160c0d1d..206cc823a4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java @@ -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; -- 2.39.5