7195779: javax/management/remote/mandatory/threads/ExecutorTest.java fails intermittently, NPE in tie class
authoralanb
Fri, 05 Oct 2012 15:08:10 +0100
changeset 14035 1f730fd430b5
parent 13850 479d3302a26d
child 14036 d5752c9082a1
child 14238 172cbca33d89
7195779: javax/management/remote/mandatory/threads/ExecutorTest.java fails intermittently, NPE in tie class Reviewed-by: alanb, coffeys Contributed-by: jaroslav.bachorik@oracle.com
corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java
--- a/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Wed Jul 05 18:23:50 2017 +0200
+++ b/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Fri Oct 05 15:08:10 2012 +0100
@@ -1631,7 +1631,7 @@
 
         // Write data members...
         p.pln();
-        p.pln("private " + getName(theType) + " target = null;");
+        p.pln("volatile private " + getName(theType) + " target = null;");
         p.pln();
 
         // Write the ids...
@@ -1695,6 +1695,10 @@
 
         if (remoteMethods.length > 0) {
             p.plnI("try {");
+            p.pln(getName(theType) + " target = this.target;");
+            p.plnI("if (target == null) {");
+            p.pln("throw new java.io.IOException();");
+            p.pOln("}");
             p.plnI(idExtInputStream + " "+in+" = ");
             p.pln("(" + idExtInputStream + ") "+_in+";");
             p.pO();