# HG changeset patch # User mchung # Date 1466476263 25200 # Node ID 1d9492ef71e9be1eaff23cbe40857605537b058d # Parent e97953d38291d9ca988a536b8664fb133fa2bb07# Parent 2f46f5082cd7cbee0a84b7fe3d272e58c3204dd6 Merge diff -r e97953d38291 -r 1d9492ef71e9 jdk/src/java.base/share/classes/java/io/BufferedInputStream.java --- a/jdk/src/java.base/share/classes/java/io/BufferedInputStream.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/src/java.base/share/classes/java/io/BufferedInputStream.java Mon Jun 20 19:31:03 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2016, 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 @@ -359,10 +359,10 @@ * See the general contract of the skip * method of InputStream. * - * @exception IOException if the stream does not support seek, - * or if this input stream has been closed by - * invoking its {@link #close()} method, or an - * I/O error occurs. + * @throws IOException if this input stream has been closed by + * invoking its {@link #close()} method, + * {@code in.skip(n)} throws an IOException, + * or an I/O error occurs. */ public synchronized long skip(long n) throws IOException { getBufIfOpen(); // Check for closed stream diff -r e97953d38291 -r 1d9492ef71e9 jdk/src/java.base/share/classes/java/io/FilterInputStream.java --- a/jdk/src/java.base/share/classes/java/io/FilterInputStream.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/src/java.base/share/classes/java/io/FilterInputStream.java Mon Jun 20 19:31:03 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2016, 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 @@ -144,8 +144,7 @@ * * @param n the number of bytes to be skipped. * @return the actual number of bytes skipped. - * @exception IOException if the stream does not support seek, - * or if some other I/O error occurs. + * @throws IOException if {@code in.skip(n)} throws an IOException. */ public long skip(long n) throws IOException { return in.skip(n); diff -r e97953d38291 -r 1d9492ef71e9 jdk/src/java.base/share/classes/java/io/InputStream.java --- a/jdk/src/java.base/share/classes/java/io/InputStream.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/src/java.base/share/classes/java/io/InputStream.java Mon Jun 20 19:31:03 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2016, 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 @@ -325,7 +325,7 @@ * returns 0, and no bytes are skipped. Subclasses may handle the negative * value differently. * - *

The skip method of this class creates a + *

