Browse Source

Avoid NPE's - seen when running JUnit on Win2K

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269443 13f79535-47bb-0310-9956-ffa450edef68
master
Sam Ruby 24 years ago
parent
commit
198880a644
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Execute.java
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

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

@@ -627,7 +627,7 @@ public class Execute {
public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException public Process exec(Project project, String[] cmd, String[] env, File workingDir) throws IOException
{ {
File commandDir = workingDir; File commandDir = workingDir;
if ( workingDir == null ) {
if ( workingDir == null && project != null ) {
commandDir = project.getBaseDir(); commandDir = project.getBaseDir();
} }


@@ -712,7 +712,7 @@ public class Execute {


// Build the command // Build the command
File commandDir = workingDir; File commandDir = workingDir;
if ( workingDir == null ) {
if ( workingDir == null && project != null ) {
commandDir = project.getBaseDir(); commandDir = project.getBaseDir();
} }




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

@@ -488,9 +488,9 @@ public class JUnitTask extends Task {


Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN), watchdog); Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN), watchdog);
execute.setCommandline(cmd.getCommandline()); execute.setCommandline(cmd.getCommandline());
execute.setAntRun(project);
if (dir != null) { if (dir != null) {
execute.setWorkingDirectory(dir); execute.setWorkingDirectory(dir);
execute.setAntRun(project);
} }


log("Executing: "+cmd.toString(), Project.MSG_VERBOSE); log("Executing: "+cmd.toString(), Project.MSG_VERBOSE);


Loading…
Cancel
Save