8192757: Improve stub classes implementation jdk8u171-b07

Wed, 07 Feb 2018 00:10:57 -0800

author
rpatil
date
Wed, 07 Feb 2018 00:10:57 -0800
changeset 1692
b90a8fc589af
parent 1689
9cb338e57d31
child 1693
f7f59d87e97d

8192757: Improve stub classes implementation
Reviewed-by: rriggs, dfuchs, erikj

make/BuildCorba.gmk file | annotate | diff | comparison | revisions
src/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java file | annotate | diff | comparison | revisions
src/share/classes/sun/corba/SharedSecrets.java file | annotate | diff | comparison | revisions
src/share/classes/sun/misc/JavaOISAccess.java file | annotate | diff | comparison | revisions
src/share/classes/sun/misc/ObjectInputFilter.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/BuildCorba.gmk	Tue Feb 13 12:14:04 2018 -0800
     1.2 +++ b/make/BuildCorba.gmk	Wed Feb 07 00:10:57 2018 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  #
     1.5 -# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
     1.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8  #
     1.9  # This code is free software; you can redistribute it and/or modify it
    1.10 @@ -174,7 +174,8 @@
    1.11          SETUP := GENERATE_NEWBYTECODE, \
    1.12          SRC := $(CORBA_TOPDIR)/src/share/classes $(CORBA_OUTPUTDIR)/gensrc $(CORBA_OUTPUTDIR)/logwrappers, \
    1.13          EXCLUDES := com/sun/corba/se/PortableActivationIDL \
    1.14 -            com/sun/tools/corba/se/logutil, \
    1.15 +            com/sun/tools/corba/se/logutil \
    1.16 +            sun/misc, \
    1.17          EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
    1.18              com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
    1.19              com/sun/org/omg/CORBA/IDLTypeOperations.java \
     2.1 --- a/src/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java	Tue Feb 13 12:14:04 2018 -0800
     2.2 +++ b/src/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java	Wed Feb 07 00:10:57 2018 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -34,7 +34,6 @@
    2.11  import java.io.ObjectInputStream ;
    2.12  import java.io.ObjectOutputStream ;
    2.13  import java.io.IOException ;
    2.14 -import java.io.StringWriter ;
    2.15  
    2.16  import org.omg.CORBA.ORB ;
    2.17  
    2.18 @@ -47,6 +46,7 @@
    2.19  // other vendor's ORBs.
    2.20  import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
    2.21  import com.sun.corba.se.impl.orbutil.HexOutputStream ;
    2.22 +import sun.corba.SharedSecrets;
    2.23  
    2.24  /**
    2.25   * This class implements a very simply IOR representation
    2.26 @@ -125,14 +125,20 @@
    2.27      {
    2.28          // read the IOR from the ObjectInputStream
    2.29          int typeLength = stream.readInt();
    2.30 +        SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, typeLength);
    2.31          typeData = new byte[typeLength];
    2.32          stream.readFully(typeData);
    2.33 +
    2.34          int numProfiles = stream.readInt();
    2.35 +        SharedSecrets.getJavaOISAccess().checkArray(stream, int[].class, numProfiles);
    2.36 +        SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, numProfiles);
    2.37          profileTags = new int[numProfiles];
    2.38          profileData = new byte[numProfiles][];
    2.39          for (int i = 0; i < numProfiles; i++) {
    2.40              profileTags[i] = stream.readInt();
    2.41 -            profileData[i] = new byte[stream.readInt()];
    2.42 +            int dataSize = stream.readInt();
    2.43 +            SharedSecrets.getJavaOISAccess().checkArray(stream, byte[].class, dataSize);
    2.44 +            profileData[i] = new byte[dataSize];
    2.45              stream.readFully(profileData[i]);
    2.46          }
    2.47      }
     3.1 --- a/src/share/classes/sun/corba/SharedSecrets.java	Tue Feb 13 12:14:04 2018 -0800
     3.2 +++ b/src/share/classes/sun/corba/SharedSecrets.java	Wed Feb 07 00:10:57 2018 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -26,8 +26,10 @@
    3.11  package sun.corba;
    3.12  
    3.13  import com.sun.corba.se.impl.io.ValueUtility;
    3.14 +import sun.misc.JavaOISAccess;
    3.15  import sun.misc.Unsafe;
    3.16  
    3.17 +import java.io.ObjectInputStream;
    3.18  import java.security.AccessController;
    3.19  
    3.20  /** A repository of "shared secrets", which are a mechanism for
    3.21 @@ -43,6 +45,7 @@
    3.22  public class SharedSecrets {
    3.23      private static final Unsafe unsafe = Unsafe.getUnsafe();
    3.24      private static JavaCorbaAccess javaCorbaAccess;
    3.25 +    private static JavaOISAccess javaOISAccess;
    3.26  
    3.27      public static JavaCorbaAccess getJavaCorbaAccess() {
    3.28          if (javaCorbaAccess == null) {
    3.29 @@ -57,4 +60,15 @@
    3.30          javaCorbaAccess = access;
    3.31      }
    3.32  
    3.33 +    public static void setJavaOISAccess(JavaOISAccess access) {
    3.34 +        javaOISAccess = access;
    3.35 +    }
    3.36 +
    3.37 +    public static JavaOISAccess getJavaOISAccess() {
    3.38 +        if (javaOISAccess == null)
    3.39 +            unsafe.ensureClassInitialized(ObjectInputStream.class);
    3.40 +
    3.41 +        return javaOISAccess;
    3.42 +    }
    3.43 +
    3.44  }
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/share/classes/sun/misc/JavaOISAccess.java	Wed Feb 07 00:10:57 2018 -0800
     4.3 @@ -0,0 +1,40 @@
     4.4 +/*
     4.5 + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.  Oracle designates this
    4.11 + * particular file as subject to the "Classpath" exception as provided
    4.12 + * by Oracle in the LICENSE file that accompanied this code.
    4.13 + *
    4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.17 + * version 2 for more details (a copy is included in the LICENSE file that
    4.18 + * accompanied this code).
    4.19 + *
    4.20 + * You should have received a copy of the GNU General Public License version
    4.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.23 + *
    4.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.25 + * or visit www.oracle.com if you need additional information or have any
    4.26 + * questions.
    4.27 + */
    4.28 +
    4.29 +package sun.misc;
    4.30 +
    4.31 +import java.io.InvalidClassException;
    4.32 +import java.io.ObjectInputStream;
    4.33 +
    4.34 +/*
    4.35 + * Skeleton interface added so com.sun.corba.se.impl.ior.StubIORImpl will compile.
    4.36 + * JDK implementation will be used at runtime.
    4.37 + */
    4.38 +public interface JavaOISAccess {
    4.39 +    void setObjectInputFilter(ObjectInputStream stream, ObjectInputFilter filter);
    4.40 +    ObjectInputFilter getObjectInputFilter(ObjectInputStream stream);
    4.41 +    void checkArray(ObjectInputStream stream, Class<?> arrayType, int arrayLength)
    4.42 +        throws InvalidClassException;
    4.43 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/share/classes/sun/misc/ObjectInputFilter.java	Wed Feb 07 00:10:57 2018 -0800
     5.3 @@ -0,0 +1,36 @@
     5.4 +/*
     5.5 + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.  Oracle designates this
    5.11 + * particular file as subject to the "Classpath" exception as provided
    5.12 + * by Oracle in the LICENSE file that accompanied this code.
    5.13 + *
    5.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.17 + * version 2 for more details (a copy is included in the LICENSE file that
    5.18 + * accompanied this code).
    5.19 + *
    5.20 + * You should have received a copy of the GNU General Public License version
    5.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.23 + *
    5.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.25 + * or visit www.oracle.com if you need additional information or have any
    5.26 + * questions.
    5.27 + */
    5.28 +
    5.29 +package sun.misc;
    5.30 +
    5.31 +import java.io.InvalidClassException;
    5.32 +import java.io.ObjectInputStream;
    5.33 +
    5.34 +/*
    5.35 + * Skeleton interface added so com.sun.corba.se.impl.ior.StubIORImpl will compile.
    5.36 + * JDK implementation will be used at runtime.
    5.37 + */
    5.38 +public interface ObjectInputFilter {
    5.39 +}

mercurial