test/tools/javadoc/6176978/T6176978.java

Mon, 09 Mar 2009 13:29:06 -0700

author
xdono
date
Mon, 09 Mar 2009 13:29:06 -0700
changeset 229
03bcd66bd8e7
parent 209
9199b9092f73
child 554
9d9f26857129
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

jjg@209 1 /*
xdono@229 2 * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
jjg@209 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@209 4 *
jjg@209 5 * This code is free software; you can redistribute it and/or modify it
jjg@209 6 * under the terms of the GNU General Public License version 2 only, as
jjg@209 7 * published by the Free Software Foundation.
jjg@209 8 *
jjg@209 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@209 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@209 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@209 12 * version 2 for more details (a copy is included in the LICENSE file that
jjg@209 13 * accompanied this code).
jjg@209 14 *
jjg@209 15 * You should have received a copy of the GNU General Public License version
jjg@209 16 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@209 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@209 18 *
jjg@209 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
jjg@209 20 * CA 95054 USA or visit www.sun.com if you need additional information or
jjg@209 21 * have any questions.
jjg@209 22 */
jjg@209 23
jjg@209 24 /*
jjg@209 25 * @test
jjg@209 26 * @bug 6176978
jjg@209 27 * @summary current Javadoc's invocation and extension (Doclet) mechanisms are problematic
jjg@209 28 * @build T6176978
jjg@209 29 * @run main T6176978
jjg@209 30 */
jjg@209 31
jjg@209 32 import java.io.*;
jjg@209 33 import java.net.*;
jjg@209 34
jjg@209 35 public class T6176978
jjg@209 36 {
jjg@209 37 public static void main(String[] args) throws Exception {
jjg@209 38 // create and use a temp dir that will not be on jtreg's
jjg@209 39 // default class path
jjg@209 40 File tmpDir = new File("tmp");
jjg@209 41 tmpDir.mkdirs();
jjg@209 42
jjg@209 43 File testSrc = new File(System.getProperty("test.src", "."));
jjg@209 44 String[] javac_args = {
jjg@209 45 "-d",
jjg@209 46 "tmp",
jjg@209 47 new File(testSrc, "X.java").getPath()
jjg@209 48 };
jjg@209 49
jjg@209 50 int rc = com.sun.tools.javac.Main.compile(javac_args);
jjg@209 51 if (rc != 0)
jjg@209 52 throw new Error("javac exit code: " + rc);
jjg@209 53
jjg@209 54 String[] jdoc_args = {
jjg@209 55 "-doclet",
jjg@209 56 "X",
jjg@209 57 new File(testSrc, "T6176978.java").getPath()
jjg@209 58 };
jjg@209 59
jjg@209 60 rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
jjg@209 61 if (rc == 0)
jjg@209 62 throw new Error("javadoc unexpectedly succeeded");
jjg@209 63
jjg@209 64
jjg@209 65
jjg@209 66 Thread currThread = Thread.currentThread();
jjg@209 67 ClassLoader saveClassLoader = currThread.getContextClassLoader();
jjg@209 68 URLClassLoader urlCL = new URLClassLoader(new URL[] { tmpDir.toURL() });
jjg@209 69 currThread.setContextClassLoader(urlCL);
jjg@209 70
jjg@209 71 try {
jjg@209 72 rc = com.sun.tools.javadoc.Main.execute(jdoc_args);
jjg@209 73 if (rc != 0)
jjg@209 74 throw new Error("javadoc exit: " + rc);
jjg@209 75 }
jjg@209 76 finally {
jjg@209 77 currThread.setContextClassLoader(saveClassLoader);
jjg@209 78 }
jjg@209 79 }
jjg@209 80 }

mercurial