aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKetan Padegaonkar2011-05-19 03:43:18 (EDT)
committerShawn O. Pearce2011-05-31 12:15:28 (EDT)
commit8b8ad75ada9d90f8b26e69ca04d4bf512bf43dd4 (patch)
tree29e44f0c941357c762bdb08cd09fe7c47607e78c
parent690c268c793bfc218982130fbfc25870f292295e (diff)
downloadjgit-8b8ad75ada9d90f8b26e69ca04d4bf512bf43dd4.zip
jgit-8b8ad75ada9d90f8b26e69ca04d4bf512bf43dd4.tar.gz
jgit-8b8ad75ada9d90f8b26e69ca04d4bf512bf43dd4.tar.bz2
Fix a complicated multi level nested if block structure to use a single level with multiple returns.refs/changes/67/3467/3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java71
1 files changed, 35 insertions, 36 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 8fe7b2a..8534724 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
@@ -202,43 +202,42 @@ public class URIish implements Serializable {
if (matcher.matches()) {
scheme = matcher.group(1);
path = cleanLeadingSlashes(matcher.group(2), scheme);
- } else {
- matcher = FULL_URI.matcher(s);
- if (matcher.matches()) {
- scheme = matcher.group(1);
- user = matcher.group(2);
- pass = matcher.group(3);
- host = matcher.group(4);
- if (matcher.group(5) != null)
- port = Integer.parseInt(matcher.group(5));
- path = cleanLeadingSlashes(
- n2e(matcher.group(6)) + n2e(matcher.group(7)),
- scheme);
- } else {
- matcher = RELATIVE_SCP_URI.matcher(s);
- if (matcher.matches()) {
- user = matcher.group(1);
- pass = matcher.group(2);
- host = matcher.group(3);
- path = matcher.group(4);
- } else {
- matcher = ABSOLUTE_SCP_URI.matcher(s);
- if (matcher.matches()) {
- user = matcher.group(1);
- pass = matcher.group(2);
- host = matcher.group(3);
- path = matcher.group(4);
- } else {
- matcher = LOCAL_FILE.matcher(s);
- if (matcher.matches()) {
- path = matcher.group(1);
- } else
- throw new URISyntaxException(s,
- JGitText.get().cannotParseGitURIish);
- }
- }
- }
+ return;
+ }
+ matcher = FULL_URI.matcher(s);
+ if (matcher.matches()) {
+ scheme = matcher.group(1);
+ user = matcher.group(2);
+ pass = matcher.group(3);
+ host = matcher.group(4);
+ if (matcher.group(5) != null)
+ port = Integer.parseInt(matcher.group(5));
+ path = cleanLeadingSlashes(
+ n2e(matcher.group(6)) + n2e(matcher.group(7)), scheme);
+ return;
+ }
+ matcher = RELATIVE_SCP_URI.matcher(s);
+ if (matcher.matches()) {
+ user = matcher.group(1);
+ pass = matcher.group(2);
+ host = matcher.group(3);
+ path = matcher.group(4);
+ return;
+ }
+ matcher = ABSOLUTE_SCP_URI.matcher(s);
+ if (matcher.matches()) {
+ user = matcher.group(1);
+ pass = matcher.group(2);
+ host = matcher.group(3);
+ path = matcher.group(4);
+ return;
+ }
+ matcher = LOCAL_FILE.matcher(s);
+ if (matcher.matches()) {
+ path = matcher.group(1);
+ return;
}
+ throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish);
}
private String n2e(String s) {