Browse Source

Removed throwsIOException from Execute.execute() as it was never thrown.

Made some tasks specify expected return code rather than checkin it themselves.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271266 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
d09fc12e58
38 changed files with 169 additions and 475 deletions
  1. +1
    -11
      proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java
  2. +2
    -14
      proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java
  3. +2
    -16
      proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
  4. +1
    -9
      proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java
  5. +1
    -8
      proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java
  6. +16
    -5
      proposal/myrmidon/src/java/org/apache/myrmidon/framework/Execute.java
  7. +1
    -10
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
  8. +0
    -7
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  9. +4
    -12
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
  10. +8
    -16
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
  11. +6
    -14
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  12. +16
    -24
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  13. +2
    -12
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  14. +8
    -19
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  15. +2
    -9
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  16. +1
    -8
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  17. +2
    -11
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  18. +3
    -12
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  19. +2
    -10
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  20. +0
    -5
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  21. +14
    -22
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  22. +4
    -15
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java
  23. +1
    -10
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
  24. +0
    -7
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  25. +4
    -12
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
  26. +8
    -16
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
  27. +6
    -14
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  28. +16
    -24
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  29. +2
    -12
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  30. +8
    -19
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  31. +2
    -9
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  32. +1
    -8
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  33. +2
    -11
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  34. +3
    -12
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  35. +2
    -10
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  36. +0
    -5
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  37. +14
    -22
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  38. +4
    -15
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java

+ 1
- 11
proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java View File

@@ -8,7 +8,6 @@
package org.apache.antlib.build; package org.apache.antlib.build;


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
@@ -102,17 +101,8 @@ public class Patch


final ExecManager execManager = (ExecManager)getService( ExecManager.class ); final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager ); final Execute exe = new Execute( execManager );

buildCommand( exe.getCommandline() ); buildCommand( exe.getCommandline() );

try
{
exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Error", e );
}
exe.execute();
} }


private void validate() private void validate()


+ 2
- 14
proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java View File

@@ -8,7 +8,6 @@
package org.apache.antlib.cvslib; package org.apache.antlib.cvslib;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
@@ -158,19 +157,8 @@ public class Cvs


exe.setCommandline( command ); exe.setCommandline( command );
exe.setEnvironment( env ); exe.setEnvironment( env );
try
{
final int retCode = exe.execute();
if( retCode != 0 )
{
//replace with an ExecuteException(message,code);
throw new TaskException( "cvs exited with error code " + retCode );
}
}
catch( IOException e )
{
throw new TaskException( e.toString(), e );
}
exe.setReturnCode( 0 );
exe.execute();
} }


private Properties buildEnvironment() private Properties buildEnvironment()


+ 2
- 16
proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java View File

@@ -8,7 +8,6 @@
package org.apache.antlib.nativelib; package org.apache.antlib.nativelib;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.Os; import org.apache.aut.nativelib.Os;
@@ -119,21 +118,8 @@ public class Exec
private void doExecute( final Execute exe ) private void doExecute( final Execute exe )
throws TaskException throws TaskException
{ {
try
{
final int err = exe.execute();
if( 0 != err )
{
final String message =
REZ.getString( "exec.bad-resultcode.error", new Integer( err ) );
throw new TaskException( message );
}
}
catch( final IOException ioe )
{
final String message = REZ.getString( "exec.failed.error", ioe );
throw new TaskException( message, ioe );
}
exe.setReturnCode( 0 );
exe.execute();
} }


private void validate() private void validate()


+ 1
- 9
proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java View File

@@ -7,7 +7,6 @@
*/ */
package org.apache.antlib.security; package org.apache.antlib.security;


import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
@@ -125,14 +124,7 @@ public class GenerateKey
final Execute exe = new Execute( execManager ); final Execute exe = new Execute( execManager );
exe.setWorkingDirectory( getBaseDirectory() ); exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd ); exe.setCommandline( cmd );
try
{
exe.execute();
}
catch( final IOException ioe )
{
throw new TaskException( ioe.getMessage(), ioe );
}
exe.execute();
} }


