Merge jdk8-b124 jdk8-b125

Wed, 15 Jan 2014 10:45:55 -0800

author
lana
date
Wed, 15 Jan 2014 10:45:55 -0800
changeset 571
7b45151c7a05
parent 570
33e3d3425095
parent 567
9240e4c6b107
child 572
6b66ffd36885
child 579
18c4d03cf516

Merge

     1.1 --- a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Mon Jan 13 22:31:32 2014 -0800
     1.2 +++ b/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Wed Jan 15 10:45:55 2014 -0800
     1.3 @@ -82,11 +82,18 @@
     1.4              super((ORB)orb);
     1.5          }
     1.6  
     1.7 -        public org.omg.CORBA.portable.InputStream create_input_stream()
     1.8 -        {
     1.9 -            return new AnyInputStream(
    1.10 -                (com.sun.corba.se.impl.encoding.EncapsInputStream)
    1.11 -                    super.create_input_stream());
    1.12 +        public org.omg.CORBA.portable.InputStream create_input_stream() {
    1.13 +            final org.omg.CORBA.portable.InputStream is = super
    1.14 +                    .create_input_stream();
    1.15 +            AnyInputStream aIS = AccessController
    1.16 +                    .doPrivileged(new PrivilegedAction<AnyInputStream>() {
    1.17 +                        @Override
    1.18 +                        public AnyInputStream run() {
    1.19 +                            return new AnyInputStream(
    1.20 +                                    (com.sun.corba.se.impl.encoding.EncapsInputStream) is);
    1.21 +                        }
    1.22 +                    });
    1.23 +            return aIS;
    1.24          }
    1.25      }
    1.26  
     2.1 --- a/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java	Mon Jan 13 22:31:32 2014 -0800
     2.2 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java	Wed Jan 15 10:45:55 2014 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2001, 2013, 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 @@ -36,11 +36,10 @@
    2.11  import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
    2.12  
    2.13  import com.sun.corba.se.spi.orb.ORB;
    2.14 -
    2.15  import com.sun.corba.se.spi.logging.CORBALogDomains;
    2.16 -
    2.17  import com.sun.corba.se.impl.logging.ORBUtilSystemException;
    2.18  
    2.19 +import sun.corba.EncapsInputStreamFactory;
    2.20  /**
    2.21   * Encapsulations are supposed to explicitly define their
    2.22   * code sets and GIOP version.  The original resolution to issue 2784
    2.23 @@ -148,7 +147,7 @@
    2.24      }
    2.25  
    2.26      public CDRInputStream dup() {
    2.27 -        return new EncapsInputStream(this);
    2.28 +        return EncapsInputStreamFactory.newEncapsInputStream(this);
    2.29      }
    2.30  
    2.31      protected CodeSetConversion.BTCConverter createCharBTCConverter() {
     3.1 --- a/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java	Mon Jan 13 22:31:32 2014 -0800
     3.2 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java	Wed Jan 15 10:45:55 2014 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2001, 2013, 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 @@ -39,6 +39,8 @@
    3.11  import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
    3.12  import com.sun.corba.se.impl.orbutil.ORBConstants;
    3.13  
    3.14 +import sun.corba.EncapsInputStreamFactory;
    3.15 +
    3.16  /**
    3.17   * Encapsulations are supposed to explicitly define their
    3.18   * code sets and GIOP version.  The original resolution to issue 2784
    3.19 @@ -107,11 +109,11 @@
    3.20      public org.omg.CORBA.portable.InputStream create_input_stream() {
    3.21          freeInternalCaches();
    3.22  
    3.23 -        return new EncapsInputStream(orb(),
    3.24 -                                     getByteBuffer(),
    3.25 -                                     getSize(),
    3.26 -                                     isLittleEndian(),
    3.27 -                                     getGIOPVersion());
    3.28 +        return  EncapsInputStreamFactory.newEncapsInputStream(orb(),
    3.29 +                getByteBuffer(),
    3.30 +                getSize(),
    3.31 +                isLittleEndian(),
    3.32 +                getGIOPVersion());
    3.33      }
    3.34  
    3.35      protected CodeSetConversion.CTBConverter createCharCTBConverter() {
     4.1 --- a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java	Mon Jan 13 22:31:32 2014 -0800
     4.2 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java	Wed Jan 15 10:45:55 2014 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     4.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8   *
     4.9   * This code is free software; you can redistribute it and/or modify it
    4.10 @@ -64,6 +64,8 @@
    4.11  import com.sun.corba.se.impl.encoding.CDROutputStream;
    4.12  import com.sun.corba.se.impl.encoding.MarshalInputStream;
    4.13  
    4.14 +import sun.corba.EncapsInputStreamFactory;
    4.15 +
    4.16  public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader
    4.17  {
    4.18      private Map typeMap = null;
    4.19 @@ -157,11 +159,13 @@
    4.20  
    4.21          // create an encapsulation using the marshal buffer
    4.22          if (is instanceof CDRInputStream) {
    4.23 -            encap = new TypeCodeInputStream((ORB)_orb, encapBuffer, encapBuffer.length,
    4.24 -                                            ((CDRInputStream)is).isLittleEndian(),
    4.25 -                                            ((CDRInputStream)is).getGIOPVersion());
    4.26 +            encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
    4.27 +                    encapBuffer, encapBuffer.length,
    4.28 +                    ((CDRInputStream) is).isLittleEndian(),
    4.29 +                    ((CDRInputStream) is).getGIOPVersion());
    4.30          } else {
    4.31 -            encap = new TypeCodeInputStream((ORB)_orb, encapBuffer, encapBuffer.length);
    4.32 +            encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
    4.33 +                    encapBuffer, encapBuffer.length);
    4.34          }
    4.35          encap.setEnclosingInputStream(is);
    4.36          encap.makeEncapsulation();
     5.1 --- a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java	Mon Jan 13 22:31:32 2014 -0800
     5.2 +++ b/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java	Wed Jan 15 10:45:55 2014 -0800
     5.3 @@ -61,6 +61,8 @@
     5.4  import java.math.BigInteger;
     5.5  import java.nio.ByteBuffer;
     5.6  
     5.7 +import sun.corba.EncapsInputStreamFactory;
     5.8 +
     5.9  public final class TypeCodeOutputStream extends EncapsOutputStream
    5.10  {
    5.11      private OutputStream enclosure = null;
    5.12 @@ -77,9 +79,9 @@
    5.13  
    5.14      public org.omg.CORBA.portable.InputStream create_input_stream()
    5.15      {
    5.16 -        //return new TypeCodeInputStream((ORB)orb(), getByteBuffer(), getIndex(), isLittleEndian());
    5.17 -        TypeCodeInputStream tcis
    5.18 -            = new TypeCodeInputStream((ORB)orb(), getByteBuffer(), getIndex(), isLittleEndian(), getGIOPVersion());
    5.19 +        TypeCodeInputStream tcis = EncapsInputStreamFactory
    5.20 +                .newTypeCodeInputStream((ORB) orb(), getByteBuffer(),
    5.21 +                        getIndex(), isLittleEndian(), getGIOPVersion());
    5.22          //if (TypeCodeImpl.debug) {
    5.23              //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent");
    5.24              //tcis.printBuffer();
     6.1 --- a/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java	Mon Jan 13 22:31:32 2014 -0800
     6.2 +++ b/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java	Wed Jan 15 10:45:55 2014 -0800
     6.3 @@ -33,6 +33,8 @@
     6.4  import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
     6.5  import com.sun.corba.se.spi.logging.CORBALogDomains;
     6.6  
     6.7 +import sun.corba.EncapsInputStreamFactory;
     6.8 +
     6.9  import com.sun.corba.se.impl.corba.AnyImpl;
    6.10  import com.sun.corba.se.impl.encoding.EncapsInputStream;
    6.11  import com.sun.corba.se.impl.encoding.EncapsOutputStream;
    6.12 @@ -193,8 +195,9 @@
    6.13          // it is turned into a FormatMismatch exception.
    6.14  
    6.15          try {
    6.16 -            EncapsInputStream cdrIn = new EncapsInputStream( orb, data,
    6.17 -                data.length, giopVersion );
    6.18 +            EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data,
    6.19 +                    data.length, giopVersion );
    6.20 +
    6.21  
    6.22              cdrIn.consumeEndian();
    6.23  
     7.1 --- a/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Mon Jan 13 22:31:32 2014 -0800
     7.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Wed Jan 15 10:45:55 2014 -0800
     7.3 @@ -370,7 +370,7 @@
     7.4       * @exception IOException Any of the usual Input/Output related exceptions.
     7.5       * @since     JDK1.1
     7.6       */
     7.7 -    public final Object readObjectDelegate() throws IOException
     7.8 +    public final synchronized Object readObjectDelegate() throws IOException
     7.9      {
    7.10          try {
    7.11  
    7.12 @@ -389,7 +389,7 @@
    7.13              }
    7.14      }
    7.15  
    7.16 -    final Object simpleReadObject(Class clz,
    7.17 +    final synchronized Object simpleReadObject(Class clz,
    7.18                                    String repositoryID,
    7.19                                    com.sun.org.omg.SendingContext.CodeBase sender,
    7.20                                    int offset)
    7.21 @@ -461,7 +461,7 @@
    7.22          return obj;
    7.23      }
    7.24  
    7.25 -    public final void simpleSkipObject(String repositoryID,
    7.26 +    public final synchronized  void simpleSkipObject(String repositoryID,
    7.27                                         com.sun.org.omg.SendingContext.CodeBase sender)
    7.28                                         /* throws OptionalDataException, ClassNotFoundException, IOException */
    7.29      {
    7.30 @@ -559,7 +559,7 @@
    7.31       *              objects.
    7.32       * @since     JDK1.1
    7.33       */
    7.34 -    public final void defaultReadObjectDelegate()
    7.35 +    final synchronized void defaultReadObjectDelegate()
    7.36      /* throws IOException, ClassNotFoundException, NotActiveException */
    7.37      {
    7.38          try {
    7.39 @@ -988,7 +988,7 @@
    7.40          }
    7.41      }
    7.42  
    7.43 -    private Object inputObject(Class clz,
    7.44 +    private synchronized Object inputObject(Class clz,
    7.45                                 String repositoryID,
    7.46                                 com.sun.org.omg.SendingContext.CodeBase sender,
    7.47                                 int offset)
    7.48 @@ -1317,7 +1317,7 @@
    7.49       * a form of custom marshaling.
    7.50       *
    7.51       */
    7.52 -    private Object inputObjectUsingFVD(Class clz,
    7.53 +    private synchronized Object inputObjectUsingFVD(Class clz,
    7.54                                         String repositoryID,
    7.55                                         com.sun.org.omg.SendingContext.CodeBase sender,
    7.56                                         int offset)
     8.1 --- a/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java	Mon Jan 13 22:31:32 2014 -0800
     8.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java	Wed Jan 15 10:45:55 2014 -0800
     8.3 @@ -201,7 +201,7 @@
     8.4          readObjectState.endDefaultReadObject(this);
     8.5      }
     8.6  
     8.7 -    public abstract void defaultReadObjectDelegate();
     8.8 +    abstract void defaultReadObjectDelegate();
     8.9  
    8.10      abstract void readFields(java.util.Map fieldToValueMap)
    8.11          throws java.io.InvalidClassException, java.io.StreamCorruptedException,
     9.1 --- a/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java	Mon Jan 13 22:31:32 2014 -0800
     9.2 +++ b/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java	Wed Jan 15 10:45:55 2014 -0800
     9.3 @@ -47,6 +47,8 @@
     9.4  import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
     9.5  import com.sun.corba.se.impl.encoding.EncapsInputStream ;
     9.6  
     9.7 +import sun.corba.EncapsInputStreamFactory;
     9.8 +
     9.9  /**
    9.10   * This static utility class contains various utility methods for reading and
    9.11   * writing CDR encapsulations.
    9.12 @@ -108,8 +110,8 @@
    9.13      static public InputStream getEncapsulationStream( InputStream is )
    9.14      {
    9.15          byte[] data = readOctets( is ) ;
    9.16 -        EncapsInputStream result = new EncapsInputStream( is.orb(), data,
    9.17 -            data.length ) ;
    9.18 +        EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.orb(), data,
    9.19 +                data.length ) ;
    9.20          result.consumeEndian() ;
    9.21          return result ;
    9.22      }
    10.1 --- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java	Mon Jan 13 22:31:32 2014 -0800
    10.2 +++ b/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java	Wed Jan 15 10:45:55 2014 -0800
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -49,6 +49,8 @@
   10.11  import com.sun.corba.se.impl.logging.IORSystemException ;
   10.12  
   10.13  import com.sun.corba.se.impl.encoding.EncapsInputStream ;
   10.14 +import sun.corba.EncapsInputStreamFactory;
   10.15 +
   10.16  
   10.17  /** Based on the magic and scid, return the appropriate
   10.18  * ObjectKeyTemplate.  Expects to be called with a valid
   10.19 @@ -217,7 +219,7 @@
   10.20      public ObjectKey create( byte[] key )
   10.21      {
   10.22          OctetSeqHolder osh = new OctetSeqHolder() ;
   10.23 -        EncapsInputStream is = new EncapsInputStream( orb, key, key.length ) ;
   10.24 +        EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream( orb, key, key.length );
   10.25  
   10.26          ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ;
   10.27          if (oktemp == null)
    11.1 --- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java	Mon Jan 13 22:31:32 2014 -0800
    11.2 +++ b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java	Wed Jan 15 10:45:55 2014 -0800
    11.3 @@ -70,6 +70,8 @@
    11.4  import com.sun.corba.se.impl.encoding.EncapsInputStream ;
    11.5  import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
    11.6  
    11.7 +import sun.corba.EncapsInputStreamFactory;
    11.8 +
    11.9  import com.sun.corba.se.impl.util.JDKBridge;
   11.10  
   11.11  import com.sun.corba.se.impl.logging.IORSystemException;
   11.12 @@ -170,8 +172,8 @@
   11.13              throw wrapper.invalidTaggedProfile() ;
   11.14          }
   11.15  
   11.16 -        EncapsInputStream istr = new EncapsInputStream((ORB)orb, profile.profile_data,
   11.17 -            profile.profile_data.length);
   11.18 +        EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
   11.19 +                profile.profile_data.length);
   11.20          istr.consumeEndian();
   11.21          init( istr ) ;
   11.22      }
    12.1 --- a/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java	Mon Jan 13 22:31:32 2014 -0800
    12.2 +++ b/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java	Wed Jan 15 10:45:55 2014 -0800
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 2004, 2013 Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -25,6 +25,7 @@
   12.11  
   12.12  package com.sun.corba.se.impl.presentation.rmi ;
   12.13  
   12.14 +import java.io.SerializablePermission;
   12.15  import java.lang.reflect.InvocationHandler ;
   12.16  import java.lang.reflect.Proxy ;
   12.17  
   12.18 @@ -38,11 +39,18 @@
   12.19  {
   12.20      protected final ClassLoader loader ;
   12.21  
   12.22 -    public StubFactoryDynamicBase( PresentationManager.ClassData classData,
   12.23 -        ClassLoader loader )
   12.24 -    {
   12.25 -        super( classData ) ;
   12.26 +    private static Void checkPermission() {
   12.27 +        SecurityManager sm = System.getSecurityManager();
   12.28 +        if (sm != null) {
   12.29 +            sm.checkPermission(new SerializablePermission(
   12.30 +                    "enableSubclassImplementation"));
   12.31 +        }
   12.32 +        return null;
   12.33 +    }
   12.34  
   12.35 +    private StubFactoryDynamicBase(Void unused,
   12.36 +            PresentationManager.ClassData classData, ClassLoader loader) {
   12.37 +        super(classData);
   12.38          // this.loader must not be null, or the newProxyInstance call
   12.39          // will fail.
   12.40          if (loader == null) {
   12.41 @@ -55,5 +63,11 @@
   12.42          }
   12.43      }
   12.44  
   12.45 +    public StubFactoryDynamicBase( PresentationManager.ClassData classData,
   12.46 +        ClassLoader loader )
   12.47 +    {
   12.48 +        this (checkPermission(), classData, loader);
   12.49 +    }
   12.50 +
   12.51      public abstract org.omg.CORBA.Object makeStub() ;
   12.52  }
    13.1 --- a/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java	Mon Jan 13 22:31:32 2014 -0800
    13.2 +++ b/src/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java	Wed Jan 15 10:45:55 2014 -0800
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -25,14 +25,22 @@
   13.11  
   13.12  package com.sun.corba.se.impl.presentation.rmi;
   13.13  
   13.14 +import java.security.AccessController;
   13.15 +import java.security.PrivilegedAction;
   13.16  import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
   13.17  
   13.18  public class StubFactoryFactoryProxyImpl extends StubFactoryFactoryDynamicBase
   13.19  {
   13.20      public PresentationManager.StubFactory makeDynamicStubFactory(
   13.21 -        PresentationManager pm, PresentationManager.ClassData classData,
   13.22 -        ClassLoader classLoader )
   13.23 +        PresentationManager pm, final PresentationManager.ClassData classData,
   13.24 +        final ClassLoader classLoader )
   13.25      {
   13.26 -        return new StubFactoryProxyImpl( classData, classLoader ) ;
   13.27 +        return AccessController
   13.28 +                .doPrivileged(new PrivilegedAction<StubFactoryProxyImpl>() {
   13.29 +                    @Override
   13.30 +                    public StubFactoryProxyImpl run() {
   13.31 +                        return new StubFactoryProxyImpl(classData, classLoader);
   13.32 +                    }
   13.33 +                });
   13.34      }
   13.35  }
    14.1 --- a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java	Mon Jan 13 22:31:32 2014 -0800
    14.2 +++ b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java	Wed Jan 15 10:45:55 2014 -0800
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -115,6 +115,7 @@
   14.11  
   14.12  import java.util.concurrent.ConcurrentMap;
   14.13  import java.util.concurrent.ConcurrentHashMap;
   14.14 +import sun.corba.EncapsInputStreamFactory;
   14.15  
   14.16  /**
   14.17   * ClientDelegate is the RMI client-side subcontract or representation
   14.18 @@ -847,8 +848,8 @@
   14.19          }
   14.20          byte[] data = ((UnknownServiceContext)sc).getData();
   14.21          EncapsInputStream in =
   14.22 -            new EncapsInputStream((ORB)messageMediator.getBroker(),
   14.23 -                                  data, data.length);
   14.24 +                EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
   14.25 +                                      data, data.length);
   14.26          in.consumeEndian();
   14.27  
   14.28          String msg =
    15.1 --- a/src/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java	Mon Jan 13 22:31:32 2014 -0800
    15.2 +++ b/src/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java	Wed Jan 15 10:45:55 2014 -0800
    15.3 @@ -1,5 +1,5 @@
    15.4  /*
    15.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
    15.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    15.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.8   *
    15.9   * This code is free software; you can redistribute it and/or modify it
   15.10 @@ -36,7 +36,8 @@
   15.11  import java.util.Iterator;
   15.12  import java.rmi.RemoteException;
   15.13  import java.nio.ByteBuffer;
   15.14 -
   15.15 +import java.security.AccessController;
   15.16 +import java.security.PrivilegedAction;
   15.17  import javax.rmi.CORBA.Util;
   15.18  import javax.rmi.CORBA.Tie;
   15.19  
   15.20 @@ -111,6 +112,7 @@
   15.21  import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr;
   15.22  import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr;
   15.23  import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
   15.24 +import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
   15.25  import com.sun.corba.se.impl.util.JDKBridge;
   15.26  
   15.27  /**
   15.28 @@ -156,10 +158,17 @@
   15.29  
   15.30          ByteBufferWithInfo bbwi = cdrOutputObject.getByteBufferWithInfo();
   15.31          cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
   15.32 -
   15.33 -        CDRInputObject cdrInputObject =
   15.34 -            new CDRInputObject(orb, null, bbwi.byteBuffer,
   15.35 -                               cdrOutputObject.getMessageHeader());
   15.36 +        final ORB inOrb = orb;
   15.37 +        final ByteBuffer inBuffer = bbwi.byteBuffer;
   15.38 +        final Message inMsg = cdrOutputObject.getMessageHeader();
   15.39 +        CDRInputObject cdrInputObject = AccessController
   15.40 +                .doPrivileged(new PrivilegedAction<CDRInputObject>() {
   15.41 +                    @Override
   15.42 +                    public CDRInputObject run() {
   15.43 +                        return new CDRInputObject(inOrb, null, inBuffer,
   15.44 +                                inMsg);
   15.45 +                    }
   15.46 +                });
   15.47          messageMediator.setInputObject(cdrInputObject);
   15.48          cdrInputObject.setMessageMediator(messageMediator);
   15.49  
   15.50 @@ -192,9 +201,17 @@
   15.51          cdrOutputObject = (CDROutputObject) messageMediator.getOutputObject();
   15.52          bbwi = cdrOutputObject.getByteBufferWithInfo();
   15.53          cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
   15.54 -        cdrInputObject =
   15.55 -            new CDRInputObject(orb, null, bbwi.byteBuffer,
   15.56 -                               cdrOutputObject.getMessageHeader());
   15.57 +        final ORB inOrb2 = orb;
   15.58 +        final ByteBuffer inBuffer2 = bbwi.byteBuffer;
   15.59 +        final Message inMsg2 = cdrOutputObject.getMessageHeader();
   15.60 +        cdrInputObject = AccessController
   15.61 +                .doPrivileged(new PrivilegedAction<CDRInputObject>() {
   15.62 +                    @Override
   15.63 +                    public CDRInputObject run() {
   15.64 +                        return new CDRInputObject(inOrb2, null, inBuffer2,
   15.65 +                                inMsg2);
   15.66 +                    }
   15.67 +                });
   15.68          messageMediator.setInputObject(cdrInputObject);
   15.69          cdrInputObject.setMessageMediator(messageMediator);
   15.70  
    16.1 --- a/src/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java	Mon Jan 13 22:31:32 2014 -0800
    16.2 +++ b/src/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java	Wed Jan 15 10:45:55 2014 -0800
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -36,6 +36,8 @@
   16.11  import org.omg.CosNaming.NamingContextExt ;
   16.12  import org.omg.CosNaming.NamingContextExtHelper ;
   16.13  
   16.14 +import sun.corba.EncapsInputStreamFactory;
   16.15 +
   16.16  import com.sun.corba.se.spi.ior.IOR;
   16.17  import com.sun.corba.se.spi.ior.IORTemplate;
   16.18  import com.sun.corba.se.spi.ior.ObjectKey;
   16.19 @@ -114,8 +116,8 @@
   16.20               buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0);
   16.21               buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F);
   16.22          }
   16.23 -        EncapsInputStream s = new EncapsInputStream(orb, buf, buf.length,
   16.24 -            orb.getORBData().getGIOPVersion());
   16.25 +        EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
   16.26 +                orb.getORBData().getGIOPVersion());
   16.27          s.consumeEndian();
   16.28          return s.read_Object() ;
   16.29      }
    17.1 --- a/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java	Mon Jan 13 22:31:32 2014 -0800
    17.2 +++ b/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java	Wed Jan 15 10:45:55 2014 -0800
    17.3 @@ -1,5 +1,5 @@
    17.4  /*
    17.5 - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
    17.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
    17.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.8   *
    17.9   * This code is free software; you can redistribute it and/or modify it
   17.10 @@ -58,6 +58,9 @@
   17.11  import com.sun.corba.se.impl.util.Utility ;
   17.12  import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
   17.13  
   17.14 +import sun.corba.EncapsInputStreamFactory;
   17.15 +
   17.16 +
   17.17  public class ServiceContexts {
   17.18      private static boolean isDebugging( OutputStream os )
   17.19      {
   17.20 @@ -198,11 +201,11 @@
   17.21              // Note:  As of Jan 2001, no standard OMG or Sun service contexts
   17.22              // ship wchar data or are defined as using anything but GIOP 1.0 CDR.
   17.23              EncapsInputStream eis
   17.24 -                = new EncapsInputStream(orb,
   17.25 -                                        data,
   17.26 -                                        data.length,
   17.27 -                                        giopVersion,
   17.28 -                                        codeBase);
   17.29 +                = EncapsInputStreamFactory.newEncapsInputStream(orb,
   17.30 +                                    data,
   17.31 +                                    data.length,
   17.32 +                                    giopVersion,
   17.33 +                                    codeBase);
   17.34              eis.consumeEndian();
   17.35  
   17.36              // Now the input stream passed to a ServiceContext
    18.1 --- a/src/share/classes/org/omg/CORBA_2_3/portable/InputStream.java	Mon Jan 13 22:31:32 2014 -0800
    18.2 +++ b/src/share/classes/org/omg/CORBA_2_3/portable/InputStream.java	Wed Jan 15 10:45:55 2014 -0800
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -31,6 +31,10 @@
   18.11  
   18.12  package org.omg.CORBA_2_3.portable;
   18.13  
   18.14 +import java.io.SerializablePermission;
   18.15 +import java.security.AccessController;
   18.16 +import java.security.PrivilegedAction;
   18.17 +
   18.18  /**
   18.19   * InputStream provides for the reading of all of the mapped IDL types
   18.20   * from the stream. It extends org.omg.CORBA.portable.InputStream.  This
   18.21 @@ -43,6 +47,43 @@
   18.22  
   18.23  public abstract class InputStream extends org.omg.CORBA.portable.InputStream {
   18.24  
   18.25 +
   18.26 +    private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowInputStreamSubclass";
   18.27 +
   18.28 +    private static final boolean allowSubclass = AccessController.doPrivileged(
   18.29 +        new PrivilegedAction<Boolean>() {
   18.30 +            @Override
   18.31 +            public Boolean run() {
   18.32 +            String prop = System.getProperty(ALLOW_SUBCLASS_PROP);
   18.33 +                return prop == null ? false :
   18.34 +                           (prop.equalsIgnoreCase("false") ? false : true);
   18.35 +            }
   18.36 +        });
   18.37 +
   18.38 +    private static Void checkPermission() {
   18.39 +        SecurityManager sm = System.getSecurityManager();
   18.40 +        if (sm != null) {
   18.41 +            if (!allowSubclass)
   18.42 +                sm.checkPermission(new
   18.43 +                    SerializablePermission("enableSubclassImplementation"));
   18.44 +        }
   18.45 +        return null;
   18.46 +    }
   18.47 +
   18.48 +    private InputStream(Void ignore) { }
   18.49 +
   18.50 +    /**
   18.51 +     * Create a new instance of this class.
   18.52 +     *
   18.53 +     * throw SecurityException if SecurityManager is installed and
   18.54 +     * enableSubclassImplementation SerializablePermission
   18.55 +     * is not granted or jdk.corba.allowOutputStreamSubclass system
   18.56 +     * property is either not set or is set to 'false'
   18.57 +     */
   18.58 +    public InputStream() {
   18.59 +        this(checkPermission());
   18.60 +    }
   18.61 +
   18.62      /**
   18.63       * Unmarshalls a value type from the input stream.
   18.64       * @return the value type unmarshalled from the input stream
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/share/classes/sun/corba/EncapsInputStreamFactory.java	Wed Jan 15 10:45:55 2014 -0800
    19.3 @@ -0,0 +1,153 @@
    19.4 +/*
    19.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 + *
    19.8 + * This code is free software; you can redistribute it and/or modify it
    19.9 + * under the terms of the GNU General Public License version 2 only, as
   19.10 + * published by the Free Software Foundation.  Oracle designates this
   19.11 + * particular file as subject to the "Classpath" exception as provided
   19.12 + * by Oracle in the LICENSE file that accompanied this code.
   19.13 + *
   19.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   19.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.17 + * version 2 for more details (a copy is included in the LICENSE file that
   19.18 + * accompanied this code).
   19.19 + *
   19.20 + * You should have received a copy of the GNU General Public License version
   19.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   19.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.23 + *
   19.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.25 + * or visit www.oracle.com if you need additional information or have any
   19.26 + * questions.
   19.27 + */
   19.28 +package sun.corba;
   19.29 +
   19.30 +import java.nio.ByteBuffer;
   19.31 +import java.security.AccessController;
   19.32 +import java.security.PrivilegedAction;
   19.33 +
   19.34 +
   19.35 +import com.sun.corba.se.impl.encoding.EncapsInputStream;
   19.36 +import com.sun.corba.se.impl.encoding.TypeCodeInputStream;
   19.37 +import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
   19.38 +import com.sun.corba.se.pept.protocol.MessageMediator;
   19.39 +import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
   19.40 +import com.sun.corba.se.spi.orb.ORB;
   19.41 +import com.sun.org.omg.SendingContext.CodeBase;
   19.42 +
   19.43 +public class EncapsInputStreamFactory {
   19.44 +
   19.45 +    public static EncapsInputStream newEncapsInputStream(
   19.46 +            final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
   19.47 +            final boolean littleEndian, final GIOPVersion version) {
   19.48 +        return AccessController
   19.49 +                .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
   19.50 +                    @Override
   19.51 +                    public EncapsInputStream run() {
   19.52 +                        return new EncapsInputStream(orb, buf, size,
   19.53 +                                littleEndian, version);
   19.54 +                    }
   19.55 +                });
   19.56 +    }
   19.57 +
   19.58 +    public static EncapsInputStream newEncapsInputStream(
   19.59 +            final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
   19.60 +            final int size, final boolean littleEndian,
   19.61 +            final GIOPVersion version) {
   19.62 +        return AccessController
   19.63 +                .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
   19.64 +                    @Override
   19.65 +                    public EncapsInputStream run() {
   19.66 +                        return new EncapsInputStream(orb, byteBuffer, size,
   19.67 +                                littleEndian, version);
   19.68 +                    }
   19.69 +                });
   19.70 +    }
   19.71 +
   19.72 +    public static EncapsInputStream newEncapsInputStream(
   19.73 +            final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
   19.74 +        return AccessController
   19.75 +                .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
   19.76 +                    @Override
   19.77 +                    public EncapsInputStream run() {
   19.78 +                        return new EncapsInputStream(orb, data, size);
   19.79 +                    }
   19.80 +                });
   19.81 +    }
   19.82 +
   19.83 +    public static EncapsInputStream newEncapsInputStream(
   19.84 +            final EncapsInputStream eis) {
   19.85 +        return AccessController
   19.86 +                .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
   19.87 +                    @Override
   19.88 +                    public EncapsInputStream run() {
   19.89 +                        return new EncapsInputStream(eis);
   19.90 +                    }
   19.91 +                });
   19.92 +    }
   19.93 +
   19.94 +    public static EncapsInputStream newEncapsInputStream(
   19.95 +            final org.omg.CORBA.ORB orb, final byte[] data, final int size,
   19.96 +            final GIOPVersion version) {
   19.97 +        return AccessController
   19.98 +                .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
   19.99 +                    @Override
  19.100 +                    public EncapsInputStream run() {
  19.101 +                        return new EncapsInputStream(orb, data, size, version);
  19.102 +                    }
  19.103 +                });
  19.104 +    }
  19.105 +
  19.106 +    public static EncapsInputStream newEncapsInputStream(
  19.107 +            final org.omg.CORBA.ORB orb, final byte[] data, final int size,
  19.108 +            final GIOPVersion version, final CodeBase codeBase) {
  19.109 +        return AccessController
  19.110 +                .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
  19.111 +                    @Override
  19.112 +                    public EncapsInputStream run() {
  19.113 +                        return new EncapsInputStream(orb, data, size, version,
  19.114 +                                codeBase);
  19.115 +                    }
  19.116 +                });
  19.117 +    }
  19.118 +
  19.119 +    public static TypeCodeInputStream newTypeCodeInputStream(
  19.120 +            final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
  19.121 +            final boolean littleEndian, final GIOPVersion version) {
  19.122 +        return AccessController
  19.123 +                .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
  19.124 +                    @Override
  19.125 +                    public TypeCodeInputStream run() {
  19.126 +                        return new TypeCodeInputStream(orb, buf, size,
  19.127 +                                littleEndian, version);
  19.128 +                    }
  19.129 +                });
  19.130 +    }
  19.131 +
  19.132 +    public static TypeCodeInputStream newTypeCodeInputStream(
  19.133 +            final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
  19.134 +            final int size, final boolean littleEndian,
  19.135 +            final GIOPVersion version) {
  19.136 +        return AccessController
  19.137 +                .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
  19.138 +                    @Override
  19.139 +                    public TypeCodeInputStream run() {
  19.140 +                        return new TypeCodeInputStream(orb, byteBuffer, size,
  19.141 +                                littleEndian, version);
  19.142 +                    }
  19.143 +                });
  19.144 +    }
  19.145 +
  19.146 +    public static TypeCodeInputStream newTypeCodeInputStream(
  19.147 +            final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
  19.148 +        return AccessController
  19.149 +                .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
  19.150 +                    @Override
  19.151 +                    public TypeCodeInputStream run() {
  19.152 +                        return new TypeCodeInputStream(orb, data, size);
  19.153 +                    }
  19.154 +                });
  19.155 +    }
  19.156 +}

mercurial