peterreilly    2004/06/10 02:11:51

  Modified:    src/main/org/apache/tools/ant Task.java
  Log:
  get Task#perform() to wrap all exceptions with a buildexception
  
  Revision  Changes    Path
  1.58      +12 -8     ant/src/main/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Task.java,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- Task.java 10 Jun 2004 08:23:50 -0000      1.57
  +++ Task.java 10 Jun 2004 09:11:51 -0000      1.58
  @@ -362,15 +362,19 @@
               try {
                   maybeConfigure();
                   execute();
  -            } catch (RuntimeException exc) {
  -                if (exc instanceof BuildException) {
  -                    BuildException be = (BuildException) exc;
  -                    if (be.getLocation() == Location.UNKNOWN_LOCATION) {
  -                        be.setLocation(getLocation());
  -                    }
  +            } catch (BuildException ex) {
  +                if (ex.getLocation() == Location.UNKNOWN_LOCATION) {
  +                    ex.setLocation(getLocation());
                   }
  -                reason = exc;
  -                throw exc;
  +                reason = ex;
  +            } catch (Exception ex) {
  +                reason = ex;
  +                BuildException be = new BuildException(ex);
  +                be.setLocation(getLocation());
  +                throw be;
  +            } catch (Error ex) {
  +                reason = ex;
  +                throw ex;
               } finally {
                   getProject().fireTaskFinished(this, reason);
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to