private Commandline createCommand() private Commandline createCommand()


+ 1
- 8
proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java View File

@@ -298,14 +298,7 @@ public class SignJar
final ExecManager execManager = (ExecManager)getService( ExecManager.class ); final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager ); final Execute exe = new Execute( execManager );
exe.setCommandline( cmd ); exe.setCommandline( cmd );
try
{
exe.execute();
}
catch( final IOException ioe )
{
throw new TaskException( ioe.getMessage(), ioe );
}
exe.execute();
} }


private Commandline buildCommand( final File jarTarget, final File jarSource ) private Commandline buildCommand( final File jarTarget, final File jarSource )


+ 16
- 5
proposal/myrmidon/src/java/org/apache/myrmidon/framework/Execute.java View File

@@ -110,20 +110,31 @@ public class Execute
* @return the exit status of the subprocess or <code>INVALID</code> * @return the exit status of the subprocess or <code>INVALID</code>
*/ */
public int execute() public int execute()
throws IOException, TaskException
throws TaskException
{ {
final int returnCode = executenativeProcess();
final int returnCode = executeNativeProcess();
checkReturnCode( returnCode );
return returnCode;
}


/**
* Utility method to verify that specified return code was the
* return code expected (if any).
*/
private void checkReturnCode( final int returnCode )
throws TaskException
{
if( null != m_returnCode && if( null != m_returnCode &&
returnCode != m_returnCode.intValue() ) returnCode != m_returnCode.intValue() )
{ {
throw new TaskException( "Unexpected return code " + returnCode ); throw new TaskException( "Unexpected return code " + returnCode );
} }

return returnCode;
} }


private int executenativeProcess()
/**
* Actually execute the native process.
*/
private int executeNativeProcess()
throws TaskException throws TaskException
{ {
final ExecMetaData metaData = buildExecMetaData(); final ExecMetaData metaData = buildExecMetaData();


+ 1
- 10
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs; package org.apache.tools.ant.taskdefs;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
@@ -233,14 +232,6 @@ public class Java


exe.setWorkingDirectory( m_dir ); exe.setWorkingDirectory( m_dir );
exe.setCommandline( command ); exe.setCommandline( command );
try
{
return exe.execute();
}
catch( IOException e )
{
final String message = "Error executing class";
throw new TaskException( message, e );
}
return exe.execute();
} }
} }

+ 0
- 7
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -359,19 +359,12 @@ public abstract class DefaultCompilerAdapter
commandArray = args; commandArray = args;
} }


