Remove unnecessarily nested else clauses
Change-Id: I281d139b00325419362bc4011462676f25a15a11
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java b/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
index 75256b2..faca388 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
@@ -22,21 +22,20 @@
|| !Character.isDigit(gerritVersion.trim().charAt(0))
|| gerritVersion.startsWith(GERRIT_NEXT_VERSION)) {
return "master";
- } else {
- String[] versionNumbers = gerritVersion.split("\\.");
+ }
+ String[] versionNumbers = gerritVersion.split("\\.");
- if (versionNumbers.length > 2) {
- String fixVersionNumber = versionNumbers[2];
- if (fixVersionNumber.contains("-")) {
- String nextVersion =
- String.format("%s.%d", versionNumbers[0],
- Integer.parseInt(versionNumbers[1]) + 1);
- if (nextVersion.equals(GERRIT_NEXT_VERSION)) {
- return "master";
- }
+ if (versionNumbers.length > 2) {
+ String fixVersionNumber = versionNumbers[2];
+ if (fixVersionNumber.contains("-")) {
+ String nextVersion =
+ String.format("%s.%d", versionNumbers[0],
+ Integer.parseInt(versionNumbers[1]) + 1);
+ if (nextVersion.equals(GERRIT_NEXT_VERSION)) {
+ return "master";
}
}
- return "stable-" + versionNumbers[0] + "." + versionNumbers[1];
}
+ return "stable-" + versionNumbers[0] + "." + versionNumbers[1];
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java b/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java
index 7766796..ff0b96b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java
@@ -51,9 +51,8 @@
if (jsonElem != null && jsonElem.getAsJsonObject().get(fieldName) != null) {
return Optional.of(SmartJson
.of(jsonElem.getAsJsonObject().get(fieldName)));
- } else {
- return Optional.absent();
}
+ return Optional.absent();
}
public SmartJson get(String fieldName) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java b/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
index 5655b19..7ba1518 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
@@ -81,10 +81,9 @@
pluginAttributes.getValue("Gerrit-PluginName"),
pluginAttributes.getValue("Implementation-Version"), "",
pluginUrl.toString());
- } else {
- return new PluginInfo(entryName.getFileName().toString(), "", "",
- pluginUrl.toString());
}
+ return new PluginInfo(entryName.getFileName().toString(), "", "",
+ pluginUrl.toString());
} catch (IOException e) {
log.error("Unable to open plugin " + pluginUrl, e);
return null;