208N/A/*
553N/A * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
208N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
208N/A *
208N/A * This code is free software; you can redistribute it and/or modify it
208N/A * under the terms of the GNU General Public License version 2 only, as
208N/A * published by the Free Software Foundation.
208N/A *
208N/A * This code is distributed in the hope that it will be useful, but WITHOUT
208N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
208N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
208N/A * version 2 for more details (a copy is included in the LICENSE file that
208N/A * accompanied this code).
208N/A *
208N/A * You should have received a copy of the GNU General Public License version
208N/A * 2 along with this work; if not, write to the Free Software Foundation,
208N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
208N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
208N/A */
208N/A
208N/A/*
208N/A * @test
208N/A * @bug 6176978
208N/A * @summary current Javadoc's invocation and extension (Doclet) mechanisms are problematic
208N/A * @build T6176978
208N/A * @run main T6176978
208N/A */
208N/A
208N/Aimport java.io.*;
208N/Aimport java.net.*;
208N/A
208N/Apublic class T6176978
208N/A{
208N/A public static void main(String[] args) throws Exception {
208N/A // create and use a temp dir that will not be on jtreg's
208N/A // default class path
208N/A File tmpDir = new File("tmp");
208N/A tmpDir.mkdirs();
208N/A
208N/A File testSrc = new File(System.getProperty("test.src", "."));
208N/A String[] javac_args = {
208N/A "-d",
208N/A "tmp",
208N/A new File(testSrc, "X.java").getPath()
208N/A };
208N/A
208N/A int rc = com.sun.tools.javac.Main.compile(javac_args);
208N/A if (rc != 0)
208N/A throw new Error("javac exit code: " + rc);
208N/A
208N/A String[] jdoc_args = {
208N/A "-doclet",
208N/A "X",
208N/A new File(testSrc, "T6176978.java").getPath()
208N/A };
208N/A
208N/A rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
208N/A if (rc == 0)
208N/A throw new Error("javadoc unexpectedly succeeded");
208N/A
208N/A
208N/A
208N/A Thread currThread = Thread.currentThread();
208N/A ClassLoader saveClassLoader = currThread.getContextClassLoader();
208N/A URLClassLoader urlCL = new URLClassLoader(new URL[] { tmpDir.toURL() });
208N/A currThread.setContextClassLoader(urlCL);
208N/A
208N/A try {
208N/A rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
208N/A if (rc != 0)
208N/A throw new Error("javadoc exit: " + rc);
208N/A }
208N/A finally {
208N/A currThread.setContextClassLoader(saveClassLoader);
208N/A }
208N/A }
208N/A}