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 2023/07/08 13:29:34 UTC

[commons-exec] branch master updated: Fix formatting

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 6d679b9  Fix formatting
6d679b9 is described below

commit 6d679b9d31fba64db728de4979ff483c7d1d075f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 8 09:29:30 2023 -0400

    Fix formatting
---
 .../org/apache/commons/exec/InputStreamPumper.java     |  2 +-
 .../java/org/apache/commons/exec/StreamPumper.java     |  2 +-
 .../org/apache/commons/exec/DefaultExecutorTest.java   | 18 +++++++++---------
 .../commons/exec/environment/EnvironmentUtilsTest.java |  6 +++---
 .../org/apache/commons/exec/issues/Exec34Test.java     |  4 ++--
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/apache/commons/exec/InputStreamPumper.java b/src/main/java/org/apache/commons/exec/InputStreamPumper.java
index 5c11434..d172e48 100644
--- a/src/main/java/org/apache/commons/exec/InputStreamPumper.java
+++ b/src/main/java/org/apache/commons/exec/InputStreamPumper.java
@@ -68,7 +68,7 @@ public class InputStreamPumper implements Runnable {
             }
         } catch (final Exception e) {
             final String msg = "Got exception while reading/writing the stream";
-            DebugUtils.handleException(msg ,e);
+            DebugUtils.handleException(msg, e);
         }
     }
 
diff --git a/src/main/java/org/apache/commons/exec/StreamPumper.java b/src/main/java/org/apache/commons/exec/StreamPumper.java
index df839c9..8a4ee16 100644
--- a/src/main/java/org/apache/commons/exec/StreamPumper.java
+++ b/src/main/java/org/apache/commons/exec/StreamPumper.java
@@ -113,7 +113,7 @@ public class StreamPumper implements Runnable {
                     os.close();
                 } catch (final IOException e) {
                     final String msg = "Got exception while closing exhausted output stream";
-                    DebugUtils.handleException(msg ,e);
+                    DebugUtils.handleException(msg, e);
                 }
             }
             synchronized (this) {
diff --git a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
index ad65524..b17e810 100644
--- a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
+++ b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
@@ -706,11 +706,11 @@ public class DefaultExecutorTest {
     @Test
     public void testAddEnvironmentVariables() throws Exception {
         final Map<String, String> myEnvVars = new HashMap<>(EnvironmentUtils.getProcEnvironment());
-        myEnvVars.put("NEW_VAR","NEW_VAL");
+        myEnvVars.put("NEW_VAR", "NEW_VAL");
         exec.execute(new CommandLine(environmentSript), myEnvVars);
         final String environment = baos.toString().trim();
-        assertTrue("Expecting NEW_VAR in "+environment,environment.indexOf("NEW_VAR") >= 0);
-        assertTrue("Expecting NEW_VAL in "+environment,environment.indexOf("NEW_VAL") >= 0);
+        assertTrue("Expecting NEW_VAR in " + environment, environment.indexOf("NEW_VAR") >= 0);
+        assertTrue("Expecting NEW_VAL in " + environment, environment.indexOf("NEW_VAL") >= 0);
     }
 
     @Test
@@ -718,11 +718,11 @@ public class DefaultExecutorTest {
         final Map<String, String> myEnvVars = new HashMap<>(EnvironmentUtils.getProcEnvironment());
         final String name = "NEW_VAR";
         final String value = "NEW_\"_VAL";
-        myEnvVars.put(name,value);
+        myEnvVars.put(name, value);
         exec.execute(new CommandLine(environmentSript), myEnvVars);
         final String environment = baos.toString().trim();
-        assertTrue("Expecting "+name+" in "+environment,environment.indexOf(name) >= 0);
-        assertTrue("Expecting "+value+" in "+environment,environment.indexOf(value) >= 0);
+        assertTrue("Expecting " + name + " in " + environment, environment.indexOf(name) >= 0);
+        assertTrue("Expecting " + value + " in " + environment, environment.indexOf(value) >= 0);
     }
 
     // ======================================================================
@@ -740,18 +740,18 @@ public class DefaultExecutorTest {
     public void _testExecuteStability() throws Exception {
 
         // make a plain-vanilla test
-        for (int i=0; i<100; i++) {
+        for (int i = 0; i < 100; i++) {
             final Map<String, String> env = new HashMap<>();
             env.put("TEST_ENV_VAR", Integer.toString(i));
             final CommandLine cl = new CommandLine(testScript);
-            final int exitValue = exec.execute(cl,env);
+            final int exitValue = exec.execute(cl, env);
             assertFalse(exec.isFailure(exitValue));
             assertEquals("FOO." + i + ".", baos.toString().trim());
             baos.reset();
         }
 
         // now be nasty and use the watchdog to kill out sub-processes
-        for (int i=0; i<100; i++) {
+        for (int i = 0; i < 100; i++) {
             final Map<String, String> env = new HashMap<>();
             env.put("TEST_ENV_VAR", Integer.toString(i));
             final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
diff --git a/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java b/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java
index 2a48f49..d45ef9f 100644
--- a/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java
+++ b/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java
@@ -72,9 +72,9 @@ public class EnvironmentUtilsTest {
         // for this process, i.e. $JAVA_HOME
         assertFalse("Expecting non-zero environment size", procEnvironment.isEmpty());
         final String[] envArgs = EnvironmentUtils.toStrings(procEnvironment);
-        for (int i=0; i<envArgs.length; i++) {
-            assertNotNull("Entry "+i+" should not be null",envArgs[i]);
-            assertFalse("Entry "+i+" should not be empty",envArgs[i].isEmpty());
+        for (int i = 0; i < envArgs.length; i++) {
+            assertNotNull("Entry " + i + " should not be null", envArgs[i]);
+            assertFalse("Entry " + i + " should not be empty", envArgs[i].isEmpty());
             // System.out.println(envArgs[i]);
         }
     }
diff --git a/src/test/java/org/apache/commons/exec/issues/Exec34Test.java b/src/test/java/org/apache/commons/exec/issues/Exec34Test.java
index dbd2f43..1a2c822 100644
--- a/src/test/java/org/apache/commons/exec/issues/Exec34Test.java
+++ b/src/test/java/org/apache/commons/exec/issues/Exec34Test.java
@@ -60,8 +60,8 @@ public class Exec34Test {
         exec.execute(cmdLine, handler);
         assertTrue(watchdog.isWatching());
         watchdog.destroyProcess();
-        assertTrue("Watchdog should have killed the process",watchdog.killedProcess());
-        assertFalse("Watchdog is no longer watching the process",watchdog.isWatching());
+        assertTrue("Watchdog should have killed the process", watchdog.killedProcess());
+        assertFalse("Watchdog is no longer watching the process", watchdog.isWatching());
     }
 
     /**