Browse Source

Better error reporting for mutant

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272380 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 23 years ago
parent
commit
a3a3b03fb1
5 changed files with 13 additions and 19 deletions
  1. +3
    -6
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java
  2. +4
    -2
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java
  3. +3
    -9
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java
  4. +1
    -1
      proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java
  5. +2
    -1
      proposal/mutant/src/java/common/org/apache/ant/common/util/AntException.java

+ 3
- 6
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java View File

@@ -614,8 +614,7 @@ public class ComponentManager implements ComponentService {
e.setLocation(location, false); e.setLocation(location, false);
throw e; throw e;
} catch (RuntimeException 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); e.setLocation(model.getLocation(), false);
throw e; throw e;
} catch (RuntimeException 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); e.setLocation(model.getLocation(), false);
throw e; throw e;
} catch (RuntimeException e) { } catch (RuntimeException e) {
throw new ExecutionException(e.getClass().getName() + ": "
+ e.getMessage(), e, model.getLocation());
throw new ExecutionException(e, model.getLocation());
} }
} }




+ 4
- 2
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/CoreExecService.java View File

@@ -118,10 +118,12 @@ public class CoreExecService implements ExecService {


task.execute(); task.execute();
LoaderUtils.setContextLoader(currentLoader); LoaderUtils.setContextLoader(currentLoader);
} catch (ExecutionException e) {
failureCause = e;
throw e;
} catch (Throwable e) { } catch (Throwable e) {
ExecutionException ee = ExecutionException ee =
new ExecutionException(e.getClass().getName() + ": "
+ e.getMessage(), e);
new ExecutionException(e);


failureCause = ee; failureCause = ee;
throw ee; throw ee;


+ 3
- 9
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java View File

@@ -72,7 +72,6 @@ import org.apache.ant.common.service.EventService;
import org.apache.ant.common.service.ExecService; import org.apache.ant.common.service.ExecService;
import org.apache.ant.common.service.FileService; import org.apache.ant.common.service.FileService;
import org.apache.ant.common.service.MagicProperties; 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.ConfigException;
import org.apache.ant.common.util.DemuxOutputReceiver; import org.apache.ant.common.util.DemuxOutputReceiver;
import org.apache.ant.common.util.ExecutionException; import org.apache.ant.common.util.ExecutionException;
@@ -696,16 +695,12 @@ public class Frame implements DemuxOutputReceiver {
setDataValue(typeId, component, true); setDataValue(typeId, component, true);
} }
} }
} catch (AntException te) {
ExecutionException e
= new ExecutionException(te, te.getLocation());

} catch (ExecutionException e) {
e.setLocation(model.getLocation(), false); e.setLocation(model.getLocation(), false);
throw e; throw e;
} catch (RuntimeException e) { } catch (RuntimeException e) {
ExecutionException ee = ExecutionException ee =
new ExecutionException(e.getClass().getName() + ": "
+ e.getMessage(), e, model.getLocation());
new ExecutionException(e, model.getLocation());


throw ee; throw ee;
} }
@@ -755,8 +750,7 @@ public class Frame implements DemuxOutputReceiver {
throw e; throw e;
} catch (RuntimeException e) { } catch (RuntimeException e) {
ExecutionException ee = ExecutionException ee =
new ExecutionException(e.getClass().getName() + ": "
+ e.getMessage(), e, target.getLocation());
new ExecutionException(e, target.getLocation());


failureCause = ee; failureCause = ee;
throw ee; throw ee;


+ 1
- 1
proposal/mutant/src/java/cli/org/apache/ant/cli/DefaultLogger.java View File

@@ -174,7 +174,7 @@ public class DefaultLogger implements BuildLogger {
t.printStackTrace(out); t.printStackTrace(out);
} }


if (cause != null) {
if (!cause.getMessage().equals(t.getMessage())) {
out.println("Root cause: " + cause.toString()); out.println("Root cause: " + cause.toString());
} }
} else { } else {


+ 2
- 1
proposal/mutant/src/java/common/org/apache/ant/common/util/AntException.java View File

@@ -114,7 +114,8 @@ public abstract class AntException extends Exception {
* @param cause Exception that might have caused this one. * @param cause Exception that might have caused this one.
*/ */
public AntException(Throwable cause) { public AntException(Throwable cause) {
super(cause.getMessage());
super(cause.getMessage() == null
? cause.getClass().getName() : cause.getMessage());
this.cause = cause; this.cause = cause;
} }




Loading…
Cancel
Save