Browse Source

Fixed javadoc so that it doesn't go into an infinite loop on lines such as:

tmpExcludes.addElement("**/"+tok.nextToken().trim()+"/**");

(currently found in org.apache.tools.ant.taskdefs.Copydir)


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

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

@@ -554,10 +554,11 @@ public class Javadoc extends Exec {
}

/**
* This is a java comment stripper reader that filters comments out
* for more significant java parsing. Since this class heavily relies on
* the single char read function, you are reccomended to make it work
* on top of a buffered reader.
* This is a java comment and string stripper reader that filters
* these lexical tokens out for purposes of simple Java parsing.
* (if you have more complex Java parsing needs, use a real lexer).
* Since this class heavily relies on the single char read function,
* you are reccomended to make it work on top of a buffered reader.
*/
class JavaReader extends FilterReader {

@@ -569,19 +570,37 @@ public class Javadoc extends Exec {
int c = in.read();
if (c == '/') {
c = in.read();
if (c == '*') {
if (c == '/') {
while (c != '\n') c = in.read();
} else if (c == '*') {
while (true) {
c = in.read();
if (c == '*') {
c = in.read();
if (c == '/') {
c = in.read();
c = read();
break;
}
}
}
}
}
if (c == '"') {
while (true) {
c = in.read();
if (c == '\\') c = in.read();
if (c == '"') {
c = read();
break;
}
}
}
if (c == '\'') {
c = in.read();
if (c == '\\') c = in.read();
c = in.read();
c = read();
}
return c;
}



Loading…
Cancel
Save