try
{
final ExecManager execManager = (ExecManager)m_attributes.getService( ExecManager.class ); final ExecManager execManager = (ExecManager)m_attributes.getService( ExecManager.class );
final Execute exe = new Execute( execManager ); final Execute exe = new Execute( execManager );
exe.setWorkingDirectory( m_baseDir ); exe.setWorkingDirectory( m_baseDir );
final String[] commandline = commandArray; final String[] commandline = commandArray;
exe.setCommandline( new Commandline( commandline ) ); exe.setCommandline( new Commandline( commandline ) );
return exe.execute(); return exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Error running " + args[ 0 ] + " compiler", e );
}
} }
finally finally
{ {


+ 4
- 12
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java View File

@@ -19,9 +19,9 @@ import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler; import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.aut.nativelib.Os; import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Execute;
import org.apache.myrmidon.framework.Pattern; import org.apache.myrmidon.framework.Pattern;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.DirectoryScanner; import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
@@ -825,22 +825,14 @@ public class Javadoc
* Avoid problems with command line length in some environments. * Avoid problems with command line length in some environments.
*/ */
exe.setWorkingDirectory( null ); exe.setWorkingDirectory( null );
exe.setCommandline( cmd );
exe.setReturnCode( 0 );
try try
{ {
exe.setCommandline( cmd );
final int ret = exe.execute();
if( ret != 0 )
{
throw new TaskException( "Javadoc returned " + ret );
}
}
catch( IOException e )
{
throw new TaskException( "Javadoc failed: " + e, e );
exe.execute();
} }
finally finally
{ {

if( m_tmpList != null ) if( m_tmpList != null )
{ {
m_tmpList.delete(); m_tmpList.delete();


+ 8
- 16
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java View File

@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs.optional.ccm; package org.apache.tools.ant.taskdefs.optional.ccm;


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler; import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
@@ -72,7 +71,7 @@ public abstract class Continuus
/** /**
* Set the value of ccmAction. * Set the value of ccmAction.
* *
* @param v Value to assign to ccmAction.
* @param ccmAction Value to assign to ccmAction.
*/ */
public void setCcmAction( final String ccmAction ) public void setCcmAction( final String ccmAction )
{ {
@@ -110,21 +109,14 @@ public abstract class Continuus
protected int run( final Commandline cmd, final ExecOutputHandler handler ) protected int run( final Commandline cmd, final ExecOutputHandler handler )
throws TaskException throws TaskException
{ {
try
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
if( null != handler )
{ {
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
if( null != handler )
{
exe.setExecOutputHandler( handler );
}
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
}
catch( final IOException ioe )
{
throw new TaskException( "Error", ioe );
exe.setExecOutputHandler( handler );
} }
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
} }
} }

+ 6
- 14
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -8,11 +8,10 @@
package org.apache.tools.ant.taskdefs.optional.clearcase; package org.apache.tools.ant.taskdefs.optional.clearcase;


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -106,18 +105,11 @@ public abstract class ClearCase extends Task
protected int run( Commandline cmd ) protected int run( Commandline cmd )
throws TaskException throws TaskException
{ {
try
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Error", e );
}
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
} }


} }


+ 16
- 24
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java View File

@@ -8,12 +8,11 @@
package org.apache.tools.ant.taskdefs.optional.dotnet;// imports package org.apache.tools.ant.taskdefs.optional.dotnet;// imports


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -141,35 +140,28 @@ public class NetCommand
throws TaskException throws TaskException
{ {
int err = -1;// assume the worst int err = -1;// assume the worst
try
if( _traceCommandLine )
{
//_owner.getLogger().info( _commandLine.toString() );
}
else
{
//in verbose mode we always log stuff
logVerbose( _commandLine.toString() );
}
_exe.setCommandline( _commandLine );
err = _exe.execute();
if( err != 0 )
{ {
if( _traceCommandLine )
if( _failOnError )
{ {
//_owner.getLogger().info( _commandLine.toString() );
throw new TaskException( _title + " returned: " + err );
} }
else else
{ {
//in verbose mode we always log stuff
logVerbose( _commandLine.toString() );
}
_exe.setCommandline( _commandLine );
err = _exe.execute();
if( err != 0 )
{
if( _failOnError )
{
throw new TaskException( _title + " returned: " + err );
}
else
{
getLogger().error( _title + " Result: " + err );
}
getLogger().error( _title + " Result: " + err );
} }
} }
catch( IOException e )
{
throw new TaskException( _title + " failed: " + e, e );
}
} }


/** /**


+ 2
- 12
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -185,17 +185,7 @@ public class JJTree extends Task
final Execute exe = new Execute( execManager ); final Execute exe = new Execute( execManager );
getLogger().debug( cmdl.toString() ); getLogger().debug( cmdl.toString() );
exe.setCommandline( new Commandline( cmdl.getCommandline() ) ); exe.setCommandline( new Commandline( cmdl.getCommandline() ) );

try
{
if( exe.execute() != 0 )
{
throw new TaskException( "JJTree failed." );
}
}
catch( IOException e )
{
throw new TaskException( "Failed to launch JJTree: " + e );
}
exe.setReturnCode( 0 );
exe.execute();
} }
} }

+ 8
- 19
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java View File

@@ -8,13 +8,12 @@
package org.apache.tools.ant.taskdefs.optional.javacc; package org.apache.tools.ant.taskdefs.optional.javacc;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -239,23 +238,13 @@ public class JavaCC extends Task
private void runCommand( final CommandlineJava cmdline ) private void runCommand( final CommandlineJava cmdline )
throws TaskException throws TaskException
{ {
try
{
getLogger().debug( cmdline.toString() );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
final String[] commandline = cmdline.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
int retval = exe.execute();
if( retval != 0 )
{
throw new TaskException( cmdline + " failed with return code " + retval );
}
}
catch( final IOException ioe )
{
throw new TaskException( "Could not launch " + cmdline + ": " + ioe );
}
getLogger().debug( cmdline.toString() );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
final String[] commandline = cmdline.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
exe.setReturnCode( 0 );
exe.execute();
} }


/** /**


+ 2
- 9
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -13,8 +13,8 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -255,14 +255,7 @@ public class JDependTask
getLogger().info( "Output to be stored in " + m_outputFile.getPath() ); getLogger().info( "Output to be stored in " + m_outputFile.getPath() );
} }
getLogger().debug( "Executing: " + commandline.toString() ); getLogger().debug( "Executing: " + commandline.toString() );
try
{
return exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Process fork failed.", e );
}
return exe.execute();
} }






+ 1
- 8
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -658,14 +658,9 @@ public class JUnitTask extends Task
} }


getLogger().debug( "Executing: " + cmd.toString() ); getLogger().debug( "Executing: " + cmd.toString() );
int retVal;
try try
{ {
retVal = exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Process fork failed.", e );
return exe.execute();
} }
finally finally
{ {
@@ -674,8 +669,6 @@ public class JUnitTask extends Task
throw new TaskException( "Could not delete temporary properties file." ); throw new TaskException( "Could not delete temporary properties file." );
} }
} }

return retVal;
} }


/** /**


+ 2
- 11
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -284,17 +284,8 @@ public abstract class AbstractMetamataTask
getLogger().debug( m_cmdl.toString() ); getLogger().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline(); final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) ); exe.setCommandline( new Commandline( commandline ) );
try
{
if( 0 != exe.execute() )
{
throw new TaskException( "Metamata task failed." );
}
}
catch( IOException e )
{
throw new TaskException( "Failed to launch Metamata task: " + e );
}
exe.setReturnCode( 0 );
exe.execute();
} }


protected void generateOptionsFile( File tofile, ArrayList options ) protected void generateOptionsFile( File tofile, ArrayList options )


+ 3
- 12
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -16,8 +16,8 @@ import java.util.Random;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.excalibur.io.IOUtil; import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
@@ -292,17 +292,8 @@ public class MParse
getLogger().debug( m_cmdl.toString() ); getLogger().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline(); final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) ); exe.setCommandline( new Commandline( commandline ) );
try
{
if( exe.execute() != 0 )
{
throw new TaskException( "Metamata task failed." );
}
}
catch( IOException e )
{
throw new TaskException( "Failed to launch Metamata task: " + e );
}
exe.setReturnCode( 0 );
exe.execute();
} }


/** /**


+ 2
- 10
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java View File

@@ -7,12 +7,11 @@
*/ */
package org.apache.tools.ant.taskdefs.optional.perforce; package org.apache.tools.ant.taskdefs.optional.perforce;


import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler; import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.oro.text.perl.Perl5Util;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.oro.text.perl.Perl5Util;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -171,14 +170,7 @@ public abstract class P4Base
exe.setExecOutputHandler( handler ); exe.setExecOutputHandler( handler );
exe.setCommandline( cmd ); exe.setCommandline( cmd );


try
{
exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Error", e );
}
exe.execute();
if( null != m_error ) if( null != m_error )
{ {
throw m_error; throw m_error;


+ 0
- 5
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -198,11 +198,6 @@ public class Pvcs
result = exe.execute(); result = exe.execute();
checkResultCode( result, cmd ); checkResultCode( result, cmd );
} }
catch( IOException e )
{
String msg = "Failed executing: " + cmd.toString() + ". Exception: " + e.getMessage();
throw new TaskException( msg );
}
finally finally
{ {
if( filelist != null ) if( filelist != null )


+ 14
- 22
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -8,12 +8,11 @@
package org.apache.tools.ant.taskdefs.optional.vss; package org.apache.tools.ant.taskdefs.optional.vss;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -203,28 +202,21 @@ public abstract class MSVSS extends Task
protected int run( Commandline cmd ) protected int run( Commandline cmd )
throws TaskException throws TaskException
{ {
try
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );

// If location of ss.ini is specified we need to set the
// environment-variable SSDIR to this value
if( m_serverPath != null )
{
final Properties env = new Properties();
env.setProperty( "SSDIR", m_serverPath );
exe.setEnvironment( env );
}

exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
}
catch( IOException e )
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );

// If location of ss.ini is specified we need to set the
// environment-variable SSDIR to this value
if( m_serverPath != null )
{ {
throw new TaskException( "Error", e );
final Properties env = new Properties();
env.setProperty( "SSDIR", m_serverPath );
exe.setEnvironment( env );
} }

exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
} }
} }



