Author: mbenson
Date: Mon Jun 25 11:55:18 2007
New Revision: 550573
URL: http://svn.apache.org/viewvc?view=rev&rev=550573
Log:
refactoring to ease extension
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java?view=diff&rev=550573&r1=550572&r2=550573
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java Mon Jun 25
11:55:18 2007
@@ -101,6 +101,7 @@
int err = -1;
try {
+ checkConfiguration();
err = executeJava();
if (err != 0) {
if (failOnError) {
@@ -128,6 +129,14 @@
* @throws BuildException if required parameters are missing.
*/
public int executeJava() throws BuildException {
+ return executeJava(getCommandLine());
+ }
+
+ /**
+ * Check configuration.
+ * @throws BuildException if required parameters are missing.
+ */
+ protected void checkConfiguration() throws BuildException {
String classname = getCommandLine().getClassname();
if (classname == null && getCommandLine().getJar() == null) {
throw new BuildException("Classname must not be null.");
@@ -188,17 +197,24 @@
Project.MSG_VERBOSE);
}
setupRedirector();
+ }
+
+ /**
+ * Execute the specified CommandlineJava.
+ * @param commandLine CommandLineJava instance.
+ */
+ protected int executeJava(CommandlineJava commandLine) {
try {
if (fork) {
if (!spawn) {
- return fork(getCommandLine().getCommandline());
+ return fork(commandLine.getCommandline());
} else {
- spawn(getCommandLine().getCommandline());
+ spawn(commandLine.getCommandline());
return 0;
}
} else {
try {
- run(getCommandLine());
+ run(commandLine);
return 0;
} catch (ExitException ex) {
return ex.getStatus();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]