com.sun.tools.doclint.DocLint.BadArgs Java Examples

The following examples show how to use com.sun.tools.doclint.DocLint.BadArgs. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RunTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #2
Source File: PathsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2;
    if (needTarget8(pathOpt)) {
        out2 = doclint("-Xmsgs", "-source", "8", "-target", "8", pathOpt, path, file);
    } else {
        out2 = doclint("-Xmsgs", pathOpt, path, file);
    }
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #3
Source File: RunTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #4
Source File: RunTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #5
Source File: PathsTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2 = doclint("-Xmsgs", pathOpt, path, file);
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #6
Source File: PathsTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2 = doclint("-Xmsgs", pathOpt, path, file);
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #7
Source File: RunTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #8
Source File: RunTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #9
Source File: PathsTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2 = doclint("-Xmsgs", pathOpt, path, file);
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #10
Source File: PathsTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2 = doclint("-Xmsgs", pathOpt, path, file);
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #11
Source File: RunTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #12
Source File: PathsTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2 = doclint("-Xmsgs", pathOpt, path, file);
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #13
Source File: PathsTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2 = doclint("-Xmsgs", pathOpt, path, file);
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #14
Source File: RunTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #15
Source File: RunTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void testArgsNoFiles() throws BadArgs, IOException {
    System.err.println("test args, no files");
    DocLint dl = new DocLint();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, "-Xmsgs");
    pw.close();
    String out = sw.toString();

    String expect = "No files given";
    if (!Objects.equals(out.trim(), expect)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + expect + "<<");
        System.err.println("FOUND>>" + out + "<<");
    }

}
 
Example #16
Source File: PathsTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void test(String file, String pathOpt, String path) throws BadArgs, IOException {
    System.err.println("test " + pathOpt);
    String out1 = doclint("-Xmsgs", file);
    if (!pkgNotFound.matcher(out1).find())
        error("message not found: " + pkgNotFound);

    String out2 = doclint("-Xmsgs", pathOpt, path, file);
    if (pkgNotFound.matcher(out2).find())
        error("unexpected message found: " + pkgNotFound);
    if (!badHtmlEntity.matcher(out1).find())
        error("message not found: " + badHtmlEntity);

    try {
        doclint("-Xmsgs", pathOpt);
        error("expected exception not thrown");
    } catch (BadArgs e) {
        System.err.println(e);
    }
}
 
Example #17
Source File: PathsTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
String doclint(String... args) throws BadArgs, IOException {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    DocLint dl = new DocLint();
    dl.run(pw, args);
    pw.close();
    String out = sw.toString();
    if (!out.isEmpty())
        System.err.println(out);
    return out;
}
 
Example #18
Source File: DocLintTester.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception {
    List<String> args = new ArrayList<String>();
    args.addAll(opts);
    for (File file: files)
        args.add(file.getPath());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    try {
        new DocLint().run(pw, args.toArray(new String[args.size()]));
        if (expectBadArgs)
            error("expected exception not thrown");
    } catch (BadArgs e) {
        if (!expectBadArgs)
            error("unexpected exception caught: " + e);
    }
    pw.flush();
    String out = normalizeNewlines(removeFileNames(sw.toString())).trim();
    if (out != null)
        System.err.println("Output:\n" + out);

    if (refFile == null) {
        if (!out.isEmpty())
            error("unexpected output");
    } else {
        String expect = readFile(refFile);
        if (!expect.equals(out)) {
            error("expected output not found");
            System.err.println("EXPECT>>" + expect + "<<");
            System.err.println(" FOUND>>" + out    + "<<");
        }
    }
}
 
Example #19
Source File: RunTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void testRun() throws BadArgs, IOException {
    System.err.println("test run(String[])");
    DocLint dl = new DocLint();
    String[] args = { "-help" };
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream prev = System.out;
    try {
        System.setOut(ps);
        dl.run(args);
    } finally {
        System.setOut(prev);
    }
    ps.close();
    String stdout = baos.toString();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, args);
    pw.close();
    String direct = sw.toString();

    if (!stdout.equals(direct)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + direct + "<<");
        System.err.println("FOUND>>" + stdout + "<<");
    }
}
 
Example #20
Source File: RunTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void testRun() throws BadArgs, IOException {
    System.err.println("test run(String[])");
    DocLint dl = new DocLint();
    String[] args = { "-help" };
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream prev = System.out;
    try {
        System.setOut(ps);
        dl.run(args);
    } finally {
        System.setOut(prev);
    }
    ps.close();
    String stdout = baos.toString();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, args);
    pw.close();
    String direct = sw.toString();

    if (!stdout.equals(direct)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + direct + "<<");
        System.err.println("FOUND>>" + stdout + "<<");
    }
}
 
Example #21
Source File: PathsTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
String doclint(String... args) throws BadArgs, IOException {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    DocLint dl = new DocLint();
    dl.run(pw, args);
    pw.close();
    String out = sw.toString();
    if (!out.isEmpty())
        System.err.println(out);
    return out;
}
 
