You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/21 17:56:37 UTC
[commons-exec] branch master updated: Use final.
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
The following commit(s) were added to refs/heads/master by this push:
new bc2bf73 Use final.
bc2bf73 is described below
commit bc2bf739f40b3ee8dccc49cb82e6f436f9eae77d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 21 12:56:32 2020 -0500
Use final.
---
src/main/java/org/apache/commons/exec/DefaultExecutor.java | 2 +-
src/main/java/org/apache/commons/exec/ExecuteWatchdog.java | 2 +-
src/main/java/org/apache/commons/exec/OS.java | 2 +-
.../java/org/apache/commons/exec/AbstractExecTest.java | 4 ++--
.../java/org/apache/commons/exec/DefaultExecutorTest.java | 2 +-
.../java/org/apache/commons/exec/issues/Exec62Test.java | 14 +++++++-------
.../java/org/apache/commons/exec/issues/Exec65Test.java | 2 +-
7 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/commons/exec/DefaultExecutor.java b/src/main/java/org/apache/commons/exec/DefaultExecutor.java
index 63507bc..2cc7264 100644
--- a/src/main/java/org/apache/commons/exec/DefaultExecutor.java
+++ b/src/main/java/org/apache/commons/exec/DefaultExecutor.java
@@ -408,7 +408,7 @@ public class DefaultExecutor implements Executor {
throw e;
} catch (final Exception e) {
// Java 1.5 does not support public IOException(String message, Throwable cause)
- IOException ioe = new IOException(e.getMessage());
+ final IOException ioe = new IOException(e.getMessage());
ioe.initCause(e);
throw ioe;
}
diff --git a/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java b/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
index 35701c4..6958189 100644
--- a/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
+++ b/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
@@ -127,7 +127,7 @@ public class ExecuteWatchdog implements TimeoutObserver {
* @param e the offending exception
*
*/
- public synchronized void failedToStart(Exception e) {
+ public synchronized void failedToStart(final Exception e) {
this.processStarted = true;
this.caught = e;
this.notifyAll();
diff --git a/src/main/java/org/apache/commons/exec/OS.java b/src/main/java/org/apache/commons/exec/OS.java
index 4ea0539..466df33 100644
--- a/src/main/java/org/apache/commons/exec/OS.java
+++ b/src/main/java/org/apache/commons/exec/OS.java
@@ -203,7 +203,7 @@ public final class OS {
if (family != null) {
//windows probing logic relies on the word 'windows' in
//the OS
- boolean isWindows = OS_NAME.contains(FAMILY_WINDOWS);
+ final boolean isWindows = OS_NAME.contains(FAMILY_WINDOWS);
boolean is9x = false;
boolean isNT = false;
if (isWindows) {
diff --git a/src/test/java/org/apache/commons/exec/AbstractExecTest.java b/src/test/java/org/apache/commons/exec/AbstractExecTest.java
index d32bd95..902c02a 100644
--- a/src/test/java/org/apache/commons/exec/AbstractExecTest.java
+++ b/src/test/java/org/apache/commons/exec/AbstractExecTest.java
@@ -36,7 +36,7 @@ public abstract class AbstractExecTest {
/**
* Resolve the OS-specific test file to execute.
*/
- protected File resolveTestScript(String baseName) {
+ protected File resolveTestScript(final String baseName) {
final File result = TestUtil.resolveScriptForOS(testDir + "/" + baseName);
if (!result.exists()) {
throw new IllegalArgumentException("Unable to find the following file: " + result.getAbsolutePath());
@@ -47,7 +47,7 @@ public abstract class AbstractExecTest {
/**
* Resolve the OS-specific test file to execute.
*/
- protected File resolveTestScript(String directoryName, String baseName) {
+ protected File resolveTestScript(final String directoryName, final String baseName) {
final File result = TestUtil.resolveScriptForOS(testDir + "/" + directoryName + "/" + baseName);
if (!result.exists()) {
throw new IllegalArgumentException("Unable to find the following file: " + result.getAbsolutePath());
diff --git a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
index 2c1b74e..787393f 100644
--- a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
+++ b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
@@ -411,7 +411,7 @@ public class DefaultExecutorTest {
final CommandLine cl = new CommandLine(nonExistingTestScript);
final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler() {
@Override
- public void onProcessFailed(ExecuteException e) {
+ public void onProcessFailed(final ExecuteException e) {
System.out.println("Process did not stop gracefully, had exception '" + e.getMessage() + "' while executing process");
super.onProcessFailed(e);
}
diff --git a/src/test/java/org/apache/commons/exec/issues/Exec62Test.java b/src/test/java/org/apache/commons/exec/issues/Exec62Test.java
index 1f872f5..daa4ae1 100644
--- a/src/test/java/org/apache/commons/exec/issues/Exec62Test.java
+++ b/src/test/java/org/apache/commons/exec/issues/Exec62Test.java
@@ -52,19 +52,19 @@ public class Exec62Test
}
}
- private void execute (String scriptName) throws Exception {
- ExecuteWatchdog watchdog = new ExecuteWatchdog(4000);
- CommandLine commandLine = new CommandLine("/bin/sh");
- File testScript = TestUtil.resolveScriptForOS("./src/test/scripts/issues/" + scriptName);
+ private void execute (final String scriptName) throws Exception {
+ final ExecuteWatchdog watchdog = new ExecuteWatchdog(4000);
+ final CommandLine commandLine = new CommandLine("/bin/sh");
+ final File testScript = TestUtil.resolveScriptForOS("./src/test/scripts/issues/" + scriptName);
commandLine.addArgument(testScript.getAbsolutePath());
- DefaultExecutor executor = new DefaultExecutor();
+ final DefaultExecutor executor = new DefaultExecutor();
executor.setExitValues(null); // ignore exit values
executor.setWatchdog(watchdog);
- FileOutputStream fos = new FileOutputStream(outputFile);
- PumpStreamHandler streamHandler = new PumpStreamHandler(fos);
+ final FileOutputStream fos = new FileOutputStream(outputFile);
+ final PumpStreamHandler streamHandler = new PumpStreamHandler(fos);
executor.setStreamHandler(streamHandler);
executor.execute(commandLine);
diff --git a/src/test/java/org/apache/commons/exec/issues/Exec65Test.java b/src/test/java/org/apache/commons/exec/issues/Exec65Test.java
index 4b6301d..33cf63c 100644
--- a/src/test/java/org/apache/commons/exec/issues/Exec65Test.java
+++ b/src/test/java/org/apache/commons/exec/issues/Exec65Test.java
@@ -87,7 +87,7 @@ public class Exec65Test extends AbstractExecTest {
@Test(timeout = TEST_TIMEOUT)
public void testExec65WithSleepUsingShellScriptAndJDKOnly() throws Exception {
- Process process = Runtime.getRuntime().exec(resolveTestScript("sleep").getAbsolutePath());
+ final Process process = Runtime.getRuntime().exec(resolveTestScript("sleep").getAbsolutePath());
Thread.sleep(WATCHDOG_TIMEOUT);
process.destroy();