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 2013/12/28 15:35:42 UTC
svn commit: r1553840 - in /commons/proper/exec/trunk/src:
main/java/org/apache/commons/exec/
main/java/org/apache/commons/exec/environment/
main/java/org/apache/commons/exec/launcher/
main/java/org/apache/commons/exec/util/ test/java/org/apache/commons...
Author: ggregory
Date: Sat Dec 28 14:35:41 2013
New Revision: 1553840
URL: http://svn.apache.org/r1553840
Log:
Fix some funky formating.
Modified:
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecuteResultHandler.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/DefaultProcessingEnvironment.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/VmsCommandLauncher.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/DebugUtils.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/StandAloneTest.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestRunner.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtil.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtilTest.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TutorialTest.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/util/StringUtilTest.java
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/CommandLine.java Sat Dec 28 14:35:41 2013
@@ -122,11 +122,11 @@ public class CommandLine {
this.isFile = other.isFile();
this.arguments.addAll(other.arguments);
- if(other.getSubstitutionMap() != null)
+ if (other.getSubstitutionMap() != null)
{
this.substitutionMap = new HashMap();
final Iterator iterator = other.substitutionMap.keySet().iterator();
- while(iterator.hasNext())
+ while (iterator.hasNext())
{
final Object key = iterator.next();
this.substitutionMap.put(key, other.getSubstitutionMap().get(key));
@@ -259,7 +259,7 @@ public class CommandLine {
String expandedArgument;
final String[] result = new String[arguments.size()];
- for(int i=0; i<result.length; i++) {
+ for (int i=0; i<result.length; i++) {
currArgument = (Argument) arguments.get(i);
expandedArgument = expandArgument(currArgument.getValue());
result[i] = currArgument.isHandleQuoting() ? StringUtils.quoteArgument(expandedArgument) : expandedArgument;
@@ -407,7 +407,7 @@ public class CommandLine {
private String getExecutable(final String executable) {
if (executable == null) {
throw new IllegalArgumentException("Executable can not be null");
- } else if(executable.trim().length() == 0) {
+ } else if (executable.trim().length() == 0) {
throw new IllegalArgumentException("Executable can not be empty");
} else {
return StringUtils.fixFileSeparatorChar(executable);
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecuteResultHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecuteResultHandler.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecuteResultHandler.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecuteResultHandler.java Sat Dec 28 14:35:41 2013
@@ -70,7 +70,7 @@ public class DefaultExecuteResultHandler
*/
public ExecuteException getException() {
- if(!hasResult) {
+ if (!hasResult) {
throw new IllegalStateException("The process has not exited yet therefore no result is available ...");
}
@@ -85,7 +85,7 @@ public class DefaultExecuteResultHandler
*/
public int getExitValue() {
- if(!hasResult) {
+ if (!hasResult) {
throw new IllegalStateException("The process has not exited yet therefore no result is available ...");
}
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/DefaultExecutor.java Sat Dec 28 14:35:41 2013
@@ -199,7 +199,7 @@ public class DefaultExecutor implements
handler.onProcessComplete(exitValue);
} catch (final ExecuteException e) {
handler.onProcessFailed(e);
- } catch(final Exception e) {
+ } catch (final Exception e) {
handler.onProcessFailed(new ExecuteException("Execution failed", exitValue, e));
}
}
@@ -223,15 +223,15 @@ public class DefaultExecutor implements
/** @see org.apache.commons.exec.Executor#isFailure(int) */
public boolean isFailure(final int exitValue) {
- if(this.exitValues == null) {
+ if (this.exitValues == null) {
return false;
}
- else if(this.exitValues.length == 0) {
+ else if (this.exitValues.length == 0) {
return this.launcher.isFailure(exitValue);
}
else {
- for(int i=0; i<this.exitValues.length; i++) {
- if(this.exitValues[i] == exitValue) {
+ for (int i=0; i<this.exitValues.length; i++) {
+ if (this.exitValues[i] == exitValue) {
return false;
}
}
@@ -296,21 +296,21 @@ public class DefaultExecutor implements
try {
process.getInputStream().close();
}
- catch(final IOException e) {
+ catch (final IOException e) {
setExceptionCaught(e);
}
try {
process.getOutputStream().close();
}
- catch(final IOException e) {
+ catch (final IOException e) {
setExceptionCaught(e);
}
try {
process.getErrorStream().close();
}
- catch(final IOException e) {
+ catch (final IOException e) {
setExceptionCaught(e);
}
}
@@ -347,7 +347,7 @@ public class DefaultExecutor implements
try {
// add the process to the list of those to destroy if the VM exits
- if(this.getProcessDestroyer() != null) {
+ if (this.getProcessDestroyer() != null) {
this.getProcessDestroyer().add(process);
}
@@ -378,13 +378,13 @@ public class DefaultExecutor implements
try {
streams.stop();
}
- catch(final IOException e) {
+ catch (final IOException e) {
setExceptionCaught(e);
}
closeProcessStreams(process);
- if(getExceptionCaught() != null) {
+ if (getExceptionCaught() != null) {
throw getExceptionCaught();
}
@@ -398,14 +398,14 @@ public class DefaultExecutor implements
}
}
- if(this.isFailure(exitValue)) {
+ if (this.isFailure(exitValue)) {
throw new ExecuteException("Process exited with an error: " + exitValue, exitValue);
}
return exitValue;
} finally {
// remove the process to the list of those to destroy if the VM exits
- if(this.getProcessDestroyer() != null) {
+ if (this.getProcessDestroyer() != null) {
this.getProcessDestroyer().remove(process);
}
}
@@ -417,7 +417,7 @@ public class DefaultExecutor implements
* @param e the IOException
*/
private void setExceptionCaught(final IOException e) {
- if(this.exceptionCaught == null) {
+ if (this.exceptionCaught == null) {
this.exceptionCaught = e;
}
}
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java Sat Dec 28 14:35:41 2013
@@ -83,7 +83,7 @@ public class ExecuteWatchdog implements
this.watch = false;
this.hasWatchdog = timeout != INFINITE_TIMEOUT;
this.processStarted = false;
- if(this.hasWatchdog) {
+ if (this.hasWatchdog) {
this.watchdog = new Watchdog(timeout);
this.watchdog.addTimeoutObserver(this);
}
@@ -114,7 +114,7 @@ public class ExecuteWatchdog implements
this.process = process;
this.processStarted = true;
this.notifyAll();
- if(this.hasWatchdog) {
+ if (this.hasWatchdog) {
watchdog.start();
}
}
@@ -124,7 +124,7 @@ public class ExecuteWatchdog implements
* object.
*/
public synchronized void stop() {
- if(hasWatchdog) {
+ if (hasWatchdog) {
watchdog.stop();
}
watch = false;
@@ -148,7 +148,7 @@ public class ExecuteWatchdog implements
try {
// We must check if the process was not stopped
// before being here
- if(process != null) {
+ if (process != null) {
process.exitValue();
}
} catch (final IllegalThreadStateException itse) {
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java Sat Dec 28 14:35:41 2013
@@ -197,7 +197,7 @@ public class PumpStreamHandler implement
}
}
- if(caught != null) {
+ if (caught != null) {
throw caught;
}
}
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/DefaultProcessingEnvironment.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/DefaultProcessingEnvironment.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/DefaultProcessingEnvironment.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/environment/DefaultProcessingEnvironment.java Sat Dec 28 14:35:41 2013
@@ -58,7 +58,7 @@ public class DefaultProcessingEnvironmen
*/
public synchronized Map getProcEnvironment() throws IOException {
- if(procEnvironment == null) {
+ if (procEnvironment == null) {
procEnvironment = this.createProcEnvironment();
}
@@ -183,7 +183,7 @@ public class DefaultProcessingEnvironmen
executable = null;
}
CommandLine commandLine = null;
- if(executable != null) {
+ if (executable != null) {
commandLine = new CommandLine(executable);
commandLine.addArguments(arguments);
}
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/VmsCommandLauncher.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/VmsCommandLauncher.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/VmsCommandLauncher.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/launcher/VmsCommandLauncher.java Sat Dec 28 14:35:41 2013
@@ -119,7 +119,7 @@ public class VmsCommandLauncher extends
out.print(":[");
out.print(parts[1]); // top level directory
final int lastPart = parts.length-1;
- for(int i=2; i< lastPart; i++) {
+ for (int i=2; i< lastPart; i++) {
out.print(".");
out.print(parts[i]);
}
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/DebugUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/DebugUtils.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/DebugUtils.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/DebugUtils.java Sat Dec 28 14:35:41 2013
@@ -48,13 +48,13 @@ public class DebugUtils
*/
public static void handleException(final String msg, final Exception e) {
- if(isDebugEnabled()) {
+ if (isDebugEnabled()) {
System.err.println(msg);
e.printStackTrace();
}
- if(!isLenientEnabled()) {
- if(e instanceof RuntimeException) {
+ if (!isLenientEnabled()) {
+ if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
// can't pass root cause since the constructor is not available on JDK 1.3
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/MapUtils.java Sat Dec 28 14:35:41 2013
@@ -39,7 +39,7 @@ public class MapUtils
*/
public static Map copy(final Map source) {
- if(source == null) {
+ if (source == null) {
return null;
}
@@ -59,7 +59,7 @@ public class MapUtils
*/
public static Map prefix(final Map source, final String prefix) {
- if(source == null) {
+ if (source == null) {
return null;
}
@@ -67,7 +67,7 @@ public class MapUtils
final Iterator iter = source.entrySet().iterator();
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
final Map.Entry entry = (Map.Entry) iter.next();
final Object key = entry.getKey();
final Object value = entry.getValue();
@@ -89,10 +89,10 @@ public class MapUtils
Map result = null;
- if(lhs == null || lhs.size() == 0) {
+ if (lhs == null || lhs.size() == 0) {
result = copy(rhs);
}
- else if(rhs == null || rhs.size() == 0) {
+ else if (rhs == null || rhs.size() == 0) {
result = copy(lhs);
}
else {
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java Sat Dec 28 14:35:41 2013
@@ -103,7 +103,7 @@ public class StringUtils {
String value;
final Object temp = vars.get(nameBuf.toString());
- if(temp instanceof File) {
+ if (temp instanceof File) {
// for a file we have to fix the separator chars to allow
// cross-platform compatibility
value = fixFileSeparatorChar(((File) temp).getAbsolutePath());
@@ -219,11 +219,11 @@ public class StringUtils {
String cleanedArgument = argument.trim();
// strip the quotes from both ends
- while(cleanedArgument.startsWith(SINGLE_QUOTE) || cleanedArgument.startsWith(DOUBLE_QUOTE)) {
+ while (cleanedArgument.startsWith(SINGLE_QUOTE) || cleanedArgument.startsWith(DOUBLE_QUOTE)) {
cleanedArgument = cleanedArgument.substring(1);
}
- while(cleanedArgument.endsWith(SINGLE_QUOTE) || cleanedArgument.endsWith(DOUBLE_QUOTE)) {
+ while (cleanedArgument.endsWith(SINGLE_QUOTE) || cleanedArgument.endsWith(DOUBLE_QUOTE)) {
cleanedArgument = cleanedArgument.substring(0, cleanedArgument.length() - 1);
}
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java Sat Dec 28 14:35:41 2013
@@ -76,7 +76,7 @@ public class DefaultExecutorTest extends
// delete the marker file
this.foreverOutputFile.getParentFile().mkdirs();
- if(this.foreverOutputFile.exists()) {
+ if (this.foreverOutputFile.exists()) {
this.foreverOutputFile.delete();
}
@@ -127,7 +127,7 @@ public class DefaultExecutorTest extends
exec.execute(cl);
fail("Expected exception due to invalid working directory");
}
- catch(final IOException e) {
+ catch (final IOException e) {
return;
}
}
@@ -138,7 +138,7 @@ public class DefaultExecutorTest extends
try{
exec.execute(cl);
fail("Must throw ExecuteException");
- } catch(final ExecuteException e) {
+ } catch (final ExecuteException e) {
assertTrue(exec.isFailure(e.getExitValue()));
}
}
@@ -289,7 +289,7 @@ public class DefaultExecutorTest extends
&& nrOfInvocations <= 11);
return;
}
- catch(final Throwable t) {
+ catch (final Throwable t) {
fail(t.getMessage());
}
@@ -409,7 +409,7 @@ public class DefaultExecutorTest extends
try{
exec.execute(cl);
fail("Must throw ExecuteException");
- } catch(final ExecuteException e) {
+ } catch (final ExecuteException e) {
assertTrue(exec.isFailure(e.getExitValue()));
return;
}
@@ -730,7 +730,7 @@ public class DefaultExecutorTest extends
*/
public void testExec36_1() throws Exception {
- if(OS.isFamilyUnix()) {
+ if (OS.isFamilyUnix()) {
CommandLine cmdl;
@@ -782,12 +782,12 @@ public class DefaultExecutorTest extends
// the original command line
// dotnetfx.exe /q:a /c:"install.exe /l ""\Documents and Settings\myusername\Local Settings\Temp\netfx.log"" /q"
- if(OS.isFamilyWindows()) {
+ if (OS.isFamilyWindows()) {
expected = "dotnetfx.exe\n" +
"/q:a\n" +
"/c:\"install.exe /l \"\"\\Documents and Settings\\myusername\\Local Settings\\Temp\\netfx.log\"\" /q\"";
}
- else if(OS.isFamilyUnix()) {
+ else if (OS.isFamilyUnix()) {
expected = "dotnetfx.exe\n" +
"/q:a\n" +
"/c:\"install.exe /l \"\"/Documents and Settings/myusername/Local Settings/Temp/netfx.log\"\" /q\"";
@@ -812,7 +812,7 @@ public class DefaultExecutorTest extends
final String result = baos.toString().trim();
assertFalse(exec.isFailure(exitValue));
- if(OS.isFamilyUnix()) {
+ if (OS.isFamilyUnix()) {
// the parameters fall literally apart under Windows - need to disable the check for Win32
assertEquals(expected, result);
}
@@ -962,7 +962,7 @@ public class DefaultExecutorTest extends
*/
public void testExec49_1() throws Exception {
- if(OS.isFamilyUnix()) {
+ if (OS.isFamilyUnix()) {
final CommandLine cl = CommandLine.parse("/bin/ls");
cl.addArgument("/opt");
@@ -1004,7 +1004,7 @@ public class DefaultExecutorTest extends
*/
public void testExec49_2() throws Exception {
- if(OS.isFamilyUnix()) {
+ if (OS.isFamilyUnix()) {
final CommandLine cl = CommandLine.parse("/bin/ls");
cl.addArgument("/opt");
@@ -1047,7 +1047,7 @@ public class DefaultExecutorTest extends
*/
public void testExec_57() throws IOException {
- if(!OS.isFamilyUnix()) {
+ if (!OS.isFamilyUnix()) {
System.err.println("The test 'testSyncInvocationOfBackgroundProcess' does not support the following OS : " + System.getProperty("os.name"));
return;
}
@@ -1068,7 +1068,7 @@ public class DefaultExecutorTest extends
try {
executor.execute(cmdLine);
}
- catch(final ExecuteException e) {
+ catch (final ExecuteException e) {
final long duration = System.currentTimeMillis() - startTime;
System.out.println("Process completed in " + duration +" millis; above is its output");
return;
@@ -1107,7 +1107,7 @@ public class DefaultExecutorTest extends
exec.execute(cmdLine);
processTerminatedCounter++;
// System.out.println(offset + ": process has terminated: " + watchdog.killedProcess());
- if(processTerminatedCounter > 5) {
+ if (processTerminatedCounter > 5) {
break;
}
} catch (final ExecuteException ex) {
@@ -1138,7 +1138,7 @@ public class DefaultExecutorTest extends
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 env = new HashMap();
env.put("TEST_ENV_VAR", new Integer(i));
final CommandLine cl = new CommandLine(testScript);
@@ -1149,7 +1149,7 @@ public class DefaultExecutorTest extends
}
// 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 env = new HashMap();
env.put("TEST_ENV_VAR", new Integer(i));
final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
@@ -1189,8 +1189,8 @@ public class DefaultExecutorTest extends
int result = 0;
- for(int i=0; i<data.length(); i++) {
- if(data.charAt(i) == c) {
+ for (int i=0; i<data.length(); i++) {
+ if (data.charAt(i) == c) {
result++;
}
}
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/StandAloneTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/StandAloneTest.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/StandAloneTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/StandAloneTest.java Sat Dec 28 14:35:41 2013
@@ -34,7 +34,7 @@ public class StandAloneTest extends Test
}
public void testMe() throws Exception {
- if(OS.isFamilyUnix()) {
+ if (OS.isFamilyUnix()) {
final File testScript = TestUtil.resolveScriptForOS("./src/test/scripts/standalone");
final Executor exec = new DefaultExecutor();
exec.setStreamHandler(new PumpStreamHandler());
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestRunner.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestRunner.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestRunner.java Sat Dec 28 14:35:41 2013
@@ -46,7 +46,7 @@ public class TestRunner extends TestCase
final junit.textui.TestRunner testRunner = new junit.textui.TestRunner(System.out);
final TestResult testResult = testRunner.doRun(test);
- if(!testResult.wasSuccessful()) {
+ if (!testResult.wasSuccessful()) {
System.exit(1);
}
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtil.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtil.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtil.java Sat Dec 28 14:35:41 2013
@@ -60,18 +60,18 @@ public final class TestUtil {
public static void assertEquals(final Object[] expected, final Object[] actual, final boolean orderSignificant) {
- if(expected == null && actual == null) {
+ if (expected == null && actual == null) {
// all good
} else if (actual == null) {
throw new AssertionFailedError("Expected non null array");
} else if (expected == null) {
throw new AssertionFailedError("Expected null array");
} else {
- if(expected.length != actual.length) {
+ if (expected.length != actual.length) {
throw new AssertionFailedError("Arrays not of same length");
}
- if(!orderSignificant) {
+ if (!orderSignificant) {
Arrays.sort(expected);
Arrays.sort(actual);
}
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtilTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtilTest.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtilTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TestUtilTest.java Sat Dec 28 14:35:41 2013
@@ -37,7 +37,7 @@ public class TestUtilTest extends TestCa
try{
TestUtil.assertEquals(expected, actual, true);
fail("Must throw AssertionFailedError");
- } catch(final AssertionFailedError e) {
+ } catch (final AssertionFailedError e) {
// OK
}
}
@@ -49,7 +49,7 @@ public class TestUtilTest extends TestCa
try{
TestUtil.assertEquals(expected, actual, true);
fail("Must throw AssertionFailedError");
- } catch(final AssertionFailedError e) {
+ } catch (final AssertionFailedError e) {
// OK
}
}
@@ -75,7 +75,7 @@ public class TestUtilTest extends TestCa
try{
TestUtil.assertEquals(expected, actual, true);
fail("Must throw AssertionFailedError");
- } catch(final AssertionFailedError e) {
+ } catch (final AssertionFailedError e) {
// OK
}
}
@@ -87,7 +87,7 @@ public class TestUtilTest extends TestCa
try{
TestUtil.assertEquals(expected, actual, true);
fail("Must throw AssertionFailedError");
- } catch(final AssertionFailedError e) {
+ } catch (final AssertionFailedError e) {
// OK
}
}
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TutorialTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TutorialTest.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TutorialTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/TutorialTest.java Sat Dec 28 14:35:41 2013
@@ -55,7 +55,7 @@ public class TutorialTest extends TestCa
printResult = print(pdfFile, printJobTimeout, printInBackground);
System.out.println("[main] Successfully sent the print job ...");
}
- catch(final Exception e) {
+ catch (final Exception e) {
e.printStackTrace();
fail("[main] Printing of the following document failed : " + pdfFile.getAbsolutePath());
throw e;
@@ -97,13 +97,13 @@ public class TutorialTest extends TestCa
executor.setExitValue(1);
// create a watchdog if requested
- if(printJobTimeout > 0) {
+ if (printJobTimeout > 0) {
watchdog = new ExecuteWatchdog(printJobTimeout);
executor.setWatchdog(watchdog);
}
// pass a "ExecuteResultHandler" when doing background printing
- if(printInBackground) {
+ if (printInBackground) {
System.out.println("[print] Executing non-blocking print job ...");
resultHandler = new PrintResultHandler(watchdog);
executor.execute(commandLine, resultHandler);
@@ -137,7 +137,7 @@ public class TutorialTest extends TestCa
public void onProcessFailed(final ExecuteException e) {
super.onProcessFailed(e);
- if(watchdog != null && watchdog.killedProcess()) {
+ if (watchdog != null && watchdog.killedProcess()) {
System.err.println("[resultHandler] The print process timed out");
}
else {
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilTest.java Sat Dec 28 14:35:41 2013
@@ -61,7 +61,7 @@ public class EnvironmentUtilTest extends
// for this process, i.e. $JAVA_HOME
assertTrue("Expecting non-zero environment size", procEnvironment.size() > 0);
final String[] envArgs = EnvironmentUtils.toStrings(procEnvironment);
- for(int i=0; i<envArgs.length; i++) {
+ for (int i=0; i<envArgs.length; i++) {
assertNotNull("Entry "+i+" should not be null",envArgs[i]);
assertTrue("Entry "+i+" should not be empty",envArgs[i].length() > 0);
// System.out.println(envArgs[i]);
Modified: commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/util/StringUtilTest.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/util/StringUtilTest.java?rev=1553840&r1=1553839&r2=1553840&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/util/StringUtilTest.java (original)
+++ commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/util/StringUtilTest.java Sat Dec 28 14:35:41 2013
@@ -67,7 +67,7 @@ public class StringUtilTest extends Test
StringUtils.stringSubstitution("This is a ${foo} & ${bar} test", vars, false).toString();
fail();
}
- catch(final RuntimeException e)
+ catch (final RuntimeException e)
{
// nothing to do
}