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/types CommandlineJava.java
Date Sat, 22 Dec 2001 23:55:38 GMT
donaldp     01/12/22 15:55:38

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Property.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec
                        Execute.java
               proposal/myrmidon/src/main/org/apache/tools/ant/types
                        CommandlineJava.java
  Log:
  Convert from using TaskException to ExecException
  
  Revision  Changes    Path
  1.15      +5 -0      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Property.java	2001/12/22 13:00:02	1.14
  +++ Property.java	2001/12/22 23:55:38	1.15
  @@ -16,6 +16,7 @@
   import java.util.Properties;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.exec.Environment;
  +import org.apache.myrmidon.framework.exec.ExecException;
   import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
  @@ -231,6 +232,10 @@
                       props.put( prefix + key, value );
                   }
               }
  +        }
  +        catch( final ExecException ee )
  +        {
  +            throw new TaskException( ee.getMessage(), ee );
           }
           catch( final IOException ioe )
           {
  
  
  
  1.14      +52 -44    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java
  
  Index: Execute.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Execute.java	2001/12/22 23:35:29	1.13
  +++ Execute.java	2001/12/22 23:55:38	1.14
  @@ -16,6 +16,7 @@
   import org.apache.myrmidon.framework.Os;
   import org.apache.myrmidon.framework.exec.CommandLauncher;
   import org.apache.myrmidon.framework.exec.Environment;
  +import org.apache.myrmidon.framework.exec.ExecException;
   import org.apache.myrmidon.framework.exec.ExecMetaData;
   import org.apache.myrmidon.framework.exec.launchers.DefaultCommandLauncher;
   import org.apache.myrmidon.framework.exec.launchers.MacCommandLauncher;
  @@ -269,58 +270,65 @@
           throws IOException, TaskException
       {
   
  -        final ExecMetaData metaData =
  -            new ExecMetaData( m_command, getNativeEnvironment(),
  -                              m_workingDirectory, false );
  -
  -        final CommandLauncher launcher = getLauncher();
  -        final Process process = launcher.exec( metaData );
  -
           try
  -        {
  -            m_streamHandler.setProcessInputStream( process.getOutputStream() );
  -            m_streamHandler.setProcessOutputStream( process.getInputStream() );
  -            m_streamHandler.setProcessErrorStream( process.getErrorStream() );
  -        }
  -        catch( final IOException ioe )
           {
  -            process.destroy();
  -            throw ioe;
  -        }
  +            final ExecMetaData metaData =
  +                new ExecMetaData( m_command, getNativeEnvironment(),
  +                                  m_workingDirectory, false );
   
  -        m_streamHandler.start();
  +            final CommandLauncher launcher = getLauncher();
  +            final Process process = launcher.exec( metaData );
   
  -        // add the process to the list of those to destroy if the VM exits
  -        //
  -        c_processDestroyer.add( process );
  +            try
  +            {
  +                m_streamHandler.setProcessInputStream( process.getOutputStream() );
  +                m_streamHandler.setProcessOutputStream( process.getInputStream() );
  +                m_streamHandler.setProcessErrorStream( process.getErrorStream() );
  +            }
  +            catch( final IOException ioe )
  +            {
  +                process.destroy();
  +                throw ioe;
  +            }
   
  -        if( m_watchdog != null )
  -        {
  -            m_watchdog.start( process );
  -        }
  -        try
  -        {
  -            process.waitFor();
  -        }
  -        catch( final InterruptedException ie )
  -        {
  -            //shu\ould never happen
  -        }
  +            m_streamHandler.start();
   
  -        // remove the process to the list of those to destroy if the VM exits
  -        //
  -        c_processDestroyer.remove( process );
  +            // add the process to the list of those to destroy if the VM exits
  +            //
  +            c_processDestroyer.add( process );
   
  -        if( m_watchdog != null )
  -        {
  -            m_watchdog.stop();
  +            if( m_watchdog != null )
  +            {
  +                m_watchdog.start( process );
  +            }
  +            try
  +            {
  +                process.waitFor();
  +            }
  +            catch( final InterruptedException ie )
  +            {
  +                //shu\ould never happen
  +            }
  +
  +            // remove the process to the list of those to destroy if the VM exits
  +            //
  +            c_processDestroyer.remove( process );
  +
  +            if( m_watchdog != null )
  +            {
  +                m_watchdog.stop();
  +            }
  +            m_streamHandler.stop();
  +            if( m_watchdog != null )
  +            {
  +                m_watchdog.checkException();
  +            }
  +            return process.exitValue();
           }
  -        m_streamHandler.stop();
  -        if( m_watchdog != null )
  +        catch( final ExecException ee )
           {
  -            m_watchdog.checkException();
  +            throw new TaskException( ee.getMessage(), ee );
           }
  -        return process.exitValue();
       }
   
       private CommandLauncher getLauncher()
  @@ -339,7 +347,7 @@
        * @return the environment used to create a subprocess
        */
       private String[] getNativeEnvironment()
  -        throws TaskException
  +        throws ExecException
       {
           if( m_newEnvironment )
           {
  @@ -354,7 +362,7 @@
               }
               catch( final IOException ioe )
               {
  -                throw new TaskException( ioe.getMessage(), ioe );
  +                throw new ExecException( ioe.getMessage(), ioe );
               }
           }
       }
  
  
  
  1.8       +10 -1     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java
  
  Index: CommandlineJava.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CommandlineJava.java	2001/12/22 22:01:58	1.7
  +++ CommandlineJava.java	2001/12/22 23:55:38	1.8
  @@ -13,6 +13,7 @@
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.Os;
   import org.apache.myrmidon.framework.exec.Environment;
  +import org.apache.myrmidon.framework.exec.ExecException;
   import org.apache.tools.ant.Project;
   
   /**
  @@ -355,7 +356,15 @@
           public String[] getJavaVariables()
               throws TaskException
           {
  -            String props[] = Environment.toNativeFormat( super.getVariables() );
  +            String props[] = new String[ 0 ];
  +            try
  +            {
  +                props = Environment.toNativeFormat( super.getVariables() );
  +            }
  +            catch( final ExecException ee )
  +            {
  +                throw new TaskException( ee.getMessage(), ee );
  +            }
   
               if( props == null )
                   return null;
  
  
  

--
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