This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-exec.git
commit 755c8c472c0452fc07d982a025f2b9c9e2c35cb4 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat May 24 08:08:54 2025 -0400 Fix Checkstyle issues Redundant 'final' modifier --- pom.xml | 1 + .../java/org/apache/commons/exec/Executor.java | 6 +++--- .../org/apache/commons/exec/LogOutputStream.java | 2 +- .../commons/exec/ShutdownHookProcessDestroyer.java | 2 +- .../commons/exec/launcher/CommandLauncher.java | 8 ++++---- .../commons/exec/launcher/CommandLauncherImpl.java | 2 +- .../exec/launcher/WinNTCommandLauncher.java | 22 +++++++++++----------- .../java/org/apache/commons/exec/TutorialTest.java | 4 ++-- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index 8063f901..c6fe3d86 100644 --- a/pom.xml +++ b/pom.xml @@ -102,6 +102,7 @@ limitations under the License. <configLocation>${basedir}/src/conf/checkstyle.xml</configLocation> <enableRulesSummary>false</enableRulesSummary> <includeTestSourceDirectory>true</includeTestSourceDirectory> + <consoleOutput>true</consoleOutput> </configuration> </plugin> <plugin> diff --git a/src/main/java/org/apache/commons/exec/Executor.java b/src/main/java/org/apache/commons/exec/Executor.java index a3beeb2a..894bc9a4 100644 --- a/src/main/java/org/apache/commons/exec/Executor.java +++ b/src/main/java/org/apache/commons/exec/Executor.java @@ -137,7 +137,7 @@ public interface Executor { * @param exitValue the exit value (return code) to be checked. * @return {@code true} if {@code exitValue} signals a failure. */ - boolean isFailure(final int exitValue); + boolean isFailure(int exitValue); /** * Sets the {@code exitValue} of the process to be considered successful. If a different exit value is returned by the process then @@ -145,7 +145,7 @@ public interface Executor { * * @param value the exit code representing successful execution. */ - void setExitValue(final int value); + void setExitValue(int value); /** * Sets a list of {@code exitValue} of the process to be considered successful. The caller can pass one of the following values. @@ -160,7 +160,7 @@ public interface Executor { * * @param values a list of the exit codes. */ - void setExitValues(final int[] values); + void setExitValues(int[] values); /** * Sets the handler for cleanup of started processes if the main process is going to terminate. diff --git a/src/main/java/org/apache/commons/exec/LogOutputStream.java b/src/main/java/org/apache/commons/exec/LogOutputStream.java index d3e7b823..3ab84d98 100644 --- a/src/main/java/org/apache/commons/exec/LogOutputStream.java +++ b/src/main/java/org/apache/commons/exec/LogOutputStream.java @@ -140,7 +140,7 @@ public abstract class LogOutputStream extends OutputStream { * @param line the line to log. * @param logLevel the log level to use */ - protected abstract void processLine(final String line, final int logLevel); + protected abstract void processLine(String line, int logLevel); /** * Writes a block of characters to the output stream. diff --git a/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java b/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java index 2d968089..b218c45c 100644 --- a/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java +++ b/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java @@ -29,7 +29,7 @@ public class ShutdownHookProcessDestroyer implements ProcessDestroyer, Runnable private AtomicBoolean shouldDestroy = new AtomicBoolean(true); - public ProcessDestroyerThread() { + private ProcessDestroyerThread() { super("ProcessDestroyer Shutdown Hook"); } diff --git a/src/main/java/org/apache/commons/exec/launcher/CommandLauncher.java b/src/main/java/org/apache/commons/exec/launcher/CommandLauncher.java index 603f82d4..d95995d4 100644 --- a/src/main/java/org/apache/commons/exec/launcher/CommandLauncher.java +++ b/src/main/java/org/apache/commons/exec/launcher/CommandLauncher.java @@ -37,7 +37,7 @@ public interface CommandLauncher { * @return the newly created process. * @throws IOException if attempting to run a command in a specific directory. */ - Process exec(final CommandLine commandLine, final Map<String, String> env) throws IOException; + Process exec(CommandLine commandLine, Map<String, String> env) throws IOException; /** * Executes the given command in a new process, in the given working directory. @@ -48,7 +48,7 @@ public interface CommandLauncher { * @return the newly created process. * @throws IOException if trying to change directory. */ - Process exec(final CommandLine commandLine, final Map<String, String> env, final File workingDirectory) throws IOException; + Process exec(CommandLine commandLine, Map<String, String> env, File workingDirectory) throws IOException; /** * Executes the given command in a new process, in the given working directory. @@ -60,7 +60,7 @@ public interface CommandLauncher { * @throws IOException if trying to change directory. * @since 1.5.0 */ - default Process exec(final CommandLine commandLine, final Map<String, String> env, final Path workingDirectory) throws IOException { + default Process exec(CommandLine commandLine, Map<String, String> env, Path workingDirectory) throws IOException { return exec(commandLine, env, workingDirectory != null ? workingDirectory.toFile() : null); } @@ -75,5 +75,5 @@ public interface CommandLauncher { * @param exitValue the exit value (return code) to be checked. * @return {@code true} if {@code exitValue} signals a failure. */ - boolean isFailure(final int exitValue); + boolean isFailure(int exitValue); } diff --git a/src/main/java/org/apache/commons/exec/launcher/CommandLauncherImpl.java b/src/main/java/org/apache/commons/exec/launcher/CommandLauncherImpl.java index d9c1147e..221f453a 100644 --- a/src/main/java/org/apache/commons/exec/launcher/CommandLauncherImpl.java +++ b/src/main/java/org/apache/commons/exec/launcher/CommandLauncherImpl.java @@ -43,7 +43,7 @@ public abstract class CommandLauncherImpl implements CommandLauncher { } @Override - public abstract Process exec(final CommandLine cmd, final Map<String, String> env, final File workingDir) throws IOException; + public abstract Process exec(CommandLine cmd, Map<String, String> env, File workingDir) throws IOException; /** @see org.apache.commons.exec.launcher.CommandLauncher#isFailure(int) */ @Override diff --git a/src/main/java/org/apache/commons/exec/launcher/WinNTCommandLauncher.java b/src/main/java/org/apache/commons/exec/launcher/WinNTCommandLauncher.java index 06091dfa..172f1ba6 100644 --- a/src/main/java/org/apache/commons/exec/launcher/WinNTCommandLauncher.java +++ b/src/main/java/org/apache/commons/exec/launcher/WinNTCommandLauncher.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.commons.exec.launcher; diff --git a/src/test/java/org/apache/commons/exec/TutorialTest.java b/src/test/java/org/apache/commons/exec/TutorialTest.java index 6eeb2eff..a67532fc 100644 --- a/src/test/java/org/apache/commons/exec/TutorialTest.java +++ b/src/test/java/org/apache/commons/exec/TutorialTest.java @@ -42,11 +42,11 @@ public class TutorialTest { private ExecuteWatchdog watchdog; - public PrintResultHandler(final ExecuteWatchdog watchdog) { + private PrintResultHandler(final ExecuteWatchdog watchdog) { this.watchdog = watchdog; } - public PrintResultHandler(final int exitValue) { + private PrintResultHandler(final int exitValue) { super.onProcessComplete(exitValue); }