+ 4
- 15
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java View File

@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs.unix; package org.apache.tools.ant.taskdefs.unix;


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
@@ -98,22 +97,12 @@ public class Rpm
m_topDir = getBaseDirectory(); m_topDir = getBaseDirectory();
} }
exe.setWorkingDirectory( m_topDir ); exe.setWorkingDirectory( m_topDir );

exe.setCommandline( cmd ); exe.setCommandline( cmd );
try
{
final String message = "Building the RPM based on the " + m_specFile + " file";
getLogger().info( message );
exe.setReturnCode( 0 );


if( 0 != exe.execute() )
{
throw new TaskException( "Failed to execute rpm" );
}
}
catch( IOException e )
{
throw new TaskException( "Error", e );
}
final String message = "Building the RPM based on the " + m_specFile + " file";
getLogger().info( message );
exe.execute();
} }


private Commandline createCommand() private Commandline createCommand()


+ 1
- 10
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java View File

@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs; package org.apache.tools.ant.taskdefs;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
@@ -233,14 +232,6 @@ public class Java


exe.setWorkingDirectory( m_dir ); exe.setWorkingDirectory( m_dir );
exe.setCommandline( command ); exe.setCommandline( command );
try
{
return exe.execute();
}
catch( IOException e )
{
final String message = "Error executing class";
throw new TaskException( message, e );
}
return exe.execute();
} }
} }

