Browse Source

Improved output and error checking in <java>.

Submitted by:	Diane Holt <holtdl@yahoo.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268021 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
6b11d7b61e
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      src/main/org/apache/tools/ant/taskdefs/Java.java

+ 12
- 3
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -103,13 +103,14 @@ public class Java extends Task {
*/
public int executeJava() throws BuildException {
String classname = cmdl.getClassname();
log("Calling " + classname, Project.MSG_VERBOSE);

if (classname == null) {
throw new BuildException("Classname must not be null.");
}

if (fork) {
log("Forking " + cmdl.toString(), Project.MSG_VERBOSE);
return run(cmdl.getCommandline());
} else {
if (cmdl.getVmCommand().size() > 1) {
@@ -118,7 +119,9 @@ public class Java extends Task {
if (dir != null) {
log("Working directory ignored when same JVM is used.", Project.MSG_WARN);
}

log("Running in same VM " + cmdl.getJavaCommand().toString(),
Project.MSG_VERBOSE);
run(cmdl);
return 0;
}
@@ -247,7 +250,13 @@ public class Java extends Task {
exe.setAntRun(project);

if (dir == null) dir = project.getBaseDir();
if (dir == null) {
dir = project.getBaseDir();
} else if (!dir.exists() || !dir.isDirectory()) {
throw new BuildException(dir.getAbsolutePath()+" is not a valid directory",
location);
}

exe.setWorkingDirectory(dir);

exe.setCommandline(command);


Loading…
Cancel
Save