diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java index 7da5556ee..e8dc4fd15 100644 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java @@ -614,8 +614,7 @@ public class ComponentManager implements ComponentService { e.setLocation(location, false); throw e; } catch (RuntimeException e) { - throw new ExecutionException(e.getClass().getName() + ": " - + e.getMessage(), e, location); + throw new ExecutionException(e, location); } } @@ -662,8 +661,7 @@ public class ComponentManager implements ComponentService { e.setLocation(model.getLocation(), false); throw e; } catch (RuntimeException e) { - throw new ExecutionException(e.getClass().getName() + ": " - + e.getMessage(), e, model.getLocation()); + throw new ExecutionException(e, model.getLocation()); } } @@ -786,8 +784,7 @@ public class ComponentManager implements ComponentService { e.setLocation(model.getLocation(), false); throw e; } catch (RuntimeException e) { - throw new ExecutionException(e.getClass().getName() + ": " - + e.getMessage(), e, model.getLocation()); + throw new ExecutionException(e, model.getLocation()); } } diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java index 7bd4009b3..276b47743 100644 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java @@ -118,10 +118,12 @@ public class CoreExecService implements ExecService { task.execute(); LoaderUtils.setContextLoader(currentLoader); + } catch (ExecutionException e) { + failureCause = e; + throw e; } catch (Throwable e) { ExecutionException ee = - new ExecutionException(e.getClass().getName() + ": " - + e.getMessage(), e); + new ExecutionException(e); failureCause = ee; throw ee; diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java index 0bc3f06d8..7efef0ff0 100644 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java @@ -72,7 +72,6 @@ import org.apache.ant.common.service.EventService; import org.apache.ant.common.service.ExecService; import org.apache.ant.common.service.FileService; import org.apache.ant.common.service.MagicProperties; -import org.apache.ant.common.util.AntException; import org.apache.ant.common.util.ConfigException; import org.apache.ant.common.util.DemuxOutputReceiver; import org.apache.ant.common.util.ExecutionException; @@ -696,16 +695,12 @@ public class Frame implements DemuxOutputReceiver { setDataValue(typeId, component, true); } } - } catch (AntException te) { - ExecutionException e - = new ExecutionException(te, te.getLocation()); - + } catch (ExecutionException e) { e.setLocation(model.getLocation(), false); throw e; } catch (RuntimeException e) { ExecutionException ee = - new ExecutionException(e.getClass().getName() + ": " - + e.getMessage(), e, model.getLocation()); + new ExecutionException(e, model.getLocation()); throw ee; } @@ -755,8 +750,7 @@ public class Frame implements DemuxOutputReceiver { throw e; } catch (RuntimeException e) { ExecutionException ee = - new ExecutionException(e.getClass().getName() + ": " - + e.getMessage(), e, target.getLocation()); + new ExecutionException(e, target.getLocation()); failureCause = ee; throw ee; diff --git a/proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java b/proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java index 3fd74f414..d0b25f154 100755 --- a/proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java +++ b/proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java @@ -174,7 +174,7 @@ public class DefaultLogger implements BuildLogger { t.printStackTrace(out); } - if (cause != null) { + if (!cause.getMessage().equals(t.getMessage())) { out.println("Root cause: " + cause.toString()); } } else { diff --git a/proposal/mutant/src/java/common/org/apache/ant/common/util/AntException.java b/proposal/mutant/src/java/common/org/apache/ant/common/util/AntException.java index 3d7ba6bf9..7ae63c48f 100755 --- a/proposal/mutant/src/java/common/org/apache/ant/common/util/AntException.java +++ b/proposal/mutant/src/java/common/org/apache/ant/common/util/AntException.java @@ -114,7 +114,8 @@ public abstract class AntException extends Exception { * @param cause Exception that might have caused this one. */ public AntException(Throwable cause) { - super(cause.getMessage()); + super(cause.getMessage() == null + ? cause.getClass().getName() : cause.getMessage()); this.cause = cause; }