The skip method implementation of this class creates a * byte array and then repeatedly reads into it until n bytes * have been read or the end of the stream has been reached. Subclasses are * encouraged to provide a more efficient implementation of this method. @@ -333,8 +333,7 @@ * * @param n the number of bytes to be skipped. * @return the actual number of bytes skipped. - * @exception IOException if the stream does not support seek, - * or if some other I/O error occurs. + * @throws IOException if an I/O error occurs. */ public long skip(long n) throws IOException { diff -r e97953d38291 -r 1d9492ef71e9 jdk/src/java.base/share/classes/java/io/PushbackInputStream.java --- a/jdk/src/java.base/share/classes/java/io/PushbackInputStream.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/src/java.base/share/classes/java/io/PushbackInputStream.java Mon Jun 20 19:31:03 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2016, 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 @@ -291,10 +291,10 @@ * * @param n {@inheritDoc} * @return {@inheritDoc} - * @exception IOException if the stream does not support seek, - * or the stream has been closed by - * invoking its {@link #close()} method, - * or an I/O error occurs. + * @throws IOException if the stream has been closed by + * invoking its {@link #close()} method, + * {@code in.skip(n)} throws an IOException, + * or an I/O error occurs. * @see java.io.FilterInputStream#in * @see java.io.InputStream#skip(long n) * @since 1.2 diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/java/lang/module/ConfigurationTest.java --- a/jdk/test/java/lang/module/ConfigurationTest.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/test/java/lang/module/ConfigurationTest.java Mon Jun 20 19:31:03 2016 -0700 @@ -157,7 +157,7 @@ * * The test consists of three configurations: * - Configuration cf1: m1, m2 requires public m1 - * - Configuration cf2: m3 requires m1 + * - Configuration cf2: m3 requires m2 */ public void testRequiresPublic2() { @@ -219,7 +219,7 @@ * * The test consists of three configurations: * - Configuration cf1: m1 - * - Configuration cf2: m2 requires public m3, m3 requires m2 + * - Configuration cf2: m2 requires public m1, m3 requires m2 */ public void testRequiresPublic3() { @@ -283,7 +283,7 @@ * The test consists of three configurations: * - Configuration cf1: m1 * - Configuration cf2: m2 requires public m1 - * - Configuraiton cf3: m3 requires m3 + * - Configuraiton cf3: m3 requires m2 */ public void testRequiresPublic4() { @@ -657,8 +657,8 @@ * Basic test of binding services with configurations. * * Configuration cf1: p@1.0 provides p.S + * Test configuration cf2: m1 uses p.S, p@2.0 provides p.S * Test configuration cf2: m1 uses p.S - * Test configuration cf2: m1 uses p.S, p@2.0 uses p.S */ public void testServiceBindingWithConfigurations3() { @@ -896,7 +896,7 @@ Configuration cf2 = resolveRequires(cf1, finder, "m1"); assertTrue(cf2.modules().size() == 1); - assertTrue(cf1.findModule("m1").isPresent()); + assertTrue(cf2.findModule("m1").isPresent()); } @@ -1305,7 +1305,7 @@ /** - * Test "provides p.S" where p is not local + * Test "provides p.S with q.T" where q.T is not local */ @Test(expectedExceptions = { ResolutionException.class }) public void testProviderPackageNotLocal() { diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/java/lang/module/ModuleReferenceTest.java --- a/jdk/test/java/lang/module/ModuleReferenceTest.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/test/java/lang/module/ModuleReferenceTest.java Mon Jun 20 19:31:03 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -110,7 +110,7 @@ ModuleReference mref3 = new ModuleReference(descriptor1, null, supplier); assertTrue(mref1.equals(mref1)); - assertTrue(mref1.equals(mref1)); + assertTrue(mref1.equals(mref2)); assertTrue(mref2.equals(mref1)); assertTrue(mref1.hashCode() == mref2.hashCode()); diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java --- a/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/test/javax/net/ssl/templates/SSLSocketSSLEngineTemplate.java Mon Jun 20 19:31:03 2016 -0700 @@ -178,8 +178,11 @@ char[] passphrase = "passphrase".toCharArray(); - ks.load(new FileInputStream(keyFilename), passphrase); - ts.load(new FileInputStream(trustFilename), passphrase); + try (FileInputStream keyFile = new FileInputStream(keyFilename); + FileInputStream trustFile = new FileInputStream(trustFilename)) { + ks.load(keyFile, passphrase); + ts.load(trustFile, passphrase); + } KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, passphrase); @@ -310,6 +313,7 @@ if (retry && serverIn.remaining() < clientMsg.length) { log("Need to read more from client"); + serverIn.compact(); retry = false; continue; } else { diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloClient.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloClient.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.util.ArrayList; + +import javax.naming.InitialContext; +import javax.naming.Context; +import javax.naming.NameNotFoundException; + +import javax.rmi.PortableRemoteObject; + + + +public class HelloClient implements Runnable { + static final int MAX_RETRY = 10; + static final int ONE_SECOND = 1000; + private static boolean responseReceived; + + public static void main(String args[]) throws Exception { + executeRmiClientCall(); + } + + @Override + public void run() { + try { + executeRmiClientCall(); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + + public static boolean isResponseReceived () { + return responseReceived; + } + + public static void executeRmiClientCall() throws Exception { + Context ic; + Object objref; + HelloInterface helloSvc; + String response; + Object testResponse; + int retryCount = 0; + + ArrayList listParam = new ArrayList(); + listParam.add(null); + System.out.println("HelloClient.main: enter ..."); + while (retryCount < MAX_RETRY) { + try { + ic = new InitialContext(); + System.out.println("HelloClient.main: HelloService lookup ..."); + // STEP 1: Get the Object reference from the Name Service + // using JNDI call. + objref = ic.lookup("HelloService"); + System.out.println("HelloClient: Obtained a ref. to Hello server."); + + // STEP 2: Narrow the object reference to the concrete type and + // invoke the method. + helloSvc = (HelloInterface) PortableRemoteObject.narrow(objref, + HelloInterface.class); + + Test3 test3 = new Test3(listParam); + Test3 test3Response = helloSvc.sayHelloWithTest3(test3); + System.out.println("Server says: Test3 response == " + test3Response); + + Test3 test3WithNullList = new Test3(null); + test3Response = helloSvc.sayHelloWithTest3(test3WithNullList); + System.out.println("Server says: Test3 response == " + + test3Response); + + Test4 test4 = new Test4(listParam); + Test3 test4Response = helloSvc.sayHelloWithTest3(test4); + System.out.println("Server says: Test4 response == " + test4Response); + + responseReceived = true; + break; + } catch (NameNotFoundException nnfEx) { + System.err.println("NameNotFoundException Caught .... try again"); + retryCount++; + try { + Thread.sleep(ONE_SECOND); + } catch (InterruptedException e) { + e.printStackTrace(); + } + continue; + } catch (Throwable t) { + System.err.println("Exception " + t + "Caught"); + t.printStackTrace(); + throw new RuntimeException(t); + } + } + System.err.println("HelloClient terminating "); + try { + Thread.sleep(ONE_SECOND); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloImpl.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.rmi.RemoteException; +import javax.rmi.PortableRemoteObject; + +public class HelloImpl extends PortableRemoteObject implements HelloInterface { + + public HelloImpl() throws java.rmi.RemoteException { + super(); // invoke rmi linking and remote object initialization + } + + + @Override + public Test3 sayHelloWithTest3(Test3 test) throws RemoteException { + System.out.println("sayHelloToTest3: ENTER " ); + + return test; + } + +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloInterface.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloInterface.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.rmi.Remote; + +public interface HelloInterface extends Remote { + public Test3 sayHelloWithTest3( Test3 test ) throws java.rmi.RemoteException; +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloServer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloServer.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016, 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. + */ + +import javax.naming.InitialContext; +import javax.naming.Context; + +public class HelloServer { + + static final int MAX_RETRY = 10; + static final int ONE_SECOND = 1000; + + public static void main(String[] args) { + int retryCount = 0; + while (retryCount < MAX_RETRY) { + try { + // Step 1: Instantiate the Hello servant + HelloImpl helloRef = new HelloImpl(); + + // Step 2: Publish the reference in the Naming Service + // using JNDI API + Context initialNamingContext = new InitialContext(); + initialNamingContext.rebind("HelloService", helloRef); + + System.out.println("Hello Server: Ready..."); + break; + } catch (Exception e) { + System.out.println("Server initialization problem: " + e); + e.printStackTrace(); + retryCount++; + try { + Thread.sleep(ONE_SECOND); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + } + } +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2016, 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. + */ + +/* + * @test + * @bug 8146975 + * @summary test RMI-IIOP with value object return + * @library /lib/testlibrary + * @build jdk.testlibrary.* + * @compile -addmods java.corba Test.java Test3.java Test4.java + * HelloInterface.java HelloServer.java + * HelloClient.java HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java + * RmiIiopReturnValueTest.java + * @run main/othervm -addmods java.corba + * -Djava.naming.provider.url=iiop://localhost:5050 + * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory + * RmiIiopReturnValueTest -port 5049 + * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy + * -addmods java.corba -Djava.naming.provider.url=iiop://localhost:5050 + * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory + * RmiIiopReturnValueTest -port 5049 + */ + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import jdk.testlibrary.JDKToolFinder; +import jdk.testlibrary.JDKToolLauncher; + +public class RmiIiopReturnValueTest { + + static final String ORBD = JDKToolFinder.getTestJDKTool("orbd"); + static final String JAVA = JDKToolFinder.getTestJDKTool("java"); + static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd"); + static final String CLASSPATH = System.getProperty("java.class.path"); + static final int FIVE_SECONDS = 5000; + + private static Throwable clientException; + private static boolean exceptionInClient; + private static Process orbdProcess; + private static Process rmiServerProcess; + + public static void main(String[] args) throws Exception { + startTestComponents(); + stopTestComponents(); + System.err.println("Test completed OK "); + } + + static void startTestComponents () throws Exception { + startOrbd(); + Thread.sleep(FIVE_SECONDS); + startRmiIiopServer(); + Thread.sleep(FIVE_SECONDS); + executeRmiIiopClient(); + } + + private static void stopTestComponents() throws Exception { + stopRmiIiopServer(); + stopOrbd(); + if (exceptionInClient) { + throw new RuntimeException(clientException); + } else if (!isResponseReceived()) { + throw new RuntimeException("Expected Response not received"); + } + } + + static void startOrbd() throws Exception { + System.out.println("\nStarting orbd with NS port 5050 and activation port 5049 "); + + //orbd -ORBInitialHost localhost -ORBInitialPort 5050 -port 5049 + orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost") + .addToolArg("-ORBInitialPort").addToolArg("5050") + .addToolArg("-port").addToolArg("5049"); + + System.out.println("RmiIiopReturnValueTest: Executing: " + Arrays.asList(orbdLauncher.getCommand())); + ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand()); + pb.redirectError(ProcessBuilder.Redirect.INHERIT); + orbdProcess = pb.start(); + } + + + static void startRmiIiopServer() throws Exception { + System.out.println("\nStarting RmiIiopServer"); + // java -addmods java.corba -cp . + // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory + // -Djava.naming.provider.url=iiop://localhost:5050 HelloServer -port 5049 + List commands = new ArrayList<>(); + commands.add(RmiIiopReturnValueTest.JAVA); + commands.add("-addmods"); + commands.add("java.corba"); + commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"); + commands.add("-Djava.naming.provider.url=iiop://localhost:5050"); + commands.add("-cp"); + commands.add(RmiIiopReturnValueTest.CLASSPATH); + commands.add("HelloServer"); + commands.add("-port"); + commands.add("5049"); + + System.out.println("RmiIiopReturnValueTest: Executing: " + commands); + ProcessBuilder pb = new ProcessBuilder(commands); + pb.redirectError(ProcessBuilder.Redirect.INHERIT); + rmiServerProcess = pb.start(); + } + + static boolean isResponseReceived() { + return HelloClient.isResponseReceived(); + } + + static void stopRmiIiopServer() throws Exception { + if (rmiServerProcess != null) { + System.out.println("RmiIiopReturnValueTest.stopRmiIiopServer: destroy rmiServerProcess"); + rmiServerProcess.destroyForcibly(); + rmiServerProcess.waitFor(); + System.out.println("serverProcess exitCode:" + + rmiServerProcess.exitValue()); + } + } + + static void stopOrbd() throws Exception { + System.out.println("RmiIiopReturnValueTest.stopOrbd: destroy orbdProcess "); + orbdProcess.destroyForcibly(); + orbdProcess.waitFor(); + System.out.println("orbd exitCode:" + + orbdProcess.exitValue()); + } + + static void executeRmiIiopClient() throws Exception { + System.out.println("RmiIiopReturnValueTest.executeRmiIiopClient: HelloClient.executeRmiClientCall"); + try { + HelloClient.executeRmiClientCall(); + } catch (Throwable t) { + clientException = t; + exceptionInClient = true; + } + } +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/Test.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.io.Serializable; + + +public class Test implements Serializable { + +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/Test3.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test3.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.io.Serializable; +import java.util.List; + + +public class Test3 implements Serializable { + + private List list; + + public Test3(List list) { + this.list = list; + } + +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/Test4.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test4.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.util.List; + + +public class Test4 extends Test3 { + + private int aNumber = 1; + + public Test4(List list) { + super(list); + } + + /** + * + */ + private static final long serialVersionUID = 1L; + + +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloImpl_Tie.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloImpl_Tie.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016, 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. + */ + +// Tie class generated by rmic, do not edit. +// Contents subject to change without notice. + +import java.io.Serializable; +import java.rmi.Remote; +import java.rmi.RemoteException; +import javax.rmi.CORBA.Tie; +import javax.rmi.CORBA.Util; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CORBA.portable.UnknownException; +import org.omg.CORBA_2_3.portable.ObjectImpl; + + +public class _HelloImpl_Tie extends ObjectImpl implements Tie { + + volatile private HelloImpl target = null; + + private static final String[] _type_ids = { + "RMI:HelloInterface:0000000000000000" + }; + + public void setTarget(Remote target) { + this.target = (HelloImpl) target; + } + + public Remote getTarget() { + return target; + } + + public org.omg.CORBA.Object thisObject() { + return this; + } + + public void deactivate() { + _orb().disconnect(this); + _set_delegate(null); + target = null; + } + + public ORB orb() { + return _orb(); + } + + public void orb(ORB orb) { + orb.connect(this); + } + + public String[] _ids() { + return (String[]) _type_ids.clone(); + } + + public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException { + try { + HelloImpl target = this.target; + if (target == null) { + throw new java.io.IOException(); + } + org.omg.CORBA_2_3.portable.InputStream in = + (org.omg.CORBA_2_3.portable.InputStream) _in; + if (method.equals("sayHelloWithTest3")) { + Test3 arg0 = (Test3) in.read_value(Test3.class); + Test3 result = target.sayHelloWithTest3(arg0); + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); + out.write_value(result,Test3.class); + return out; + } + throw new BAD_OPERATION(); + } catch (SystemException ex) { + throw ex; + } catch (Throwable ex) { + throw new UnknownException(ex); + } + } +} diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloInterface_Stub.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloInterface_Stub.java Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2016, 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. + */ + +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +import java.io.Serializable; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CORBA.portable.ServantObject; + + +public class _HelloInterface_Stub extends Stub implements HelloInterface { + + private static final String[] _type_ids = { + "RMI:HelloInterface:0000000000000000" + }; + + public String[] _ids() { + return (String[]) _type_ids.clone(); + } + + public Test3 sayHelloWithTest3(Test3 arg0) throws java.rmi.RemoteException { + if (!Util.isLocal(this)) { + try { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + org.omg.CORBA_2_3.portable.OutputStream out = + (org.omg.CORBA_2_3.portable.OutputStream) + _request("sayHelloWithTest3", true); + out.write_value(arg0,Test3.class); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (Test3) in.read_value(Test3.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String $_id = in.read_string(); + throw new UnexpectedException($_id); + } catch (RemarshalException ex) { + return sayHelloWithTest3(arg0); + } finally { + _releaseReply(in); + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } + } else { + ServantObject so = _servant_preinvoke("sayHelloWithTest3",HelloInterface.class); + if (so == null) { + return sayHelloWithTest3(arg0); + } + try { + Test3 arg0Copy = (Test3) Util.copyObject(arg0,_orb()); + Test3 result = ((HelloInterface)so.servant).sayHelloWithTest3(arg0Copy); + return (Test3)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016, 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. + */ + +grant codeBase "jrt:/java.corba" { + permission java.security.AllPermission; +}; + + + +grant { + permission java.io.FilePermission "./-", "read,write,execute"; + permission java.io.FilePermission "*", "read"; + permission java.net.SocketPermission "*:*", "connect, accept, listen, resolve"; + permission java.util.PropertyPermission "*", "read, write"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + permission java.io.SerializablePermission "enableSubclassImplementation"; + permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.corba"; + permission java.lang.RuntimePermission "defineClassInPackage.sun.corba"; + permission java.lang.RuntimePermission "reflectionFactoryAccess"; + permission sun.corba.BridgePermission "getBridge"; + permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect"; + permission java.util.PropertyPermission "*", "read, write"; + permission java.io.FilePermission "<>", "read,write,execute"; +}; diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java --- a/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java Sun Jun 19 16:46:49 2016 -0700 +++ b/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java Mon Jun 20 19:31:03 2016 -0700 @@ -31,17 +31,16 @@ * HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java ConcurrentHashMapTest.java * @run main/othervm -addmods java.corba -Djava.naming.provider.url=iiop://localhost:1050 * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest + * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy + * -addmods java.corba -Djava.naming.provider.url=iiop://localhost:1050 + * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest * @key intermittent */ -import java.io.DataInputStream; -import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.CountDownLatch; import jdk.testlibrary.JDKToolFinder; import jdk.testlibrary.JDKToolLauncher; @@ -83,7 +82,7 @@ } static void startOrbd() throws Exception { - System.out.println("\nStarting orbd on port 1050 "); + System.out.println("\nStarting orbd with NS port 1050 "); //orbd -ORBInitialHost localhost -ORBInitialPort 1050 orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost") @@ -98,7 +97,7 @@ static void startRmiIiopServer() throws Exception { System.out.println("\nStarting RmiServer"); - // java -cp . + // java -cp . -addmods java.corba // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory // -Djava.naming.provider.url=iiop://localhost:1050 HelloServer List commands = new ArrayList<>(); @@ -122,17 +121,15 @@ } static void stopRmiIiopServer() throws Exception { - rmiServerProcess.destroy(); + rmiServerProcess.destroyForcibly(); rmiServerProcess.waitFor(); - //rmiServerProcess.waitFor(30, TimeUnit.SECONDS); System.out.println("serverProcess exitCode:" + rmiServerProcess.exitValue()); } static void stopOrbd() throws Exception { - orbdProcess.destroy(); + orbdProcess.destroyForcibly(); orbdProcess.waitFor(); - //orbdProcess.waitFor(30, TimeUnit.SECONDS); System.out.println("orbd exitCode:" + orbdProcess.exitValue()); } diff -r e97953d38291 -r 1d9492ef71e9 jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy Mon Jun 20 19:31:03 2016 -0700 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016, 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. + */ + +grant codeBase "jrt:/java.corba" { + permission java.security.AllPermission; +}; + +grant { + permission java.io.FilePermission "./-", "read,write,execute"; + permission java.io.FilePermission "*", "read"; + permission java.net.SocketPermission "*:*", "connect, accept, listen, resolve"; + permission java.util.PropertyPermission "*", "read, write"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + permission java.io.SerializablePermission "enableSubclassImplementation"; + permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.corba"; + permission java.lang.RuntimePermission "defineClassInPackage.sun.corba"; + permission java.lang.RuntimePermission "reflectionFactoryAccess"; + permission sun.corba.BridgePermission "getBridge"; + permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.reflect"; + permission java.util.PropertyPermission "*", "read, write"; + permission java.io.FilePermission "<>", "read,write,execute"; +};