+ 0
- 7
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -359,19 +359,12 @@ public abstract class DefaultCompilerAdapter
commandArray = args; commandArray = args;
} }


try
{
final ExecManager execManager = (ExecManager)m_attributes.getService( ExecManager.class ); final ExecManager execManager = (ExecManager)m_attributes.getService( ExecManager.class );
final Execute exe = new Execute( execManager ); final Execute exe = new Execute( execManager );
exe.setWorkingDirectory( m_baseDir ); exe.setWorkingDirectory( m_baseDir );
final String[] commandline = commandArray; final String[] commandline = commandArray;
exe.setCommandline( new Commandline( commandline ) ); exe.setCommandline( new Commandline( commandline ) );
return exe.execute(); return exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Error running " + args[ 0 ] + " compiler", e );
}
} }
finally finally
{ {


+ 4
- 12
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java View File

@@ -19,9 +19,9 @@ import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler; import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.aut.nativelib.Os; import org.apache.aut.nativelib.Os;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Execute;
import org.apache.myrmidon.framework.Pattern; import org.apache.myrmidon.framework.Pattern;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.DirectoryScanner; import org.apache.tools.ant.types.DirectoryScanner;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
@@ -825,22 +825,14 @@ public class Javadoc
* Avoid problems with command line length in some environments. * Avoid problems with command line length in some environments.
*/ */
exe.setWorkingDirectory( null ); exe.setWorkingDirectory( null );
exe.setCommandline( cmd );
exe.setReturnCode( 0 );
try try
{ {
exe.setCommandline( cmd );
final int ret = exe.execute();
if( ret != 0 )
{
throw new TaskException( "Javadoc returned " + ret );
}
}
catch( IOException e )
{
throw new TaskException( "Javadoc failed: " + e, e );
exe.execute();
} }
finally finally
{ {

if( m_tmpList != null ) if( m_tmpList != null )
{ {
m_tmpList.delete(); m_tmpList.delete();


+ 8
- 16
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java View File

@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs.optional.ccm; package org.apache.tools.ant.taskdefs.optional.ccm;


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler; import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
@@ -72,7 +71,7 @@ public abstract class Continuus
/** /**
* Set the value of ccmAction. * Set the value of ccmAction.
* *
* @param v Value to assign to ccmAction.
* @param ccmAction Value to assign to ccmAction.
*/ */
public void setCcmAction( final String ccmAction ) public void setCcmAction( final String ccmAction )
{ {
@@ -110,21 +109,14 @@ public abstract class Continuus
protected int run( final Commandline cmd, final ExecOutputHandler handler ) protected int run( final Commandline cmd, final ExecOutputHandler handler )
throws TaskException throws TaskException
{ {
try
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
if( null != handler )
{ {
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
if( null != handler )
{
exe.setExecOutputHandler( handler );
}
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
}
catch( final IOException ioe )
{
throw new TaskException( "Error", ioe );
exe.setExecOutputHandler( handler );
} }
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
} }
} }

+ 6
- 14
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -8,11 +8,10 @@
package org.apache.tools.ant.taskdefs.optional.clearcase; package org.apache.tools.ant.taskdefs.optional.clearcase;


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -106,18 +105,11 @@ public abstract class ClearCase extends Task
protected int run( Commandline cmd ) protected int run( Commandline cmd )
throws TaskException throws TaskException
{ {
try
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Error", e );
}
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
} }


} }


+ 16
- 24
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java View File

@@ -8,12 +8,11 @@
package org.apache.tools.ant.taskdefs.optional.dotnet;// imports package org.apache.tools.ant.taskdefs.optional.dotnet;// imports


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -141,35 +140,28 @@ public class NetCommand
throws TaskException throws TaskException
{ {
int err = -1;// assume the worst int err = -1;// assume the worst
try
if( _traceCommandLine )
{
//_owner.getLogger().info( _commandLine.toString() );
}
else
{
//in verbose mode we always log stuff
logVerbose( _commandLine.toString() );
}
_exe.setCommandline( _commandLine );
err = _exe.execute();
if( err != 0 )
{ {
if( _traceCommandLine )
if( _failOnError )
{ {
//_owner.getLogger().info( _commandLine.toString() );
throw new TaskException( _title + " returned: " + err );
} }
else else
{ {
//in verbose mode we always log stuff
logVerbose( _commandLine.toString() );
}
_exe.setCommandline( _commandLine );
err = _exe.execute();
if( err != 0 )
{
if( _failOnError )
{
throw new TaskException( _title + " returned: " + err );
}
else
{
getLogger().error( _title + " Result: " + err );
}
getLogger().error( _title + " Result: " + err );
} }
} }
catch( IOException e )
{
throw new TaskException( _title + " failed: " + e, e );
}
} }


/** /**


+ 2
- 12
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -185,17 +185,7 @@ public class JJTree extends Task
final Execute exe = new Execute( execManager ); final Execute exe = new Execute( execManager );
getLogger().debug( cmdl.toString() ); getLogger().debug( cmdl.toString() );
exe.setCommandline( new Commandline( cmdl.getCommandline() ) ); exe.setCommandline( new Commandline( cmdl.getCommandline() ) );

try
{
if( exe.execute() != 0 )
{
throw new TaskException( "JJTree failed." );
}
}
catch( IOException e )
{
throw new TaskException( "Failed to launch JJTree: " + e );
}
exe.setReturnCode( 0 );
exe.execute();
} }
} }

+ 8
- 19
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java View File

@@ -8,13 +8,12 @@
package org.apache.tools.ant.taskdefs.optional.javacc; package org.apache.tools.ant.taskdefs.optional.javacc;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -239,23 +238,13 @@ public class JavaCC extends Task
private void runCommand( final CommandlineJava cmdline ) private void runCommand( final CommandlineJava cmdline )
throws TaskException throws TaskException
{ {
try
{
getLogger().debug( cmdline.toString() );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
final String[] commandline = cmdline.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
int retval = exe.execute();
if( retval != 0 )
{
throw new TaskException( cmdline + " failed with return code " + retval );
}
}
catch( final IOException ioe )
{
throw new TaskException( "Could not launch " + cmdline + ": " + ioe );
}
getLogger().debug( cmdline.toString() );
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );
final String[] commandline = cmdline.getCommandline();
exe.setCommandline( new Commandline( commandline ) );
exe.setReturnCode( 0 );
exe.execute();
} }


/** /**


+ 2
- 9
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -13,8 +13,8 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -255,14 +255,7 @@ public class JDependTask
getLogger().info( "Output to be stored in " + m_outputFile.getPath() ); getLogger().info( "Output to be stored in " + m_outputFile.getPath() );
} }
getLogger().debug( "Executing: " + commandline.toString() ); getLogger().debug( "Executing: " + commandline.toString() );
try
{
return exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Process fork failed.", e );
}
return exe.execute();
} }






+ 1
- 8
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -658,14 +658,9 @@ public class JUnitTask extends Task
} }


getLogger().debug( "Executing: " + cmd.toString() ); getLogger().debug( "Executing: " + cmd.toString() );
int retVal;
try try
{ {
retVal = exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Process fork failed.", e );
return exe.execute();
} }
finally finally
{ {
@@ -674,8 +669,6 @@ public class JUnitTask extends Task
throw new TaskException( "Could not delete temporary properties file." ); throw new TaskException( "Could not delete temporary properties file." );
} }
} }

return retVal;
} }


/** /**


+ 2
- 11
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -284,17 +284,8 @@ public abstract class AbstractMetamataTask
getLogger().debug( m_cmdl.toString() ); getLogger().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline(); final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) ); exe.setCommandline( new Commandline( commandline ) );
try
{
if( 0 != exe.execute() )
{
throw new TaskException( "Metamata task failed." );
}
}
catch( IOException e )
{
throw new TaskException( "Failed to launch Metamata task: " + e );
}
exe.setReturnCode( 0 );
exe.execute();
} }


protected void generateOptionsFile( File tofile, ArrayList options ) protected void generateOptionsFile( File tofile, ArrayList options )


+ 3
- 12
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -16,8 +16,8 @@ import java.util.Random;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.avalon.excalibur.io.IOUtil; import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Argument;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava; import org.apache.tools.ant.types.CommandlineJava;
@@ -292,17 +292,8 @@ public class MParse
getLogger().debug( m_cmdl.toString() ); getLogger().debug( m_cmdl.toString() );
final String[] commandline = m_cmdl.getCommandline(); final String[] commandline = m_cmdl.getCommandline();
exe.setCommandline( new Commandline( commandline ) ); exe.setCommandline( new Commandline( commandline ) );
try
{
if( exe.execute() != 0 )
{
throw new TaskException( "Metamata task failed." );
}
}
catch( IOException e )
{
throw new TaskException( "Failed to launch Metamata task: " + e );
}
exe.setReturnCode( 0 );
exe.execute();
} }


/** /**


+ 2
- 10
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java View File

@@ -7,12 +7,11 @@
*/ */
package org.apache.tools.ant.taskdefs.optional.perforce; package org.apache.tools.ant.taskdefs.optional.perforce;


import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.aut.nativelib.ExecOutputHandler; import org.apache.aut.nativelib.ExecOutputHandler;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.oro.text.perl.Perl5Util;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.oro.text.perl.Perl5Util;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -171,14 +170,7 @@ public abstract class P4Base
exe.setExecOutputHandler( handler ); exe.setExecOutputHandler( handler );
exe.setCommandline( cmd ); exe.setCommandline( cmd );


try
{
exe.execute();
}
catch( IOException e )
{
throw new TaskException( "Error", e );
}
exe.execute();
if( null != m_error ) if( null != m_error )
{ {
throw m_error; throw m_error;


+ 0
- 5
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -198,11 +198,6 @@ public class Pvcs
result = exe.execute(); result = exe.execute();
checkResultCode( result, cmd ); checkResultCode( result, cmd );
} }
catch( IOException e )
{
String msg = "Failed executing: " + cmd.toString() + ". Exception: " + e.getMessage();
throw new TaskException( msg );
}
finally finally
{ {
if( filelist != null ) if( filelist != null )


+ 14
- 22
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -8,12 +8,11 @@
package org.apache.tools.ant.taskdefs.optional.vss; package org.apache.tools.ant.taskdefs.optional.vss;


import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.myrmidon.framework.Execute; import org.apache.myrmidon.framework.Execute;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;


/** /**
@@ -203,28 +202,21 @@ public abstract class MSVSS extends Task
protected int run( Commandline cmd ) protected int run( Commandline cmd )
throws TaskException throws TaskException
{ {
try
{
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );

// If location of ss.ini is specified we need to set the
// environment-variable SSDIR to this value
if( m_serverPath != null )
{
final Properties env = new Properties();
env.setProperty( "SSDIR", m_serverPath );
exe.setEnvironment( env );
}

exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
}
catch( IOException e )
final ExecManager execManager = (ExecManager)getService( ExecManager.class );
final Execute exe = new Execute( execManager );

// If location of ss.ini is specified we need to set the
// environment-variable SSDIR to this value
if( m_serverPath != null )
{ {
throw new TaskException( "Error", e );
final Properties env = new Properties();
env.setProperty( "SSDIR", m_serverPath );
exe.setEnvironment( env );
} }

exe.setWorkingDirectory( getBaseDirectory() );
exe.setCommandline( cmd );
return exe.execute();
} }
} }



+ 4
- 15
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/unix/Rpm.java View File

@@ -8,7 +8,6 @@
package org.apache.tools.ant.taskdefs.unix; package org.apache.tools.ant.taskdefs.unix;


import java.io.File; import java.io.File;
import java.io.IOException;
import org.apache.aut.nativelib.ExecManager; import org.apache.aut.nativelib.ExecManager;
import org.apache.myrmidon.api.AbstractTask; import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
@@ -98,22 +97,12 @@ public class Rpm
m_topDir = getBaseDirectory(); m_topDir = getBaseDirectory();
} }
exe.setWorkingDirectory( m_topDir ); exe.setWorkingDirectory( m_topDir );

exe.setCommandline( cmd ); exe.setCommandline( cmd );
try
{
final String message = "Building the RPM based on the " + m_specFile + " file";
getLogger().info( message );
exe.setReturnCode( 0 );


if( 0 != exe.execute() )
{
throw new TaskException( "Failed to execute rpm" );
}
}
catch( IOException e )
{
throw new TaskException( "Error", e );
}
final String message = "Building the RPM based on the " + m_specFile + " file";
getLogger().info( message );
exe.execute();
} }


private Commandline createCommand() private Commandline createCommand()


Loading…
Cancel
Save