diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java index e803118ac..730176148 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -106,7 +106,7 @@ public class Main { new Main(args).runBuild(); } - protected Main(String[] args) { + protected Main(String[] args) throws BuildException { // cycle through given args @@ -216,7 +216,7 @@ public class Main { * Executes the build. */ - private void runBuild() { + private void runBuild() throws BuildException { if (!readyToRun) { return; @@ -265,7 +265,7 @@ public class Main { } else { be.getException().printStackTrace(); } - System.exit(1); + throw be; } // make sure that we have a target to execute @@ -282,7 +282,7 @@ public class Main { if (msgOutputLevel > Project.MSG_INFO) { be.printStackTrace(); } - System.exit(1); + throw be; } // track our stop time and let the user know how long things took. diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 538b1f16d..a2cac7336 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -116,7 +116,7 @@ public class Project { * This involves setting the default task definitions and loading the * system properties. */ - public void init() { + public void init() throws BuildException { detectJavaVersion(); String defs = "/org/apache/tools/ant/taskdefs/defaults.properties"; @@ -149,9 +149,7 @@ public class Project { this.setProperty(name, value); } } 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"); } }