8146975: NullPointerException in IIOPInputStream.inputClassFields
authormsheppar
Tue, 21 Jun 2016 00:45:52 +0100
changeset 39122 7c61c198e6c9
parent 39121 a1a92fce338a
child 39123 8c516d65ec4b
8146975: NullPointerException in IIOPInputStream.inputClassFields Reviewed-by: chegar, rriggs, coffeys
jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloClient.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloImpl.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloInterface.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloServer.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/Test.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/Test3.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/Test4.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloImpl_Tie.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloInterface_Stub.java
jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy
jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java
jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloClient.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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<Test> listParam = new ArrayList<Test>();
+        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();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloImpl.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloInterface.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/HelloServer.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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();
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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<String> 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;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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 {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test3.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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<Test> list;
+
+    public Test3(List<Test> list) {
+        this.list = list;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/Test4.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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<Test> list) {
+        super(list);
+    }
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloImpl_Tie.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/_HelloInterface_Stub.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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);
+                }
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/8146975/jtreg.test.policy	Tue Jun 21 00:45:52 2016 +0100
@@ -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 "<<ALL FILES>>", "read,write,execute";
+};
--- a/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Mon Jun 20 14:08:05 2016 -0700
+++ b/jdk/test/javax/rmi/PortableRemoteObject/ConcurrentHashMapTest.java	Tue Jun 21 00:45:52 2016 +0100
@@ -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<String> 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());
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/rmi/PortableRemoteObject/jtreg.test.policy	Tue Jun 21 00:45:52 2016 +0100
@@ -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 "<<ALL FILES>>", "read,write,execute";
+};