Example #22
Source File: DocLintTester.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception {
    List<String> args = new ArrayList<String>();
    args.addAll(opts);
    for (File file: files)
        args.add(file.getPath());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    try {
        new DocLint().run(pw, args.toArray(new String[args.size()]));
        if (expectBadArgs)
            error("expected exception not thrown");
    } catch (BadArgs e) {
        if (!expectBadArgs)
            error("unexpected exception caught: " + e);
    }
    pw.flush();
    String out = normalizeNewlines(removeFileNames(sw.toString())).trim();
    if (out != null)
        System.err.println("Output:\n" + out);

    if (refFile == null) {
        if (!out.isEmpty())
            error("unexpected output");
    } else {
        String expect = readFile(refFile);
        if (!expect.equals(out)) {
            error("expected output not found");
            System.err.println("EXPECT>>" + expect + "<<");
            System.err.println(" FOUND>>" + out    + "<<");
        }
    }
}
 
Example #23
Source File: DocLintTester.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception {
    List<String> args = new ArrayList<String>();
    args.addAll(opts);
    for (File file: files)
        args.add(file.getPath());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    try {
        new DocLint().run(pw, args.toArray(new String[args.size()]));
        if (expectBadArgs)
            error("expected exception not thrown");
    } catch (BadArgs e) {
        if (!expectBadArgs)
            error("unexpected exception caught: " + e);
    }
    pw.flush();
    String out = normalizeNewlines(removeFileNames(sw.toString())).trim();
    if (out != null)
        System.err.println("Output:\n" + out);

    if (refFile == null) {
        if (!out.isEmpty())
            error("unexpected output");
    } else {
        String expect = readFile(refFile);
        if (!expect.equals(out)) {
            error("expected output not found");
            System.err.println("EXPECT>>" + expect + "<<");
            System.err.println(" FOUND>>" + out    + "<<");
        }
    }
}
 
Example #24
Source File: RunTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void testRun() throws BadArgs, IOException {
    System.err.println("test run(String[])");
    DocLint dl = new DocLint();
    String[] args = { "-help" };
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream prev = System.out;
    try {
        System.setOut(ps);
        dl.run(args);
    } finally {
        System.setOut(prev);
    }
    ps.close();
    String stdout = baos.toString();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, args);
    pw.close();
    String direct = sw.toString();

    if (!stdout.equals(direct)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + direct + "<<");
        System.err.println("FOUND>>" + stdout + "<<");
    }
}
 
Example #25
Source File: DocLintTester.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception {
    List<String> args = new ArrayList<String>();
    args.addAll(opts);
    for (File file: files)
        args.add(file.getPath());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    try {
        new DocLint().run(pw, args.toArray(new String[args.size()]));
        if (expectBadArgs)
            error("expected exception not thrown");
    } catch (BadArgs e) {
        if (!expectBadArgs)
            error("unexpected exception caught: " + e);
    }
    pw.flush();
    String out = normalizeNewlines(removeFileNames(sw.toString())).trim();
    if (out != null)
        System.err.println("Output:\n" + out);

    if (refFile == null) {
        if (!out.isEmpty())
            error("unexpected output");
    } else {
        String expect = readFile(refFile);
        if (!expect.equals(out)) {
            error("expected output not found");
            System.err.println("EXPECT>>" + expect + "<<");
            System.err.println(" FOUND>>" + out    + "<<");
        }
    }
}
 
Example #26
Source File: RunTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void testRun() throws BadArgs, IOException {
    System.err.println("test run(String[])");
    DocLint dl = new DocLint();
    String[] args = { "-help" };
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream prev = System.out;
    try {
        System.setOut(ps);
        dl.run(args);
    } finally {
        System.setOut(prev);
    }
    ps.close();
    String stdout = baos.toString();

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    dl.run(pw, args);
    pw.close();
    String direct = sw.toString();

    if (!stdout.equals(direct)) {
        error("unexpected output");
        System.err.println("EXPECT>>" + direct + "<<");
        System.err.println("FOUND>>" + stdout + "<<");
    }
}
 
Example #27
Source File: PathsTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
String doclint(String... args) throws BadArgs, IOException {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    DocLint dl = new DocLint();
    dl.run(pw, args);
    pw.close();
    String out = sw.toString();
    if (!out.isEmpty())
        System.err.println(out);
    return out;
}
 
Example #28
Source File: PathsTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
String doclint(String... args) throws BadArgs, IOException {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    DocLint dl = new DocLint();
    dl.run(pw, args);
    pw.close();
    String out = sw.toString();
    if (!out.isEmpty())
        System.err.println(out);
    return out;
}
 
Example #29
Source File: PathsTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
String doclint(String... args) throws BadArgs, IOException {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    DocLint dl = new DocLint();
    dl.run(pw, args);
    pw.close();
    String out = sw.toString();
    if (!out.isEmpty())
        System.err.println(out);
    return out;
}
 
Example #30
Source File: DocLintTester.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception {
    List<String> args = new ArrayList<String>();
    args.addAll(opts);
    for (File file: files)
        args.add(file.getPath());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    try {
        new DocLint().run(pw, args.toArray(new String[args.size()]));
        if (expectBadArgs)
            error("expected exception not thrown");
    } catch (BadArgs e) {
        if (!expectBadArgs)
            error("unexpected exception caught: " + e);
    }
    pw.flush();
    String out = normalizeNewlines(removeFileNames(sw.toString())).trim();
    if (out != null)
        System.err.println("Output:\n" + out);

    if (refFile == null) {
        if (!out.isEmpty())
            error("unexpected output");
    } else {
        String expect = readFile(refFile);
        if (!expect.equals(out)) {
            error("expected output not found");
            System.err.println("EXPECT>>" + expect + "<<");
            System.err.println(" FOUND>>" + out    + "<<");
        }
    }
}