Merge jdk8u65-b03

Thu, 25 Jun 2015 07:21:32 -0700

author
asaha
date
Thu, 25 Jun 2015 07:21:32 -0700
changeset 1057
7a98523691a9
parent 1056
71a58c447ffe
parent 1052
da53c079df5d
child 1058
771cf2ce97e3

Merge

     1.1 --- a/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Wed Jun 24 21:35:19 2015 -0700
     1.2 +++ b/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Thu Jun 25 07:21:32 2015 -0700
     1.3 @@ -446,6 +446,9 @@
     1.4          if (emitPermissionCheck) {
     1.5  
     1.6              // produce the following generated code for example
     1.7 +            //
     1.8 +            // private transient boolean _instantiated = false;
     1.9 +            //
    1.10              // private static Void checkPermission() {
    1.11              // SecurityManager sm = System.getSecurityManager();
    1.12              // if (sm != null) {
    1.13 @@ -460,11 +463,21 @@
    1.14              //
    1.15              // public _XXXXX_Stub() {
    1.16              // this(checkPermission());
    1.17 +            // _instantiated = true;
    1.18 +            // }
    1.19 +            //
    1.20 +            // private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
    1.21 +            //    checkPermission();
    1.22 +            //    s.defaultReadObject();
    1.23 +            //    _instantiated = true;
    1.24              // }
    1.25              //
    1.26              // where XXXXX is the name of the remote interface
    1.27  
    1.28                  p.pln();
    1.29 +                p.plnI("private transient boolean _instantiated = false;");
    1.30 +                p.pln();
    1.31 +                p.pO();
    1.32                  p.plnI("private static Void checkPermission() {");
    1.33                  p.plnI("SecurityManager sm = System.getSecurityManager();");
    1.34                  p.pln("if (sm != null) {");
    1.35 @@ -481,13 +494,23 @@
    1.36                  p.pO();
    1.37  
    1.38                  p.pI();
    1.39 -                p.pln("private " + currentClass + "(Void ignore) {  }");
    1.40 +                p.plnI("private " + currentClass + "(Void ignore) {  }");
    1.41                  p.pln();
    1.42 -
    1.43 -                p.plnI("public " + currentClass + "() { ");
    1.44 +                p.pO();
    1.45 +
    1.46 +                p.plnI("public " + currentClass + "() {");
    1.47                  p.pln("this(checkPermission());");
    1.48 +                p.pln("_instantiated = true;");
    1.49                  p.pOln("}");
    1.50                  p.pln();
    1.51 +                p.plnI("private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {");
    1.52 +                p.plnI("checkPermission();");
    1.53 +                p.pO();
    1.54 +                p.pln("s.defaultReadObject();");
    1.55 +                p.pln("_instantiated = true;");
    1.56 +                p.pOln("}");
    1.57 +                p.pln();
    1.58 +                //p.pO();
    1.59          }
    1.60  
    1.61         if (!emitPermissionCheck) {
    1.62 @@ -894,6 +917,7 @@
    1.63          String paramNames[] = method.getArgumentNames();
    1.64          Type returnType = method.getReturnType();
    1.65          ValueType[] exceptions = getStubExceptions(method,false);
    1.66 +        boolean hasIOException = false;
    1.67  
    1.68          addNamesInUse(method);
    1.69          addNameInUse("_type_ids");
    1.70 @@ -921,6 +945,13 @@
    1.71          p.plnI(" {");
    1.72  
    1.73          // Now create the method body...
    1.74 +        if (emitPermissionCheck) {
    1.75 +            p.pln("if ((System.getSecurityManager() != null) && (!_instantiated)) {");
    1.76 +            p.plnI("    throw new java.io.IOError(new java.io.IOException(\"InvalidObject \"));");
    1.77 +            p.pOln("}");
    1.78 +            p.pln();
    1.79 +        }
    1.80 +
    1.81  
    1.82          if (localStubs) {
    1.83              writeLocalStubMethodBody(p,method,theType);

mercurial