Skip to content

Commit 461b8fa

Browse files
committed
Fix some code warnings
1 parent 9d76c8c commit 461b8fa

File tree

5 files changed

+8
-20
lines changed

5 files changed

+8
-20
lines changed

src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -951,16 +951,10 @@ protected void gitFetchRemoteAndCompare(final String branchName)
951951
"--left-right", "--count", branchName + "..."
952952
+ gitFlowConfig.getOrigin() + "/" + branchName);
953953

954-
String[] counts = org.apache.commons.lang3.StringUtils.split(
955-
revlistout, '\t');
956-
if (counts != null && counts.length > 1) {
957-
if (!"0".equals(org.apache.commons.lang3.StringUtils
958-
.deleteWhitespace(counts[1]))) {
959-
throw new MojoFailureException("Remote branch '"
960-
+ gitFlowConfig.getOrigin() + "/" + branchName
961-
+ "' is ahead of the local branch '" + branchName
962-
+ "'. Execute git pull.");
963-
}
954+
String[] counts = org.apache.commons.lang3.StringUtils.split(revlistout, '\t');
955+
if (counts != null && counts.length > 1 && !"0".equals(org.apache.commons.lang3.StringUtils.deleteWhitespace(counts[1]))) {
956+
throw new MojoFailureException("Remote branch '" + gitFlowConfig.getOrigin() + "/" + branchName
957+
+ "' is ahead of the local branch '" + branchName + "'. Execute git pull.");
964958
}
965959
}
966960
}

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowFeatureStartMojo.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
155155
gitPush(gitFlowConfig.getFeatureBranchPrefix()
156156
+ featureBranchName, false);
157157
}
158-
} catch (CommandLineException e) {
159-
throw new MojoFailureException("feature-start", e);
160-
} catch (VersionParseException e) {
158+
} catch (CommandLineException | VersionParseException e) {
161159
throw new MojoFailureException("feature-start", e);
162160
}
163161
}

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowHotfixStartMojo.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
257257
if (pushRemote) {
258258
gitPush(hotfixBranchName, false);
259259
}
260-
} catch (CommandLineException e) {
261-
throw new MojoFailureException("hotfix-start", e);
262-
} catch (VersionParseException e) {
260+
} catch (CommandLineException | VersionParseException e) {
263261
throw new MojoFailureException("hotfix-start", e);
264262
}
265263
}

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowReleaseStartMojo.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
254254

255255
gitPush(fullBranchName, false);
256256
}
257-
} catch (CommandLineException e) {
258-
throw new MojoFailureException("release-start", e);
259-
} catch (VersionParseException e) {
257+
} catch (CommandLineException | VersionParseException e) {
260258
throw new MojoFailureException("release-start", e);
261259
}
262260
}

src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private String nextVersion(final Integer index, boolean snapshot) {
9797
if (digits != null) {
9898
if (index != null && index >= 0 && index < digits.size()) {
9999
int origDigitsLength = joinDigitString(digits).length();
100-
digits.set(index, incrementVersionString((String) digits.get(index)));
100+
digits.set(index, incrementVersionString(digits.get(index)));
101101
for (int i = index + 1; i < digits.size(); i++) {
102102
digits.set(i, "0");
103103
}

0 commit comments

Comments
 (0)