diff --git a/storm-buildtools/storm-maven-plugins/pom.xml b/storm-buildtools/storm-maven-plugins/pom.xml index c5b1b598638..9a8b9467eef 100644 --- a/storm-buildtools/storm-maven-plugins/pom.xml +++ b/storm-buildtools/storm-maven-plugins/pom.xml @@ -75,7 +75,7 @@ maven-checkstyle-plugin - 11 + 0 diff --git a/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java b/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java index 9eb02986fa8..eb1a3ae8832 100644 --- a/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java +++ b/storm-buildtools/storm-maven-plugins/src/main/java/org/apache/storm/maven/plugin/versioninfo/VersionInfoMojo.java @@ -89,7 +89,7 @@ public static List convertFileSetToFiles(FileSet source) @Override public void execute() throws MojoExecutionException { try { - SCM scm = determineSCM(); + SCM scm = determineScm(); project.getProperties().setProperty(buildTimeProperty, getBuildTime()); project.getProperties().setProperty(scmUriProperty, getSCMUri(scm)); project.getProperties().setProperty(scmBranchProperty, getSCMBranch(scm)); @@ -113,7 +113,7 @@ private String getBuildTime() { * @return SCM in use for this build * @throws Exception if any error occurs attempting to determine SCM */ - private SCM determineSCM() throws Exception { + private SCM determineScm() throws Exception { CommandExec exec = new CommandExec(this); SCM scm = SCM.NONE; scmOut = new ArrayList(); @@ -172,6 +172,7 @@ private String[] getSvnUriInfo(String str) { return res; } + @SuppressWarnings("checkstyle:AbbreviationAsWordInName") private String getSCMUri(SCM scm) { String uri = "Unknown"; switch (scm) { @@ -193,10 +194,14 @@ private String getSCMUri(SCM scm) { } } break; + default: + throw new IllegalArgumentException(String.format("SCM %s is not supported", + scm)); } return uri.trim(); } + @SuppressWarnings("checkstyle:AbbreviationAsWordInName") private String getSCMCommit(SCM scm) { String commit = "Unknown"; switch (scm) { @@ -216,10 +221,14 @@ private String getSCMCommit(SCM scm) { } } break; + default: + throw new IllegalArgumentException(String.format("SCM %s is not supported", + scm)); } return commit.trim(); } + @SuppressWarnings("checkstyle:AbbreviationAsWordInName") private String getSCMBranch(SCM scm) { String branch = "Unknown"; switch (scm) { @@ -240,6 +249,9 @@ private String getSCMBranch(SCM scm) { } } break; + default: + throw new IllegalArgumentException(String.format("SCM %s is not supported", + scm)); } return branch.trim(); } @@ -262,14 +274,6 @@ private byte[] computeMD5(List files) throws IOException, return md5.digest(); } - private String byteArrayToString(byte[] array) { - StringBuilder sb = new StringBuilder(); - for (byte b : array) { - sb.append(Integer.toHexString(0xff & b)); - } - return sb.toString(); - } - private String computeMD5() throws Exception { List files = convertFileSetToFiles(source); // File order of MD5 calculation is significant. Sorting is done on @@ -291,6 +295,15 @@ private String normalizePath(File file) { return md5str; } + private String byteArrayToString(byte[] array) { + StringBuilder sb = new StringBuilder(); + for (byte b : array) { + sb.append(Integer.toHexString(0xff & b)); + } + return sb.toString(); + } + + @SuppressWarnings("checkstyle:AbbreviationAsWordInName") private enum SCM { NONE, SVN, GIT }