Minor Improvement: (#34)
* Add final
* Use Standard Charset
diff --git a/src/main/java/org/apache/commons/release/plugin/SharedFunctions.java b/src/main/java/org/apache/commons/release/plugin/SharedFunctions.java
index fb04950..df12e03 100755
--- a/src/main/java/org/apache/commons/release/plugin/SharedFunctions.java
+++ b/src/main/java/org/apache/commons/release/plugin/SharedFunctions.java
@@ -64,7 +64,7 @@
if (workingDirectory.exists()) {
try {
FileUtils.deleteDirectory(workingDirectory);
- } catch (IOException | NullPointerException e) {
+ } catch (final IOException | NullPointerException e) {
final String message = String.format("Unable to remove directory %s: %s", workingDirectory,
e.getMessage());
log.error(message);
@@ -88,7 +88,7 @@
public static void copyFile(final Log log, final File fromFile, final File toFile) throws MojoExecutionException {
try {
FileUtils.copyFile(fromFile, toFile);
- } catch (IOException | NullPointerException e) {
+ } catch (final IOException | NullPointerException e) {
final String message = String.format("Unable to copy file %s tp %s: %s", fromFile, toFile, e.getMessage());
log.error(message);
throw new MojoExecutionException(message, e);
diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
index 265bf5a..9719314 100755
--- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java
@@ -221,7 +221,7 @@
if (!artifact.getFile().getName().toLowerCase(Locale.ROOT).contains("asc")) {
final String artifactKey = getArtifactKey(artifact);
try {
- String digest;
+ final String digest;
// SHA-512
digest = artifactSha512s.getProperty(artifactKey.toString());
getLog().info(artifact.getFile().getName() + " sha512: " + digest);
diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
index a2b4850..8e6095a 100755
--- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -440,7 +441,7 @@
//
// HEADER file
//
- try (Writer headerWriter = new OutputStreamWriter(new FileOutputStream(headerFile), "UTF-8")) {
+ try (Writer headerWriter = new OutputStreamWriter(new FileOutputStream(headerFile), StandardCharsets.UTF_8)) {
HeaderHtmlVelocityDelegate.builder().build().render(headerWriter);
} catch (final IOException e) {
final String message = "Could not build HEADER html file " + headerFile;
@@ -452,7 +453,7 @@
// README file
//
final File readmeFile = new File(distRcVersionDirectory, README_FILE_NAME);
- try (Writer readmeWriter = new OutputStreamWriter(new FileOutputStream(readmeFile), "UTF-8")) {
+ try (Writer readmeWriter = new OutputStreamWriter(new FileOutputStream(readmeFile), StandardCharsets.UTF_8)) {
// @formatter:off
final ReadmeHtmlVelocityDelegate readmeHtmlVelocityDelegate = ReadmeHtmlVelocityDelegate.builder()
.withArtifactId(project.getArtifactId())
diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
index 8110dc5..4b6dbb4 100755
--- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
+++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java
@@ -38,7 +38,7 @@
private static final String COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH = "target/testing-commons-release-plugin";
@Rule
- public MojoRule rule = new MojoRule() {
+ public final MojoRule rule = new MojoRule() {
@Override
protected void before() throws Throwable {
// noop
diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
index 5046562..e9e0423 100755
--- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
+++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
@@ -39,7 +39,7 @@
private static final String COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH = "target/testing-commons-release-plugin";
@Rule
- public MojoRule rule = new MojoRule() {
+ public final MojoRule rule = new MojoRule() {
@Override
protected void before() throws Throwable {
// noop
diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java
index ccdd9a5..a2f1aad 100755
--- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java
+++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojoTest.java
@@ -42,7 +42,7 @@
private static final String COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH = "target/testing-commons-release-plugin";
@Rule
- public MojoRule rule = new MojoRule() {
+ public final MojoRule rule = new MojoRule() {
@Override
protected void before() throws Throwable {
// noop
diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java
index 128db4b..2e7df23 100755
--- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java
+++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsStagingCleanupMojoTest.java
@@ -38,7 +38,7 @@
private static final String COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH = "target/testing-commons-release-plugin";
@Rule
- public MojoRule rule = new MojoRule() {
+ public final MojoRule rule = new MojoRule() {
@Override
protected void before() throws Throwable {
// noop