mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-20 12:53:29 +00:00
6989457: javadoc test file test/tools/javadoc/T4994049/FileWithTabs.java probably does not
Reviewed-by: mcimadamore
This commit is contained in:
parent
0b7ceb0204
commit
2baca00eeb
@ -22,5 +22,5 @@
|
||||
*/
|
||||
|
||||
public class FileWithTabs {
|
||||
public void tabbedMethod() {}
|
||||
\tpublic void tabbedMethod() {}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
import com.sun.javadoc.*;
|
||||
import java.io.File;
|
||||
import java.io.*;
|
||||
import static com.sun.tools.javadoc.Main.execute;
|
||||
|
||||
public class T4994049 extends Doclet {
|
||||
@ -52,12 +52,47 @@ public class T4994049 extends Doclet {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void main(String... args) {
|
||||
public static void main(String... args) throws Exception {
|
||||
File testSrc = new File(System.getProperty("test.src"));
|
||||
File tmpSrc = new File("tmpSrc");
|
||||
initTabs(testSrc, tmpSrc);
|
||||
|
||||
for (String file : args) {
|
||||
File source = new File(System.getProperty("test.src", "."), file);
|
||||
if (execute("javadoc", "T4994049", T4994049.class.getClassLoader(),
|
||||
new String[]{source.getPath()} ) != 0)
|
||||
throw new Error();
|
||||
File source = new File(tmpSrc, file);
|
||||
int rc = execute("javadoc", "T4994049", T4994049.class.getClassLoader(),
|
||||
new String[]{ source.getPath() } );
|
||||
if (rc != 0)
|
||||
throw new Error("Unexpected return code from javadoc: " + rc);
|
||||
}
|
||||
}
|
||||
|
||||
static void initTabs(File from, File to) throws IOException {
|
||||
for (File f: from.listFiles()) {
|
||||
File t = new File(to, f.getName());
|
||||
if (f.isDirectory()) {
|
||||
initTabs(f, t);
|
||||
} else if (f.getName().endsWith(".java")) {
|
||||
write(t, read(f).replace("\\t", "\t"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String read(File f) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try (BufferedReader in = new BufferedReader(new FileReader(f))) {
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
sb.append(line);
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
static void write(File f, String s) throws IOException {
|
||||
f.getParentFile().mkdirs();
|
||||
try (Writer out = new FileWriter(f)) {
|
||||
out.write(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user