ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase ClearCase.java
Date Sun, 10 Feb 2002 01:01:13 GMT
donaldp     02/02/09 17:01:13

  Modified:    proposal/myrmidon/src/java/org/apache/antlib/security
                        SignJar.java GenerateKey.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix
                        Rpm.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs
                        Pvcs.java
               proposal/myrmidon/src/java/org/apache/antlib/build
                        Patch.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce
                        P4Base.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        NetCommand.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss
                        MSVSS.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata
                        MParse.java AbstractMetamataTask.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc
                        JJTree.java JavaCC.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend
                        JDependTask.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc
                        Javadoc.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Java.java
               proposal/myrmidon/src/java/org/apache/myrmidon/framework
                        Execute.java
               proposal/myrmidon/src/java/org/apache/antlib/nativelib
                        Exec.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers
                        DefaultCompilerAdapter.java
               proposal/myrmidon/src/java/org/apache/antlib/cvslib Cvs.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm
                        Continuus.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase
                        ClearCase.java
  Log:
  Removed throwsIOException from Execute.execute() as it was never thrown.
  
  Made some tasks specify expected return code rather than checkin it themselves.
  
  Revision  Changes    Path
  1.10      +1 -8      jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java
  
  Index: SignJar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/security/SignJar.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SignJar.java	10 Feb 2002 00:46:50 -0000	1.9
  +++ SignJar.java	10 Feb 2002 01:01:11 -0000	1.10
  @@ -298,14 +298,7 @@
           final ExecManager execManager = (ExecManager)getService( ExecManager.class );
           final Execute exe = new Execute( execManager );
           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 )
  
  
  
  1.7       +1 -9      jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java
  
  Index: GenerateKey.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/security/GenerateKey.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- GenerateKey.java	10 Feb 2002 00:46:50 -0000	1.6
  +++ GenerateKey.java	10 Feb 2002 01:01:11 -0000	1.7
  @@ -7,7 +7,6 @@
    */
   package org.apache.antlib.security;
   
  -import java.io.IOException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  @@ -125,14 +124,7 @@
           final Execute exe = new Execute( execManager );
           exe.setWorkingDirectory( getBaseDirectory() );
           exe.setCommandline( cmd );
  -        try
  -        {
  -            exe.execute();
  -        }
  -        catch( final IOException ioe )
  -        {
  -            throw new TaskException( ioe.getMessage(), ioe );
  -        }
  +        exe.execute();
       }
   
       private Commandline createCommand()
  
  
  
  1.15      +4 -15     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java
  
  Index: Rpm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Rpm.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Rpm.java	10 Feb 2002 00:46:50 -0000	1.14
  +++ Rpm.java	10 Feb 2002 01:01:11 -0000	1.15
  @@ -8,7 +8,6 @@
   package org.apache.tools.ant.taskdefs.unix;
   
   import java.io.File;
  -import java.io.IOException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  @@ -98,22 +97,12 @@
               m_topDir = getBaseDirectory();
           }
           exe.setWorkingDirectory( m_topDir );
  -
           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()
  
  
  
  1.22      +0 -5      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  
  Index: Pvcs.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Pvcs.java	10 Feb 2002 00:46:50 -0000	1.21
  +++ Pvcs.java	10 Feb 2002 01:01:11 -0000	1.22
  @@ -198,11 +198,6 @@
               result = exe.execute();
               checkResultCode( result, cmd );
           }
  -        catch( IOException e )
  -        {
  -            String msg = "Failed executing: " + cmd.toString() + ". Exception: " + e.getMessage();
  -            throw new TaskException( msg );
  -        }
           finally
           {
               if( filelist != null )
  
  
  
  1.5       +1 -11     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java
  
  Index: Patch.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/build/Patch.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Patch.java	10 Feb 2002 00:46:50 -0000	1.4
  +++ Patch.java	10 Feb 2002 01:01:11 -0000	1.5
  @@ -8,7 +8,6 @@
   package org.apache.antlib.build;
   
   import java.io.File;
  -import java.io.IOException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  @@ -102,17 +101,8 @@
   
           final ExecManager execManager = (ExecManager)getService( ExecManager.class );
           final Execute exe = new Execute( execManager );
  -
           buildCommand( exe.getCommandline() );
  -
  -        try
  -        {
  -            exe.execute();
  -        }
  -        catch( IOException e )
  -        {
  -            throw new TaskException( "Error", e );
  -        }
  +        exe.execute();
       }
   
       private void validate()
  
  
  
  1.20      +2 -10     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  
  Index: P4Base.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- P4Base.java	10 Feb 2002 00:46:50 -0000	1.19
  +++ P4Base.java	10 Feb 2002 01:01:11 -0000	1.20
  @@ -7,12 +7,11 @@
    */
   package org.apache.tools.ant.taskdefs.optional.perforce;
   
  -import java.io.IOException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.aut.nativelib.ExecOutputHandler;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.oro.text.perl.Perl5Util;
   import org.apache.myrmidon.framework.Execute;
  +import org.apache.oro.text.perl.Perl5Util;
   import org.apache.tools.ant.types.Commandline;
   
   /**
  @@ -171,14 +170,7 @@
               exe.setExecOutputHandler( handler );
               exe.setCommandline( cmd );
   
  -            try
  -            {
  -                exe.execute();
  -            }
  -            catch( IOException e )
  -            {
  -                throw new TaskException( "Error", e );
  -            }
  +            exe.execute();
               if( null != m_error )
               {
                   throw m_error;
  
  
  
  1.22      +16 -24    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  
  Index: NetCommand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- NetCommand.java	10 Feb 2002 00:46:50 -0000	1.21
  +++ NetCommand.java	10 Feb 2002 01:01:12 -0000	1.22
  @@ -8,12 +8,11 @@
   package org.apache.tools.ant.taskdefs.optional.dotnet;// imports
   
   import java.io.File;
  -import java.io.IOException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.Task;
   import org.apache.myrmidon.framework.Execute;
  +import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Commandline;
   
   /**
  @@ -141,34 +140,27 @@
           throws TaskException
       {
           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
               {
  -                //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 );
           }
       }
   
  
  
  
  1.23      +13 -21    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  
  Index: MSVSS.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- MSVSS.java	10 Feb 2002 00:46:50 -0000	1.22
  +++ MSVSS.java	10 Feb 2002 01:01:12 -0000	1.23
  @@ -8,12 +8,11 @@
   package org.apache.tools.ant.taskdefs.optional.vss;
   
   import java.io.File;
  -import java.io.IOException;
   import java.util.Properties;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.Task;
   import org.apache.myrmidon.framework.Execute;
  +import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Commandline;
   
   /**
  @@ -203,28 +202,21 @@
       protected int run( Commandline cmd )
           throws TaskException
       {
  -        try
  -        {
  -            final ExecManager execManager = (ExecManager)getService( ExecManager.class
);
  -            final Execute exe = new Execute( execManager );
  +        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 )
  +        // 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();
       }
   }
   
  
  
  
  1.26      +3 -12     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  
  Index: MParse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- MParse.java	10 Feb 2002 00:46:50 -0000	1.25
  +++ MParse.java	10 Feb 2002 01:01:12 -0000	1.26
  @@ -16,8 +16,8 @@
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.avalon.excalibur.io.IOUtil;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.Task;
   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.Commandline;
   import org.apache.tools.ant.types.CommandlineJava;
  @@ -292,17 +292,8 @@
           getLogger().debug( m_cmdl.toString() );
           final String[] commandline = m_cmdl.getCommandline();
           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();
       }
   
       /**
  
  
  
  1.28      +2 -11     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  
  Index: AbstractMetamataTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- AbstractMetamataTask.java	10 Feb 2002 00:46:50 -0000	1.27
  +++ AbstractMetamataTask.java	10 Feb 2002 01:01:12 -0000	1.28
  @@ -284,17 +284,8 @@
           getLogger().debug( m_cmdl.toString() );
           final String[] commandline = m_cmdl.getCommandline();
           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 )
  
  
  
  1.37      +1 -8      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- JUnitTask.java	10 Feb 2002 00:46:50 -0000	1.36
  +++ JUnitTask.java	10 Feb 2002 01:01:12 -0000	1.37
  @@ -658,14 +658,9 @@
           }
   
           getLogger().debug( "Executing: " + cmd.toString() );
  -        int retVal;
           try
           {
  -            retVal = exe.execute();
  -        }
  -        catch( IOException e )
  -        {
  -            throw new TaskException( "Process fork failed.", e );
  +            return exe.execute();
           }
           finally
           {
  @@ -674,8 +669,6 @@
                   throw new TaskException( "Could not delete temporary properties file."
);
               }
           }
  -
  -        return retVal;
       }
   
       /**
  
  
  
  1.27      +2 -12     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  
  Index: JJTree.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- JJTree.java	10 Feb 2002 00:46:51 -0000	1.26
  +++ JJTree.java	10 Feb 2002 01:01:12 -0000	1.27
  @@ -185,17 +185,7 @@
           final Execute exe = new Execute( execManager );
           getLogger().debug( cmdl.toString() );
           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();
       }
   }
  
  
  
  1.22      +8 -19     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  
  Index: JavaCC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JavaCC.java	10 Feb 2002 00:46:51 -0000	1.21
  +++ JavaCC.java	10 Feb 2002 01:01:12 -0000	1.22
  @@ -8,13 +8,12 @@
   package org.apache.tools.ant.taskdefs.optional.javacc;
   
   import java.io.File;
  -import java.io.IOException;
   import java.util.Enumeration;
   import java.util.Hashtable;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.Task;
   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.CommandlineJava;
   import org.apache.tools.ant.types.Path;
  @@ -239,23 +238,13 @@
       private void runCommand( final CommandlineJava cmdline )
           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();
       }
   
       /**
  
  
  
  1.26      +2 -9      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  
  Index: JDependTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- JDependTask.java	10 Feb 2002 00:46:51 -0000	1.25
  +++ JDependTask.java	10 Feb 2002 01:01:12 -0000	1.26
  @@ -13,8 +13,8 @@
   import java.io.PrintWriter;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.Task;
   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.CommandlineJava;
   import org.apache.tools.ant.types.Path;
  @@ -255,14 +255,7 @@
               getLogger().info( "Output to be stored in " + m_outputFile.getPath() );
           }
           getLogger().debug( "Executing: " + commandline.toString() );
  -        try
  -        {
  -            return exe.execute();
  -        }
  -        catch( IOException e )
  -        {
  -            throw new TaskException( "Process fork failed.", e );
  -        }
  +        return exe.execute();
       }
   
   
  
  
  
  1.26      +4 -12     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- Javadoc.java	10 Feb 2002 00:46:51 -0000	1.25
  +++ Javadoc.java	10 Feb 2002 01:01:12 -0000	1.26
  @@ -19,9 +19,9 @@
   import org.apache.aut.nativelib.ExecOutputHandler;
   import org.apache.aut.nativelib.Os;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.framework.Execute;
   import org.apache.myrmidon.framework.Pattern;
   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.DirectoryScanner;
   import org.apache.tools.ant.types.FileSet;
  @@ -825,22 +825,14 @@
            * Avoid problems with command line length in some environments.
            */
           exe.setWorkingDirectory( null );
  +        exe.setCommandline( cmd );
  +        exe.setReturnCode( 0 );
           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
           {
  -
               if( m_tmpList != null )
               {
                   m_tmpList.delete();
  
  
  
  1.31      +1 -10     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Java.java	10 Feb 2002 00:46:51 -0000	1.30
  +++ Java.java	10 Feb 2002 01:01:12 -0000	1.31
  @@ -8,7 +8,6 @@
   package org.apache.tools.ant.taskdefs;
   
   import java.io.File;
  -import java.io.IOException;
   import java.io.PrintStream;
   import java.util.ArrayList;
   import org.apache.aut.nativelib.ExecManager;
  @@ -233,14 +232,6 @@
   
           exe.setWorkingDirectory( m_dir );
           exe.setCommandline( command );
  -        try
  -        {
  -            return exe.execute();
  -        }
  -        catch( IOException e )
  -        {
  -            final String message = "Error executing class";
  -            throw new TaskException( message, e );
  -        }
  +        return exe.execute();
       }
   }
  
  
  
  1.2       +17 -6     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Execute.java
  
  Index: Execute.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Execute.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Execute.java	10 Feb 2002 00:46:51 -0000	1.1
  +++ Execute.java	10 Feb 2002 01:01:12 -0000	1.2
  @@ -23,7 +23,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:thomas.haas@softwired-inc.com">Thomas Haas</a>
  - * @version $Revision: 1.1 $ $Date: 2002/02/10 00:46:51 $
  + * @version $Revision: 1.2 $ $Date: 2002/02/10 01:01:12 $
    */
   public class Execute
   {
  @@ -110,20 +110,31 @@
        * @return the exit status of the subprocess or <code>INVALID</code>
        */
       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 &&
               returnCode != m_returnCode.intValue() )
           {
               throw new TaskException( "Unexpected return code " + returnCode );
           }
  -
  -        return returnCode;
       }
   
  -    private int executenativeProcess()
  +    /**
  +     * Actually execute the native process.
  +     */
  +    private int executeNativeProcess()
           throws TaskException
       {
           final ExecMetaData metaData = buildExecMetaData();
  
  
  
  1.11      +2 -16     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
  
  Index: Exec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Exec.java	10 Feb 2002 00:46:51 -0000	1.10
  +++ Exec.java	10 Feb 2002 01:01:12 -0000	1.11
  @@ -8,7 +8,6 @@
   package org.apache.antlib.nativelib;
   
   import java.io.File;
  -import java.io.IOException;
   import java.util.Properties;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.aut.nativelib.Os;
  @@ -119,21 +118,8 @@
       private void doExecute( final Execute exe )
           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()
  
  
  
  1.32      +0 -7      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  
  Index: DefaultCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- DefaultCompilerAdapter.java	10 Feb 2002 00:46:51 -0000	1.31
  +++ DefaultCompilerAdapter.java	10 Feb 2002 01:01:12 -0000	1.32
  @@ -359,19 +359,12 @@
                   commandArray = args;
               }
   
  -            try
  -            {
                   final ExecManager execManager = (ExecManager)m_attributes.getService( ExecManager.class
);
                   final Execute exe = new Execute( execManager );
                   exe.setWorkingDirectory( m_baseDir );
                   final String[] commandline = commandArray;
                   exe.setCommandline( new Commandline( commandline ) );
                   return exe.execute();
  -            }
  -            catch( IOException e )
  -            {
  -                throw new TaskException( "Error running " + args[ 0 ] + " compiler", e
);
  -            }
           }
           finally
           {
  
  
  
  1.24      +3 -15     jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java
  
  Index: Cvs.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/cvslib/Cvs.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Cvs.java	10 Feb 2002 00:46:51 -0000	1.23
  +++ Cvs.java	10 Feb 2002 01:01:12 -0000	1.24
  @@ -8,7 +8,6 @@
   package org.apache.antlib.cvslib;
   
   import java.io.File;
  -import java.io.IOException;
   import java.util.Properties;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.AbstractTask;
  @@ -24,7 +23,7 @@
    * @author <a href="mailto:costin@dnt.ro">costin@dnt.ro</a>
    * @author <a href="mailto:stefano@apache.org">stefano@apache.org</a>
    * @author <a href="mailto:wwerner@picturesafe.de">Wolfgang Werner</a>
  - * @version $Revision: 1.23 $ $Date: 2002/02/10 00:46:51 $
  + * @version $Revision: 1.24 $ $Date: 2002/02/10 01:01:12 $
    * @ant:task name="cvs"
    */
   public class Cvs
  @@ -158,19 +157,8 @@
   
           exe.setCommandline( command );
           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()
  
  
  
  1.22      +8 -16     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
  
  Index: Continuus.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Continuus.java	10 Feb 2002 00:46:51 -0000	1.21
  +++ Continuus.java	10 Feb 2002 01:01:13 -0000	1.22
  @@ -8,7 +8,6 @@
   package org.apache.tools.ant.taskdefs.optional.ccm;
   
   import java.io.File;
  -import java.io.IOException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.aut.nativelib.ExecOutputHandler;
   import org.apache.myrmidon.api.AbstractTask;
  @@ -72,7 +71,7 @@
       /**
        * 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 )
       {
  @@ -110,21 +109,14 @@
       protected int run( final Commandline cmd, final ExecOutputHandler handler )
           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();
       }
   }
  
  
  
  1.19      +6 -14     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  
  Index: ClearCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ClearCase.java	10 Feb 2002 00:46:51 -0000	1.18
  +++ ClearCase.java	10 Feb 2002 01:01:13 -0000	1.19
  @@ -8,11 +8,10 @@
   package org.apache.tools.ant.taskdefs.optional.clearcase;
   
   import java.io.File;
  -import java.io.IOException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.Task;
   import org.apache.myrmidon.framework.Execute;
  +import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Commandline;
   
   /**
  @@ -106,18 +105,11 @@
       protected int run( Commandline cmd )
           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();
       }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message