Browse Source

Fix a complicated multi level nested if block structure to use a single level with multiple returns.

Change-Id: I3f116f37045e83aba5c80d45b987ab075502dcc6
stable-1.1
Ketan Padegaonkar 14 years ago committed by Shawn O. Pearce
parent
commit
8b8ad75ada
  1. 71
      org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java

71
org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java

@ -202,43 +202,42 @@ public class URIish implements Serializable {
if (matcher.matches()) { if (matcher.matches()) {
scheme = matcher.group(1); scheme = matcher.group(1);
path = cleanLeadingSlashes(matcher.group(2), scheme); path = cleanLeadingSlashes(matcher.group(2), scheme);
} else { return;
matcher = FULL_URI.matcher(s); }
if (matcher.matches()) { matcher = FULL_URI.matcher(s);
scheme = matcher.group(1); if (matcher.matches()) {
user = matcher.group(2); scheme = matcher.group(1);
pass = matcher.group(3); user = matcher.group(2);
host = matcher.group(4); pass = matcher.group(3);
if (matcher.group(5) != null) host = matcher.group(4);
port = Integer.parseInt(matcher.group(5)); if (matcher.group(5) != null)
path = cleanLeadingSlashes( port = Integer.parseInt(matcher.group(5));
n2e(matcher.group(6)) + n2e(matcher.group(7)), path = cleanLeadingSlashes(
scheme); n2e(matcher.group(6)) + n2e(matcher.group(7)), scheme);
} else { return;
matcher = RELATIVE_SCP_URI.matcher(s); }
if (matcher.matches()) { matcher = RELATIVE_SCP_URI.matcher(s);
user = matcher.group(1); if (matcher.matches()) {
pass = matcher.group(2); user = matcher.group(1);
host = matcher.group(3); pass = matcher.group(2);
path = matcher.group(4); host = matcher.group(3);
} else { path = matcher.group(4);
matcher = ABSOLUTE_SCP_URI.matcher(s); return;
if (matcher.matches()) { }
user = matcher.group(1); matcher = ABSOLUTE_SCP_URI.matcher(s);
pass = matcher.group(2); if (matcher.matches()) {
host = matcher.group(3); user = matcher.group(1);
path = matcher.group(4); pass = matcher.group(2);
} else { host = matcher.group(3);
matcher = LOCAL_FILE.matcher(s); path = matcher.group(4);
if (matcher.matches()) { return;
path = matcher.group(1); }
} else matcher = LOCAL_FILE.matcher(s);
throw new URISyntaxException(s, if (matcher.matches()) {
JGitText.get().cannotParseGitURIish); path = matcher.group(1);
} return;
}
}
} }
throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish);
} }
private String n2e(String s) { private String n2e(String s) {

Loading…
Cancel
Save