911N/A/*
911N/A * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
911N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
911N/A *
911N/A * This code is free software; you can redistribute it and/or modify it
911N/A * under the terms of the GNU General Public License version 2 only, as
911N/A * published by the Free Software Foundation.
911N/A *
911N/A * This code is distributed in the hope that it will be useful, but WITHOUT
911N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
911N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
911N/A * version 2 for more details (a copy is included in the LICENSE file that
911N/A * accompanied this code).
911N/A *
911N/A * You should have received a copy of the GNU General Public License version
911N/A * 2 along with this work; if not, write to the Free Software Foundation,
911N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
911N/A *
911N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
911N/A * or visit www.oracle.com if you need additional information or have any
911N/A * questions.
911N/A */
911N/A
911N/A/*
911N/A * @test
911N/A * @bug 6964914
911N/A * @summary javadoc does not output number of warnings using user written doclet
911N/A */
911N/A
911N/Aimport java.io.*;
911N/A
911N/Apublic class Test {
911N/A public static void main(String... args) throws Exception {
911N/A new Test().run();
911N/A }
911N/A
911N/A public void run() throws Exception {
911N/A javadoc("Error.java", "1 error");
911N/A javadoc("JavacWarning.java", "1 warning");
911N/A javadoc("JavadocWarning.java", "1 warning");
911N/A if (errors > 0)
911N/A throw new Exception(errors + " errors found");
911N/A }
911N/A
911N/A void javadoc(String path, String expect) {
911N/A File testSrc = new File(System.getProperty("test.src"));
911N/A String[] args = {
911N/A "-source", "1.4", // enables certain Parser warnings
911N/A "-bootclasspath", System.getProperty("sun.boot.class.path"),
911N/A "-classpath", ".",
911N/A "-package",
911N/A new File(testSrc, path).getPath()
911N/A };
911N/A
911N/A StringWriter sw = new StringWriter();
911N/A PrintWriter pw = new PrintWriter(sw);
911N/A int rc = com.sun.tools.javadoc.Main.execute(
911N/A "javadoc",
911N/A pw, pw, pw,
911N/A com.sun.tools.doclets.standard.Standard.class.getName(),
911N/A args);
911N/A pw.close();
911N/A String out = sw.toString();
911N/A if (!out.isEmpty())
911N/A System.err.println(out);
911N/A System.err.println("javadoc exit: rc=" + rc);
911N/A
911N/A if (!out.contains(expect))
911N/A error("expected text not found: " + expect);
911N/A }
911N/A
911N/A void error(String msg) {
911N/A System.err.println("Error: " + msg);
911N/A errors++;
911N/A }
911N/A
911N/A int errors;
911N/A}