Browse Source

Remove System.exit calls.

These have been replaced by propagating BuildExceptions. This will allow ant
to be more easily used from GUIs, IDEs, etc


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267698 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 25 years ago
parent
commit
948ce9bca7
2 changed files with 6 additions and 8 deletions
  1. +4
    -4
      src/main/org/apache/tools/ant/Main.java
  2. +2
    -4
      src/main/org/apache/tools/ant/Project.java

+ 4
- 4
src/main/org/apache/tools/ant/Main.java View File

@@ -106,7 +106,7 @@ public class Main {
new Main(args).runBuild(); new Main(args).runBuild();
} }


protected Main(String[] args) {
protected Main(String[] args) throws BuildException {


// cycle through given args // cycle through given args


@@ -216,7 +216,7 @@ public class Main {
* Executes the build. * Executes the build.
*/ */


private void runBuild() {
private void runBuild() throws BuildException {


if (!readyToRun) { if (!readyToRun) {
return; return;
@@ -265,7 +265,7 @@ public class Main {
} else { } else {
be.getException().printStackTrace(); be.getException().printStackTrace();
} }
System.exit(1);
throw be;
} }


// make sure that we have a target to execute // make sure that we have a target to execute
@@ -282,7 +282,7 @@ public class Main {
if (msgOutputLevel > Project.MSG_INFO) { if (msgOutputLevel > Project.MSG_INFO) {
be.printStackTrace(); be.printStackTrace();
} }
System.exit(1);
throw be;
} }


// track our stop time and let the user know how long things took. // track our stop time and let the user know how long things took.


+ 2
- 4
src/main/org/apache/tools/ant/Project.java View File

@@ -116,7 +116,7 @@ public class Project {
* This involves setting the default task definitions and loading the * This involves setting the default task definitions and loading the
* system properties. * system properties.
*/ */
public void init() {
public void init() throws BuildException {
detectJavaVersion(); detectJavaVersion();


String defs = "/org/apache/tools/ant/taskdefs/defaults.properties"; String defs = "/org/apache/tools/ant/taskdefs/defaults.properties";
@@ -149,9 +149,7 @@ public class Project {
this.setProperty(name, value); this.setProperty(name, value);
} }
} catch (IOException ioe) { } catch (IOException ioe) {
String msg = "Can't load default task list";
System.out.println(msg);
System.exit(1);
throw new BuildException("Can't load default task list");
} }
} }




Loading…
Cancel
Save