911N/A/*
911N/A * Copyright (c) 2002, 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 6968833
911N/A * @summary javadoc reports error but still returns 0
911N/A */
911N/A
911N/Aimport java.io.*;
911N/A
911N/Apublic class T6968833 {
911N/A public static void main(String... args) throws IOException {
911N/A new T6968833().run();
911N/A }
911N/A
911N/A void run() throws IOException {
911N/A File srcDir = new File("src");
911N/A // following file causes error: No public or protected classes found to document.
911N/A File f = writeFile(srcDir, "Foo.java", "class Foo { }");
911N/A String[] args = { f.getPath() };
911N/A int rc = com.sun.tools.javadoc.Main.execute(args);
911N/A if (rc == 0)
911N/A throw new Error("Unexpected exit from javadoc: " + rc);
911N/A }
911N/A
911N/A File writeFile(File dir, String path, String s) throws IOException {
911N/A File f = new File(dir, path);
911N/A f.getParentFile().mkdirs();
911N/A try (Writer out = new FileWriter(f)) {
911N/A out.write(s);
911N/A }
911N/A return f;
911N/A }
911N/A}
911N/A