Browse Source

1) Correct potential infinite loops when parsing invalid Java source

2) Correct Stefano's mailing address
3) Correct handling of escaped quotes in strings
4) Return exit code from the exec'd process as it may be useful

Submitted by: Michael Smith <michael@sneakerlabs.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267590 13f79535-47bb-0310-9956-ffa450edef68
master
Sam Ruby 25 years ago
parent
commit
35c0faa1a2
2 changed files with 14 additions and 9 deletions
  1. +7
    -3
      src/main/org/apache/tools/ant/taskdefs/Exec.java
  2. +7
    -6
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java

+ 7
- 3
src/main/org/apache/tools/ant/taskdefs/Exec.java View File

@@ -76,7 +76,9 @@ public class Exec extends Task {
run(command);
}

protected void run(String command) throws BuildException {
protected int run(String command) throws BuildException {

int err = -1; // assume the worst

// test if os match
String myos = System.getProperty("os.name");
@@ -84,7 +86,7 @@ public class Exec extends Task {
if ((os != null) && (os.indexOf(myos) < 0)){
// this command will be executed only on the specified OS
project.log("Not found in " + os, Project.MSG_VERBOSE);
return;
return 0;
}

if (myos.toLowerCase().indexOf("windows") >= 0) {
@@ -131,13 +133,15 @@ public class Exec extends Task {
if (fos != null) fos.close();

// check its exit value
int err = proc.exitValue();
err = proc.exitValue();
if (err != 0) {
project.log("Result: " + err, "exec", Project.MSG_ERR);
}
} catch (IOException ioe) {
throw new BuildException("Error exec: " + command );
} catch (InterruptedException ex) {}

return err;
}

public void setDir(String d) {


+ 7
- 6
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -74,7 +74,7 @@ import java.util.*;
* System.exit() that would break Ant functionality.
*
* @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
* @author Stefano Mazzocchi <a href="mailto:stefano@pache.org">stefano@apache.org</a>
* @author Stefano Mazzocchi <a href="mailto:stefano@apache.org">stefano@apache.org</a>
*/

public class Javadoc extends Exec {
@@ -571,9 +571,9 @@ public class Javadoc extends Exec {
if (c == '/') {
c = in.read();
if (c == '/') {
while (c != '\n') c = in.read();
while (c != '\n' && c != -1) c = in.read();
} else if (c == '*') {
while (true) {
while (c != -1) {
c = in.read();
if (c == '*') {
c = in.read();
@@ -586,10 +586,11 @@ public class Javadoc extends Exec {
}
}
if (c == '"') {
while (true) {
while (c != -1) {
c = in.read();
if (c == '\\') c = in.read();
if (c == '"') {
if (c == '\\') {
c = in.read();
} else if (c == '"') {
c = read();
break;
}


Loading…
Cancel
Save