You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2001/07/30 16:07:31 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Execute.java

conor       01/07/30 07:07:31

  Modified:    src/main/org/apache/tools/ant/taskdefs Execute.java
  Log:
  Add some better error management for exec errors. By wrapping the real
  exception in a build exception, hopefully we'll get a stack trace
  
  PR:	2542
  
  Revision  Changes    Path
  1.19      +4 -4      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
  
  Index: Execute.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Execute.java	2001/07/06 11:14:55	1.18
  +++ Execute.java	2001/07/30 14:07:31	1.19
  @@ -563,7 +563,7 @@
                   Object[] arguments = { cmd, env, workingDir };
                   return (Process)_execWithCWD.invoke(Runtime.getRuntime(), arguments);
               } 
  -            catch ( InvocationTargetException exc ) {
  +            catch (InvocationTargetException exc) {
                   Throwable realexc = exc.getTargetException();
                   if ( realexc instanceof ThreadDeath ) {
                       throw (ThreadDeath)realexc;
  @@ -572,12 +572,12 @@
                       throw (IOException)realexc;
                   } 
                   else {
  -                    throw new IOException(realexc.getMessage());
  +                    throw new BuildException("Unable to execute command", realexc);
                   }
               } 
  -            catch ( Exception exc ) {
  +            catch (Exception exc) {
                   // IllegalAccess, IllegalArgument, ClassCast
  -                throw new IOException(exc.getMessage());
  +                throw new BuildException("Unable to execute command", exc);
               }
           }