diff --git a/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java b/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java index 3b778f3f99e..c7c41f27326 100644 --- a/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java +++ b/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /* @test - * @bug 4236543 + * @bug 4236543 8129833 * @summary rmic w/o -d should put class files in package directory * @author Dana Burns * @library ../../../../java/rmi/testlibrary @@ -40,38 +40,47 @@ */ import java.io.File; -import java.io.IOException; public class RmicDefault { + private static final String PKG_DIR = "packagedir"; + private static final String[] remoteClasses = new String[] { + "RmicMeImpl", "AppletServer" + }; + public static void main(String args[]) throws Exception { String javahome = System.getProperty("java.home"); String testclasses = System.getProperty("test.classes"); String userDir = System.getProperty("user.dir"); + String cmd = javahome + File.separator + "bin" + File.separator + + "javac -d " + testclasses + " " + System.getProperty("test.src") + + File.separator + PKG_DIR + File.separator; - Process javacProcess = Runtime.getRuntime().exec( - javahome + File.separator + "bin" + File.separator + - "javac -d " + testclasses + " " + - System.getProperty("test.src") + File.separator + "packagedir" + - File.separator + "RmicMeImpl.java"); + for (String clz : remoteClasses) { + System.out.println("Working on class " + clz); + Process javacProcess = Runtime.getRuntime().exec(cmd + clz + ".java"); - StreamPipe.plugTogether(javacProcess.getInputStream(), System.out); - StreamPipe.plugTogether(javacProcess.getErrorStream(), System.out); + StreamPipe.plugTogether(javacProcess.getInputStream(), System.out); + StreamPipe.plugTogether(javacProcess.getErrorStream(), System.out); - javacProcess.waitFor(); + javacProcess.waitFor(); - Process rmicProcess = Runtime.getRuntime().exec( - javahome + File.separator + "bin" + File.separator + - "rmic -classpath " + testclasses + " packagedir.RmicMeImpl"); + Process rmicProcess = Runtime.getRuntime().exec( + javahome + File.separator + "bin" + File.separator + + "rmic -classpath " + testclasses + " " + PKG_DIR + "." + clz); - StreamPipe.plugTogether(rmicProcess.getInputStream(), System.out); - StreamPipe.plugTogether(rmicProcess.getErrorStream(), System.err); + StreamPipe.plugTogether(rmicProcess.getInputStream(), System.out); + StreamPipe.plugTogether(rmicProcess.getErrorStream(), System.err); - rmicProcess.waitFor(); + rmicProcess.waitFor(); + int exitCode = rmicProcess.exitValue(); + if (rmicProcess.exitValue() != 0) { + throw new RuntimeException("Rmic failed. The exit code is " + exitCode); + } - File stub = new File(userDir + File.separator + "packagedir" + - File.separator + "RmicMeImpl_Stub.class"); - if (!stub.exists()) { - throw new RuntimeException("TEST FAILED: could not find stub"); + File stub = new File(userDir + File.separator + PKG_DIR + File.separator + clz + "_Stub.class"); + if (!stub.exists()) { + throw new RuntimeException("TEST FAILED: could not find stub"); + } } System.err.println("TEST PASSED"); diff --git a/jdk/test/sun/rmi/rmic/RMIGenerator/packagedir/AppletServer.java b/jdk/test/sun/rmi/rmic/RMIGenerator/packagedir/AppletServer.java new file mode 100644 index 00000000000..2b259992cee --- /dev/null +++ b/jdk/test/sun/rmi/rmic/RMIGenerator/packagedir/AppletServer.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package packagedir; + +import java.awt.Panel; + +public class AppletServer extends java.applet.Applet implements java.rmi.Remote { + private static final long serialVersionUID = -5097805572269179958L; + Panel panel = null; +}