aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.server
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2019-10-17 09:01:25 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2019-10-17 10:20:14 +0900
commit98cdca9b5a830f1c2ceca52379d662a68109d43e (patch)
treed843141173394b4ea4e435553885749096d4fb79 /org.eclipse.jgit.http.server
parent762f6212b4692b28f098ac597058bd6a489b8b49 (diff)
downloadjgit-98cdca9b5a830f1c2ceca52379d662a68109d43e.tar.gz
jgit-98cdca9b5a830f1c2ceca52379d662a68109d43e.zip
Enable and fix "Statement unnecessarily nested within else clause" warnings
Since [1] the gerrit project includes jgit as a submodule, and has this warning enabled, resulting in 100s of warnings in the console. Also enable the warning here, and fix them. At the same time, add missing braces around adjacent and nearby one-line blocks. [1] https://gerrit-review.googlesource.com/c/gerrit/+/227897 Change-Id: I81df3fc7ed6eedf6874ce1a3bedfa727a1897e4c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.http.server')
-rw-r--r--org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java6
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java3
3 files changed, 5 insertions, 6 deletions
diff --git a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
index 94a1c4f10b..4335e66bf0 100644
--- a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
index f16749775f..574e94a892 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
@@ -86,10 +86,10 @@ abstract class ServletBinderImpl implements ServletBinder {
* @return the configured servlet, or singleton returning 404 if none.
*/
protected HttpServlet getServlet() {
- if (httpServlet != null)
+ if (httpServlet != null) {
return httpServlet;
- else
- return new ErrorServlet(HttpServletResponse.SC_NOT_FOUND);
+ }
+ return new ErrorServlet(HttpServletResponse.SC_NOT_FOUND);
}
/**
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java
index a69fab0afd..b9e6882556 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java
@@ -83,8 +83,7 @@ public class DefaultUploadPackFactory implements
up.setExtraParameters(Arrays.asList(params));
}
return up;
- } else {
- throw new ServiceNotEnabledException();
}
+ throw new ServiceNotEnabledException();
}
}