You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ad...@apache.org on 2002/05/28 05:55:42 UTC
cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor ReportableTaskException.java DefaultExecutor.java
adammurdoch 02/05/27 20:55:42
Modified: antlib/src/test/org/apache/antlib
AbstractProjectTestCase.java
container/src/java/org/apache/myrmidon/components/executor
DefaultExecutor.java
Added: container/src/java/org/apache/myrmidon/components/executor
ReportableTaskException.java
Log:
Changed DefaultExecutor to report only the inner-most 'task <blah> failed' error.
Gets rid of the annoying 'task <target> failed' messages.
Revision Changes Path
1.5 +4 -4 jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/AbstractProjectTestCase.java
Index: AbstractProjectTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/test/org/apache/antlib/AbstractProjectTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractProjectTestCase.java 27 May 2002 07:03:53 -0000 1.4
+++ AbstractProjectTestCase.java 28 May 2002 03:55:41 -0000 1.5
@@ -18,7 +18,7 @@
* A base class for test cases which need to execute projects or tasks.
*
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
- * @version $Revision: 1.4 $ $Date: 2002/05/27 07:03:53 $
+ * @version $Revision: 1.5 $ $Date: 2002/05/28 03:55:41 $
*/
public class AbstractProjectTestCase
extends AbstractAutTestCase
@@ -63,9 +63,9 @@
}
catch( final Exception e )
{
- // Add in the 'could not execute task <blah>' messages
- final String[] allMessages = new String[ 2 + messages.length ];
- System.arraycopy( messages, 0, allMessages, 2, messages.length );
+ // Add in the 'could not execute task <blah>' message
+ final String[] allMessages = new String[ 1 + messages.length ];
+ System.arraycopy( messages, 0, allMessages, 1, messages.length );
assertSameMessage( allMessages, e );
}
}
1.42 +10 -4 jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java
Index: DefaultExecutor.java
===================================================================
RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor/DefaultExecutor.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- DefaultExecutor.java 11 May 2002 12:44:00 -0000 1.41
+++ DefaultExecutor.java 28 May 2002 03:55:42 -0000 1.42
@@ -26,7 +26,7 @@
* The basic executor that just executes the tasks.
*
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision: 1.41 $ $Date: 2002/05/11 12:44:00 $
+ * @version $Revision: 1.42 $ $Date: 2002/05/28 03:55:42 $
*/
public class DefaultExecutor
extends AbstractLogEnabled
@@ -84,12 +84,18 @@
debug( "executing.notice", taskName );
doTaskExecute( taskModel, task );
}
- catch( Exception e )
+ catch( final ReportableTaskException e )
{
- // Wrap in generic error message
+ // A nested 'could not execute task <blah>' exception. Rethrow it
+ // without wrapping it
+ throw e;
+ }
+ catch( final Exception e )
+ {
+ // Wrap exception in generic error message
final String message = REZ.getString( "execute.error",
taskName, taskModel.getLocation() );
- throw new TaskException( message, e );
+ throw new ReportableTaskException( message, e );
}
}
1.1 jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/executor/ReportableTaskException.java
Index: ReportableTaskException.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.myrmidon.components.executor;
import org.apache.myrmidon.api.TaskException;
/**
* A marker exception.
*
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/05/28 03:55:42 $
*/
class ReportableTaskException
extends TaskException
{
/**
* Constructor that builds cascade so that other exception information can be retained.
* @param message the message
* @param throwable the throwable
*/
public ReportableTaskException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>