Browse Source

Use Execute.isFailure

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274951 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
d47dfcbc98
32 changed files with 54 additions and 50 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Execute.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java
  4. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/Java.java
  5. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  6. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
  7. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  8. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
  9. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
  10. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
  11. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java
  12. +3
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java
  13. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java
  14. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCLock.java
  15. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkbl.java
  16. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java
  17. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java
  18. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java
  19. +3
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java
  20. +2
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnlock.java
  21. +3
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java
  22. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  23. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  24. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java
  25. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  26. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  27. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  28. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  29. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  30. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  31. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  32. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java View File

@@ -372,7 +372,7 @@ public abstract class AbstractCvsTask extends Task {
int retCode = exe.execute();
log("retCode=" + retCode, Project.MSG_DEBUG);
/*Throw an exception if cvs exited with error. (Iulian)*/
if (failOnError && retCode != 0) {
if (failOnError && Execute.isFailure(retCode)) {
throw new BuildException("cvs exited with error code "
+ retCode
+ StringUtils.LINE_SEP


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -577,7 +577,7 @@ public class Execute {
exe.setAntRun(task.getProject());
exe.setCommandline(cmdline);
int retval = exe.execute();
if (retval != 0) {
if (isFailure(retval)) {
throw new BuildException(cmdline[0]
+ " failed with return code " + retval, task.getLocation());
}


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -66,7 +66,7 @@ import org.apache.tools.ant.util.Watchdog;
* Execute exec = new Execute(myloghandler, watchdog);
* exec.setCommandLine(mycmdline);
* int exitvalue = exec.execute();
* if (exitvalue != SUCCESS && watchdog.killedProcess()) {
* if (Execute.isFailure(exitvalue) && watchdog.killedProcess()) {
* // it was killed on purpose by the watchdog
* }
* </pre>


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -102,7 +102,8 @@ public class Java extends Task {

int err = -1;
try {
if ((err = executeJava()) != 0) {
err = executeJava();
if (fork && Execute.isFailure(err)) {
if (failOnError) {
throw new BuildException("Java returned: " + err, getLocation());
} else {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1984,7 +1984,7 @@ public class Javadoc extends Task {
try {
exe.setCommandline(toExecute.getCommandline());
int ret = exe.execute();
if (ret != 0 && failOnError) {
if (Execute.isFailure(ret) && failOnError) {
throw new BuildException("Javadoc returned " + ret, getLocation());
}
} catch (IOException e) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -286,7 +286,7 @@ public class ChangeLogTask extends Task {
try {
final int resultCode = exe.execute();

if (0 != resultCode) {
if (Execute.isFailure(resultCode)) {
throw new BuildException("Error running cvs log");
}
} catch (final IOException ioe) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -318,7 +318,7 @@ public class ANTLR extends Task {

log(commandline.describeCommand(), Project.MSG_VERBOSE);
int err = run(commandline.getCommandline());
if (err == 1) {
if (Execute.isFailure(err)) {
throw new BuildException("ANTLR returned: " + err, getLocation());
} else {
String output = bos.toString();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/Cab.java View File

@@ -303,7 +303,7 @@ public class Cab extends MatchingTask {
}

// Informative summary message in case of errors
if (result != 0) {
if (Execute.isFailure(result)) {
log("Error executing listcab; error code: " + result);
}
} catch (IOException ex) {


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java View File

@@ -60,6 +60,7 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet;

@@ -197,7 +198,7 @@ public class CCMCheck extends Continuus {
checkOptions(commandLine);

int result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(0)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -62,6 +62,7 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
import org.apache.tools.ant.types.Commandline;

@@ -107,7 +108,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler {
checkOptions(commandLine);

result = run(commandLine, this);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java View File

@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.ccm;


import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;


@@ -94,7 +95,7 @@ public class CCMReconfigure extends Continuus {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 3
- 5
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,11 +56,9 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;




/**
* Performs ClearCase checkin.
*
@@ -144,7 +142,7 @@ public class CCCheckin extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;


@@ -156,7 +157,7 @@ public class CCCheckout extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCLock.java View File

@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;


@@ -148,7 +149,7 @@ public class CCLock extends ClearCase {
System.out.println(commandLine.toString());

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMkbl.java View File

@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;

/**
@@ -145,7 +146,7 @@ public class CCMkbl extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}
@@ -393,4 +394,4 @@ public class CCMkbl extends ClearCase {
public static final String FLAG_NLABEL = "-nlabel";


}
}

+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklabel.java View File

@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;

/**
@@ -151,7 +152,7 @@ public class CCMklabel extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCMklbtype.java View File

@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;

/**
@@ -160,7 +161,7 @@ public class CCMklbtype extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCRmtype.java View File

@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;

/**
@@ -153,7 +154,7 @@ public class CCRmtype extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 3
- 5
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,11 +56,9 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;




/**
* Performs ClearCase UnCheckout command.
*
@@ -114,7 +112,7 @@ public class CCUnCheckout extends ClearCase {
checkOptions(commandLine);

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 2
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnlock.java View File

@@ -56,6 +56,7 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;

/**
@@ -128,7 +129,7 @@ public class CCUnlock extends ClearCase {
System.out.println(commandLine.toString());

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, location);
}


+ 3
- 6
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,12 +56,9 @@ package org.apache.tools.ant.taskdefs.optional.clearcase;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.types.Commandline;





/**
* Performs a ClearCase Update command.
*
@@ -151,7 +148,7 @@ public class CCUpdate extends ClearCase {
System.out.println(commandLine.toString());

result = run(commandLine);
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java View File

@@ -251,7 +251,7 @@ public class NetCommand {
}
executable.setCommandline(commandLine.getCommandline());
err = executable.execute();
if (err != 0) {
if (Execute.isFailure(err)) {
if (failOnError) {
throw new BuildException(title + " returned: " + err, owner.getLocation());
} else {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java View File

@@ -460,7 +460,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool
log(commandline.describeCommand(), Project.MSG_DEBUG);
execTask.setCommandline(commandline.getCommandline());
int result = execTask.execute();
if (result != 0) {
if (Execute.isFailure(result)) {
String msg = "Failed executing java2iiop (ret code is "
+ result + ")";
throw new BuildException(msg, getTask().getLocation());


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJDoc.java View File

@@ -194,7 +194,7 @@ public class JJDoc extends Task {
process.setCommandline(cmdl.getCommandline());

try {
if (process.execute() != 0) {
if (Execute.isFailure(process.execute())) {
throw new BuildException("JJDoc failed.");
}
} catch (IOException e) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -290,7 +290,7 @@ public class JJTree extends Task {
process.setCommandline(cmdl.getCommandline());

try {
if (process.execute() != 0) {
if (Execute.isFailure(process.execute())) {
throw new BuildException("JJTree failed.");
}
} catch (IOException e) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -246,7 +246,7 @@ public abstract class AbstractMetamataTask extends Task {
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
process.setCommandline(cmdl.getCommandline());
try {
if (process.execute() != 0) {
if (Execute.isFailure(process.execute())) {
throw new BuildException("Metamata task failed.");
}
} catch (IOException e) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -183,7 +183,7 @@ public class MParse extends AbstractMetamataTask {
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
process.setCommandline(cmdl.getCommandline());
try {
if (process.execute() != 0) {
if (Execute.isFailure(process.execute())) {
throw new BuildException("Metamata task failed.");
}
} catch (IOException e) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java View File

@@ -236,7 +236,7 @@ public class Pvcs extends org.apache.tools.ant.Task {
fos.close();
}

if (result != 0 && !ignorerc) {
if (Execute.isFailure(result) && !ignorerc) {
String msg = "Failed executing: " + commandLine.toString();
throw new BuildException(msg, getLocation());
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java View File

@@ -139,7 +139,7 @@ public class CovMerge extends CovBase {
// JProbe process always return 0 so we will not be
// able to check for failure ! :-(
int exitValue = exec.execute();
if (exitValue != 0) {
if (Execute.isFailure(exitValue)) {
throw new BuildException("JProbe Coverage Merging failed (" + exitValue + ")");
}
} catch (IOException e) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java View File

@@ -300,7 +300,7 @@ public class CovReport extends CovBase {
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
exec.setCommandline(cmdl.getCommandline());
int exitValue = exec.execute();
if (exitValue != 0) {
if (Execute.isFailure(exitValue)) {
throw new BuildException("JProbe Coverage Report failed ("
+ exitValue + ")");
}


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java View File

@@ -331,7 +331,7 @@ public class Coverage extends CovBase {
log(cmdl.describeCommand(), Project.MSG_VERBOSE);
exec.setCommandline(cmdl.getCommandline());
int exitValue = exec.execute();
if (exitValue != 0) {
if (Execute.isFailure(exitValue)) {
throw new BuildException("JProbe Coverage failed (" + exitValue + ")");
}
} catch (IOException e) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -222,7 +222,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants {
int result = 0;
Commandline commandLine = buildCmdLine();
result = run(commandLine);
if (result != 0 && getFailOnError()) {
if (Execute.isFailure(result) && getFailOnError()) {
String msg = "Failed executing: " + formatCommandLine(commandLine)
+ " With a return code of " + result;
throw new BuildException(msg, getLocation());


Loading…
Cancel
Save