changeset 707:2abbbec3c03c

Merge jdk7u40-b31
author andrew
date Mon, 08 Jul 2013 22:40:57 +0100
parents fd00f67b65c4 3d2b811b8a79
children e5da8ecaf6f9
files .hgtags src/share/classes/com/sun/corba/se/impl/orbutil/ORBClassLoader.java
diffstat 46 files changed, 403 insertions(+), 187 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed May 22 16:12:01 2013 +0100
+++ b/.hgtags	Mon Jul 08 22:40:57 2013 +0100
@@ -283,6 +283,7 @@
 e82d31e1f1189ae6f02d6855f0cd78074599b2e1 jdk7u17-b02
 d4366e557c4c5af62a94fc9885aed87c99abc848 jdk7u17-b30
 a6f066dd2cd526da73070d1e46c9b1e1ab1a6756 jdk7u17-b31
+6401c6b99d2d43ed4f0e2d38dce496069f6e91f8 jdk7u17-b32
 f5ef46204dba19679edd7492b221110fd1a0bd33 jdk7u21-b01
 17ecd70a2247ed86a095aae9f1a201fa7feea861 jdk7u21-b02
 bf0877613aeba816d5f18ea6316d535819f628e9 jdk7u21-b03
@@ -296,6 +297,24 @@
 61e2e2d9cfcea20132b50d8fb7ead66a8a373db7 jdk7u21-b11
 3c774492beaaff241c654add2c4e683b9ff002f2 jdk7u21-b30
 fa2a377ce52dfa88fca858d735d78b53f2b5b754 jdk7u21-b12
+3d0f2d5b1866860f7089b51cca8ca0ca41c04d9c jdk7u25-b01
+cdbafc5080eeb8ea3fec9fe7d071e0bf96635581 jdk7u25-b02
+2057de7ee6b17ab3335ec6cd5730f88f4cfe9502 jdk7u25-b03
+b180f1282ad221bde0d4d865c879c0fa7f8ef4c8 jdk7u25-b04
+d97e6c162735798fe0c9f1dd582aa1114b6c5447 jdk7u25-b05
+da9301dac56c26846212db33bb20001652b6ce60 jdk7u25-b06
+aa2dc8d3bb2cdd726ec97bc2bf130eec46467f28 jdk7u25-b07
+550d43da7fe2f85bbce88cc94066c589480b1221 jdk7u25-b08
+161ec4dd450d59e1b8ad136db231925c97ff6205 jdk7u25-b09
+c9da98e82bb006dccd94a50871d6cdb66fa2d7e7 jdk7u25-b10
+109386df5b8e259d0af802217769a3c448404e49 jdk7u25-b11
+ef8e6f8305d524f3b448a85f901aadf1adc81fc0 jdk7u25-b12
+eca480919c71072a31f62a61cb3aad30677007e3 jdk7u25-b13
+577c4dd1a6e9bc1bb2c2e5d5ecbab8eacb4121af jdk7u25-b14
+4fde7ac2ecf4b170022ebbf8a961e6dbb229ccab jdk7u25-b15
+f4bec833a24b20f5ae770d0650350fc8950c9dc0 jdk7u25-b30
+65d0e39500d56c6ea1fd52abbd1bef7966c3e87f jdk7u25-b16
+d77153cbe030f91f432fae7c356cf6b5aab12a12 jdk7u25-b32
 38282b734daefcbb8155b7d7ef9664130330ed14 jdk7u14-b16
 8b1d77697ca4d2a9c29d67fd2ff03aded9b06012 jdk7u14-b17
 862b43d26e03bbceb3465f93354860e0d17eb324 jdk7u14-b18
@@ -303,3 +322,13 @@
 bfbaab73969d4d978d0280d6ad51bac8c47dbaf8 jdk7u14-b19
 a921b45a1f9086a7d598a76f920639050386f996 jdk7u14-b19
 54320e5d9da60df24f0e2c57c011809911dc06e1 jdk7u14-b20
+fb590ca4de9aaf1f6bca945be040dffc55b5e8d2 jdk7u14-b21
+e5d89aa2c1a11dba841a646858dda9ea18dc8f57 jdk7u14-b22
+d85df1552f877a1cc51f43bc07a42a0c48f18e0b jdk7u40-b23
+d3ab3b19caa02ee85359cfe07b6e0b74eb7b3d74 jdk7u40-b24
+abfc54516d0b7f9aed34ef175f6bbb93fda4cbb3 jdk7u40-b25
+be9099c54a35c00d0dfe6beeed8ea5d4ab3cd3fe jdk7u40-b26
+f745eeabb0eaabe8c0835c175b31f1e1c0f00bd4 jdk7u40-b27
+c8b9201f88f4ce417df7a40efcb7fef656d94512 jdk7u40-b28
+1ad0a5a3f7b1e9d95670d733d7e70714050ba6bf jdk7u40-b29
+651dcadbd9774165e017f8b7d1bde7d7d280ae1d jdk7u40-b30
--- a/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk	Wed May 22 16:12:01 2013 +0100
+++ b/make/com/sun/corba/minclude/com_sun_corba_se_impl_orbutil.jmk	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2013, 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
@@ -39,7 +39,6 @@
 	com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java \
 	com/sun/corba/se/impl/orbutil/ORBConstants.java \
 	com/sun/corba/se/impl/orbutil/ORBUtility.java \
-	com/sun/corba/se/impl/orbutil/ORBClassLoader.java \
 	com/sun/corba/se/impl/orbutil/RepIdDelegator.java \
 	com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java \
 	com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java \
--- a/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -81,7 +81,6 @@
 
 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
 import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 import com.sun.corba.se.impl.orbutil.ORBUtility;
 import com.sun.corba.se.impl.util.Utility;
 
--- a/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -33,6 +33,8 @@
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.List ;
 import java.util.ArrayList ;
 
@@ -504,7 +506,13 @@
     public org.omg.CORBA.portable.OutputStream create_output_stream()
     {
         //debug.log ("create_output_stream");
-        return new AnyOutputStream(orb);
+        final ORB finalorb = this.orb;
+        return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
+            @Override
+            public AnyOutputStream run() {
+                return new AnyOutputStream(finalorb);
+            }
+        });
     }
 
     /**
--- a/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -600,7 +600,8 @@
     }
 
     public static CDROutputStream newOutputStream(ORB orb) {
-        TypeCodeOutputStream tcos = new TypeCodeOutputStream((ORB)orb);
+        TypeCodeOutputStream tcos =
+            sun.corba.OutputStreamFactory.newTypeCodeOutputStream(orb);
         //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos +
         // " with no parent");
         return tcos;
--- a/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, 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
@@ -66,7 +66,7 @@
  *
  * @author Ram Jeyaraman
  */
-public class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
+final class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
 
     private ORB orb;
     private byte encodingVersion;
--- a/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -196,7 +196,8 @@
     }
 
     public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) {
-        TypeCodeOutputStream encap = new TypeCodeOutputStream((ORB)_orb, isLittleEndian());
+        TypeCodeOutputStream encap =
+            sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb, isLittleEndian());
         encap.setEnclosingOutputStream(this);
         encap.makeEncapsulation();
         //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this);
@@ -211,7 +212,8 @@
 
     public static TypeCodeOutputStream wrapOutputStream(OutputStream os) {
         boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false);
-        TypeCodeOutputStream tos = new TypeCodeOutputStream((ORB)os.orb(), littleEndian);
+        TypeCodeOutputStream tos =
+            sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb(), littleEndian);
         tos.setEnclosingOutputStream(os);
         //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os);
         return tos;
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -155,7 +155,8 @@
         // be versioned.  This can be handled once this work is complete.
 
         // Create output stream with default endianness.
-        EncapsOutputStream cdrOut = new EncapsOutputStream(
+        EncapsOutputStream cdrOut =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream(
             (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );
 
         // This is an encapsulation, so put out the endian:
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -77,7 +77,6 @@
 import com.sun.corba.se.impl.logging.ORBUtilSystemException;
 import com.sun.corba.se.impl.logging.OMGSystemException;
 import com.sun.corba.se.impl.corba.RequestImpl;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 import com.sun.corba.se.impl.orbutil.ORBConstants;
 import com.sun.corba.se.impl.orbutil.ORBUtility;
 import com.sun.corba.se.impl.orbutil.StackImpl;
--- a/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -86,13 +86,14 @@
 import com.sun.corba.se.impl.encoding.EncapsOutputStream;
 
 import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 
 import com.sun.corba.se.impl.util.RepositoryId;
 
 import com.sun.corba.se.impl.logging.InterceptorsSystemException;
 import com.sun.corba.se.impl.logging.OMGSystemException;
 
+import sun.corba.SharedSecrets;
+
 /**
  * Implementation of the RequestInfo interface as specified in
  * orbos/99-12-02 section 5.4.1.
@@ -452,7 +453,8 @@
 
             // Find the read method on the helper class:
             String helperClassName = className + "Helper";
-            Class helperClass = ORBClassLoader.loadClass( helperClassName );
+            Class<?> helperClass =
+                SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
             Class[] readParams = new Class[1];
             readParams[0] = org.omg.CORBA.portable.InputStream.class;
             Method readMethod = helperClass.getMethod( "read", readParams );
@@ -512,7 +514,8 @@
                 Class exceptionClass = userException.getClass();
                 String className = exceptionClass.getName();
                 String helperClassName = className + "Helper";
-                Class helperClass = ORBClassLoader.loadClass( helperClassName );
+                Class<?> helperClass =
+                    SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
 
                 // Find insert( Any, class ) method
                 Class[] insertMethodParams = new Class[2];
@@ -656,7 +659,8 @@
             // Convert the "core" service context to an
             // "IOP" ServiceContext by writing it to a
             // CDROutputStream and reading it back.
-            EncapsOutputStream out = new EncapsOutputStream(myORB);
+            EncapsOutputStream out =
+                sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
 
             context.write( out, GIOPVersion.V1_2 );
             InputStream inputStream = out.create_input_stream();
@@ -692,8 +696,8 @@
     {
         int id = 0 ;
         // Convert IOP.service_context to core.ServiceContext:
-        EncapsOutputStream outputStream = new EncapsOutputStream(
-            myORB );
+        EncapsOutputStream outputStream =
+           sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
         InputStream inputStream = null;
         UnknownServiceContext coreServiceContext = null;
         ServiceContextHelper.write( outputStream, service_context );
--- a/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java	Mon Jul 08 22:40:57 2013 +0100
@@ -300,11 +300,11 @@
         resetStream();
     }
 
-    public final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
+    final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
         orbStream = os;
     }
 
-    public final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
+    final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
         return orbStream;
     }
 
@@ -327,11 +327,11 @@
         return (javax.rmi.CORBA.ValueHandler) vhandler;
     }
 
-    public final void increaseRecursionDepth(){
+    final void increaseRecursionDepth(){
         recursionDepth++;
     }
 
-    public final int decreaseRecursionDepth(){
+    final int decreaseRecursionDepth(){
         return --recursionDepth;
     }
 
--- a/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -124,19 +124,19 @@
         }
     }
 
-    public final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
+    final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
         orbStream = os;
     }
 
-    public final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
+    final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
         return orbStream;
     }
 
-    public final void increaseRecursionDepth(){
+    final void increaseRecursionDepth(){
         recursionDepth++;
     }
 
-    public final int decreaseRecursionDepth(){
+    final int decreaseRecursionDepth(){
         return --recursionDepth;
     }
 
--- a/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java	Mon Jul 08 22:40:57 2013 +0100
@@ -251,7 +251,7 @@
     }
 
     protected abstract byte getStreamFormatVersion();
-    protected abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
+    abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
 
     // Description of possible actions
     protected static class ReadObjectState {
--- a/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java	Mon Jul 08 22:40:57 2013 +0100
@@ -179,7 +179,7 @@
         putFields.write(this);
     }
 
-    public abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
+    abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
 
     protected abstract void beginOptionalCustomData();
 
--- a/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/io/ValueUtility.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -98,6 +98,14 @@
             public ValueHandlerImpl newValueHandlerImpl() {
                 return ValueHandlerImpl.getInstance();
             }
+            public Class<?> loadClass(String className) throws ClassNotFoundException {
+                if (Thread.currentThread().getContextClassLoader() != null) {
+                    return Thread.currentThread().getContextClassLoader().
+                        loadClass(className);
+                } else {
+                    return ClassLoader.getSystemClassLoader().loadClass(className);
+                }
+            }
         });
     }
 
--- a/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java	Mon Jul 08 22:40:57 2013 +0100
@@ -128,7 +128,8 @@
     static public void writeEncapsulation( WriteContents obj,
         OutputStream os )
     {
-        EncapsOutputStream out = new EncapsOutputStream( (ORB)os.orb() ) ;
+        EncapsOutputStream out =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)os.orb());
 
         out.putEndian() ;
 
--- a/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -95,7 +95,8 @@
 
     public org.omg.IOP.TaggedProfile getIOPProfile()
     {
-        EncapsOutputStream os = new EncapsOutputStream( orb ) ;
+        EncapsOutputStream os =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
         write( os ) ;
         InputStream is = (InputStream)(os.create_input_stream()) ;
         return org.omg.IOP.TaggedProfileHelper.read( is ) ;
--- a/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/ior/IORImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -213,7 +213,8 @@
     {
         StringWriter bs;
 
-        MarshalOutputStream s = new EncapsOutputStream(factory);
+        MarshalOutputStream s =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
         s.putEndian();
         write( (OutputStream)s );
         bs = new StringWriter();
@@ -237,7 +238,8 @@
     }
 
     public org.omg.IOP.IOR getIOPIOR() {
-        EncapsOutputStream os = new EncapsOutputStream(factory);
+        EncapsOutputStream os =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
         write(os);
         InputStream is = (InputStream) (os.create_input_stream());
         return org.omg.IOP.IORHelper.read(is);
--- a/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -87,7 +87,8 @@
 
     public byte[] getBytes( org.omg.CORBA.ORB orb )
     {
-        EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ;
+        EncapsOutputStream os =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
         write( os ) ;
         return os.toByteArray() ;
     }
--- a/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -61,7 +61,8 @@
     public TaggedComponent create( org.omg.CORBA.ORB orb,
         org.omg.IOP.TaggedComponent comp )
     {
-        EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ;
+        EncapsOutputStream os =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
         org.omg.IOP.TaggedComponentHelper.write( os, comp ) ;
         InputStream is = (InputStream)(os.create_input_stream() ) ;
         // Skip the component ID: we just wrote it out above
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -247,7 +247,8 @@
 
     public org.omg.IOP.TaggedProfile getIOPProfile()
     {
-        EncapsOutputStream os = new EncapsOutputStream( orb ) ;
+        EncapsOutputStream os =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
         os.write_long( getId() ) ;
         write( os ) ;
         InputStream is = (InputStream)(os.create_input_stream()) ;
--- a/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -132,8 +132,9 @@
         // Note that this cannot be accomplished with a codec!
 
         // Use the byte order of the given stream
-        OutputStream encapsulatedOS = new EncapsOutputStream( (ORB)os.orb(),
-            ((CDROutputStream)os).isLittleEndian() ) ;
+        OutputStream encapsulatedOS =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream(
+                (ORB)os.orb(), ((CDROutputStream)os).isLittleEndian() ) ;
 
         okeyTemplate.write( id, encapsulatedOS ) ;
         EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ;
--- a/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -109,12 +109,9 @@
 import com.sun.corba.se.impl.util.Utility;
 import com.sun.corba.se.impl.util.IdentityHashtable;
 import com.sun.corba.se.impl.util.JDKBridge;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 import com.sun.corba.se.impl.logging.UtilSystemException;
 import com.sun.corba.se.spi.logging.CORBALogDomains;
 import sun.corba.SharedSecrets;
-import sun.corba.JavaCorbaAccess;
-
 
 /**
  * Provides utility methods that can be used by stubs and ties to
@@ -263,7 +260,7 @@
             return new MarshalException(message,inner);
         } else if (ex instanceof ACTIVITY_REQUIRED) {
             try {
-                Class cl = ORBClassLoader.loadClass(
+                Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
                                "javax.activity.ActivityRequiredException");
                 Class[] params = new Class[2];
                 params[0] = java.lang.String.class;
@@ -279,7 +276,7 @@
             }
         } else if (ex instanceof ACTIVITY_COMPLETED) {
             try {
-                Class cl = ORBClassLoader.loadClass(
+                Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
                                "javax.activity.ActivityCompletedException");
                 Class[] params = new Class[2];
                 params[0] = java.lang.String.class;
@@ -295,7 +292,7 @@
               }
         } else if (ex instanceof INVALID_ACTIVITY) {
             try {
-                Class cl = ORBClassLoader.loadClass(
+                Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
                                "javax.activity.InvalidActivityException");
                 Class[] params = new Class[2];
                 params[0] = java.lang.String.class;
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -48,7 +48,6 @@
 
 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
 import com.sun.corba.se.impl.legacy.connection.USLPort;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
 import com.sun.corba.se.impl.orbutil.ORBConstants ;
 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
 
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -152,7 +152,6 @@
 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
 import com.sun.corba.se.impl.oa.poa.DelegateImpl;
 import com.sun.corba.se.impl.oa.poa.POAFactory;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 import com.sun.corba.se.impl.orbutil.ORBConstants;
 import com.sun.corba.se.impl.orbutil.ORBUtility;
 import com.sun.corba.se.impl.orbutil.StackImpl;
@@ -551,7 +550,7 @@
     public synchronized org.omg.CORBA.portable.OutputStream create_output_stream()
     {
         checkShutdownState();
-        return new EncapsOutputStream(this);
+        return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
     }
 
     /**
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -149,7 +149,7 @@
     }
 
     public OutputStream create_output_stream() {
-        return new EncapsOutputStream(this);
+        return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
     }
 
     public TypeCode create_struct_tc(String id,
--- a/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ParserTable.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -78,7 +78,6 @@
 import com.sun.corba.se.impl.legacy.connection.USLPort ;
 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
 import com.sun.corba.se.impl.orbutil.ORBConstants ;
 import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ;
 import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ;
@@ -86,6 +85,8 @@
 import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl;
 import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl;
 
+import sun.corba.SharedSecrets;
+
 /** Initialize the parser data for the standard ORB parser.  This is used both
  * to implement ORBDataParserImpl and to provide the basic testing framework
  * for ORBDataParserImpl.
@@ -640,8 +641,8 @@
                 String param = (String)value ;
 
                 try {
-                    Class legacySocketFactoryClass =
-                        ORBClassLoader.loadClass(param);
+                    Class<?> legacySocketFactoryClass =
+                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
                     // For security reasons avoid creating an instance if
                     // this socket factory class is not one that would fail
                     // the class cast anyway.
@@ -670,7 +671,8 @@
                 String param = (String)value ;
 
                 try {
-                    Class socketFactoryClass = ORBClassLoader.loadClass(param);
+                    Class<?> socketFactoryClass =
+                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
                     // For security reasons avoid creating an instance if
                     // this socket factory class is not one that would fail
                     // the class cast anyway.
@@ -699,7 +701,8 @@
                 String param = (String)value ;
 
                 try {
-                    Class iorToSocketInfoClass = ORBClassLoader.loadClass(param);
+                    Class<?> iorToSocketInfoClass =
+                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
                     // For security reasons avoid creating an instance if
                     // this socket factory class is not one that would fail
                     // the class cast anyway.
@@ -728,7 +731,8 @@
                 String param = (String)value ;
 
                 try {
-                    Class iiopPrimaryToContactInfoClass = ORBClassLoader.loadClass(param);
+                    Class<?> iiopPrimaryToContactInfoClass =
+                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
                     // For security reasons avoid creating an instance if
                     // this socket factory class is not one that would fail
                     // the class cast anyway.
@@ -757,8 +761,8 @@
                 String param = (String)value ;
 
                 try {
-                    Class contactInfoListFactoryClass =
-                        ORBClassLoader.loadClass(param);
+                    Class<?> contactInfoListFactoryClass =
+                        SharedSecrets.getJavaCorbaAccess().loadClass(param);
                     // For security reasons avoid creating an instance if
                     // this socket factory class is not one that would fail
                     // the class cast anyway.
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBClassLoader.java	Wed May 22 16:12:01 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2001, 2002, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package com.sun.corba.se.impl.orbutil;
-
-/**
- * Based on feedback from bug report 4452016, all class loading
- * in the ORB is isolated here.  It is acceptable to use
- * Class.forName only when one is certain that the desired class
- * should come from the core JDK.
- */
-public class ORBClassLoader
-{
-    public static Class loadClass(String className)
-        throws ClassNotFoundException
-    {
-        return ORBClassLoader.getClassLoader().loadClass(className);
-    }
-
-    public static ClassLoader getClassLoader() {
-        if (Thread.currentThread().getContextClassLoader() != null)
-            return Thread.currentThread().getContextClassLoader();
-        else
-            return ClassLoader.getSystemClassLoader();
-    }
-}
--- a/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -90,6 +90,8 @@
 import com.sun.corba.se.impl.logging.OMGSystemException ;
 import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent;
 
+import sun.corba.SharedSecrets;
+
 /**
  *  Handy class full of static functions that don't belong in util.Utility for pure ORB reasons.
  */
@@ -262,8 +264,8 @@
     {
         try {
             String name = classNameOf(strm.read_string());
-            SystemException ex
-                = (SystemException)ORBClassLoader.loadClass(name).newInstance();
+            SystemException ex = (SystemException)SharedSecrets.
+                getJavaCorbaAccess().loadClass(name).newInstance();
             ex.minor = strm.read_long();
             ex.completed = CompletionStatus.from_int(strm.read_long());
             return ex;
--- a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -1794,8 +1794,7 @@
 
         if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
             // locate msgs 1.0 & 1.1 :=> grow,
-            // REVISIT - build from factory
-            outputObject = new CDROutputObject(
+            outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                              (ORB) messageMediator.getBroker(),
                              this,
                              GIOPVersion.V1_0,
@@ -1804,8 +1803,7 @@
                              ORBConstants.STREAM_FORMAT_VERSION_1);
         } else {
             // 1.2 :=> stream
-            // REVISIT - build from factory
-            outputObject = new CDROutputObject(
+            outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
                              (ORB) messageMediator.getBroker(),
                              messageMediator,
                              reply,
@@ -1959,7 +1957,8 @@
                           ReplyMessage.NEEDS_ADDRESSING_MODE,
                           null, null);
             // REVISIT: via acceptor factory.
-            CDROutputObject outputObject = new CDROutputObject(
+            CDROutputObject outputObject =
+                sun.corba.OutputStreamFactory.newCDROutputObject(
                 (ORB)messageMediator.getBroker(),
                 this,
                 messageMediator.getGIOPVersion(),
@@ -2126,7 +2125,7 @@
         ex.printStackTrace(pw);
         pw.flush(); // NOTE: you must flush or baos will be empty.
         EncapsOutputStream encapsOutputStream =
-            new EncapsOutputStream((ORB)mediator.getBroker());
+            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
         encapsOutputStream.putEndian();
         encapsOutputStream.write_wstring(baos.toString());
         UnknownServiceContext serviceContext =
@@ -2203,12 +2202,11 @@
         // REVISIT = do not use null.
         //
         if (messageMediator.getConnection() == null) {
-            // REVISIT - needs factory
             replyOutputObject =
-                new CDROutputObject(orb, messageMediator,
-                                    messageMediator.getReplyHeader(),
-                                    messageMediator.getStreamFormatVersion(),
-                                    BufferManagerFactory.GROW);
+                sun.corba.OutputStreamFactory.newCDROutputObject(orb,
+                            messageMediator, messageMediator.getReplyHeader(),
+                            messageMediator.getStreamFormatVersion(),
+                            BufferManagerFactory.GROW);
         } else {
             replyOutputObject = messageMediator.getConnection().getAcceptor()
              .createOutputObject(messageMediator.getBroker(), messageMediator);
--- a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -41,7 +41,6 @@
 
 import com.sun.corba.se.impl.orbutil.ORBUtility;
 import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 
 import com.sun.corba.se.spi.logging.CORBALogDomains ;
 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
--- a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -60,9 +60,10 @@
 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
 import com.sun.corba.se.impl.orbutil.ORBUtility;
 import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 import com.sun.corba.se.impl.protocol.AddressingDispositionException;
 
+import sun.corba.SharedSecrets;
+
 /**
  * This class acts as the base class for the various GIOP message types. This
  * also serves as a factory to create various message types. We currently
@@ -909,7 +910,8 @@
         SystemException sysEx = null;
 
         try {
-            Class clazz = ORBClassLoader.loadClass(exClassName);
+            Class<?> clazz =
+                SharedSecrets.getJavaCorbaAccess().loadClass(exClassName);
             if (message == null) {
                 sysEx = (SystemException) clazz.newInstance();
             } else {
--- a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -37,7 +37,6 @@
 import com.sun.corba.se.spi.servicecontext.ServiceContexts;
 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
 import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 import com.sun.corba.se.spi.ior.IOR;
 import com.sun.corba.se.impl.encoding.CDRInputStream;
 
--- a/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -37,7 +37,6 @@
 import com.sun.corba.se.spi.servicecontext.ServiceContexts;
 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
 import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader;
 import com.sun.corba.se.spi.ior.IOR;
 import com.sun.corba.se.impl.encoding.CDRInputStream;
 
--- a/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -214,7 +214,7 @@
             messageMediator;
 
         OutputObject outputObject =
-            new CDROutputObject(orb, messageMediator,
+            sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                                 corbaMessageMediator.getRequestHeader(),
                                 corbaMessageMediator.getStreamFormatVersion());
 
--- a/src/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -134,7 +134,7 @@
             messageMediator;
         // NOTE: GROW.
         OutputObject outputObject =
-            new CDROutputObject(orb, messageMediator,
+            sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
                                 corbaMessageMediator.getRequestHeader(),
                                 corbaMessageMediator.getStreamFormatVersion(),
                                 BufferManagerFactory.GROW);
--- a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -534,9 +534,9 @@
     {
         CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
             messageMediator;
-        return new CDROutputObject((ORB) broker, corbaMessageMediator,
-                                   corbaMessageMediator.getReplyHeader(),
-                                   corbaMessageMediator.getStreamFormatVersion());
+        return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker,
+                       corbaMessageMediator, corbaMessageMediator.getReplyHeader(),
+                       corbaMessageMediator.getStreamFormatVersion());
     }
 
     ////////////////////////////////////////////////////
--- a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -1587,8 +1587,8 @@
     {
         // REVISIT: See comments in CDROutputObject constructor.
         CDROutputObject outputObject =
-            new CDROutputObject((ORB)orb, null, giopVersion, this, msg,
-                                ORBConstants.STREAM_FORMAT_VERSION_1);
+            sun.corba.OutputStreamFactory.newCDROutputObject((ORB)orb, null, giopVersion,
+                                this, msg, ORBConstants.STREAM_FORMAT_VERSION_1);
         msg.write(outputObject);
 
         outputObject.writeTo(this);
--- a/src/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -42,7 +42,8 @@
     public org.omg.IOP.TaggedComponent getIOPComponent(
         org.omg.CORBA.ORB orb )
     {
-        EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ;
+        EncapsOutputStream os =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
         write( os ) ;
         InputStream is = (InputStream)(os.create_input_stream() ) ;
         return org.omg.IOP.TaggedComponentHelper.read( is ) ;
--- a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -97,8 +97,8 @@
 
 import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
 
-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
 import sun.awt.AppContext;
+import sun.corba.SharedSecrets;
 
 public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
     implements Broker, TypeCodeFactory
@@ -201,7 +201,7 @@
 
                         try {
                             // First try the configured class name, if any
-                            Class cls = ORBClassLoader.loadClass( className ) ;
+                            Class<?> cls = SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
                             sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ;
                         } catch (Exception exc) {
                             // Use the default. Log the error as a warning.
--- a/src/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -35,9 +35,10 @@
 import com.sun.corba.se.spi.logging.CORBALogDomains ;
 
 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
-import com.sun.corba.se.impl.orbutil.ORBClassLoader ;
 import com.sun.corba.se.impl.orbutil.ObjectUtility ;
 
+import sun.corba.SharedSecrets;
+
 /** This is a static factory class for commonly used operations
 * for property parsing.  The following operations are supported:
 * <ul>
@@ -247,7 +248,8 @@
             String className = getString( value ) ;
 
             try {
-                Class result = ORBClassLoader.loadClass( className ) ;
+                Class<?> result =
+                    SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
                 return result ;
             } catch (Exception exc) {
                 ORBUtilSystemException wrapper = ORBUtilSystemException.get(
--- a/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -92,7 +92,8 @@
      */
     public void write(OutputStream s, GIOPVersion gv) throws SystemException
     {
-        EncapsOutputStream os = new EncapsOutputStream( (ORB)(s.orb()), gv ) ;
+        EncapsOutputStream os =
+            sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
         os.putEndian() ;
         writeData( os ) ;
         byte[] data = os.toByteArray() ;
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -258,6 +258,19 @@
   {
     Vector labels = vectorizeLabels (u.branches (), true);
 
+    if (Util.javaName(utype).equals ("boolean")) {
+        stream.println( "" ) ;
+        stream.println( "  private void verifyDefault (boolean discriminator)" ) ;
+        stream.println( "  {" ) ;
+        if (labels.contains ("true"))
+            stream.println ("    if ( discriminator )");
+        else
+            stream.println ("    if ( !discriminator )");
+        stream.println( "        throw new org.omg.CORBA.BAD_OPERATION();" ) ;
+        stream.println( "  }" ) ;
+        return;
+    }
+
     stream.println( "" ) ;
     stream.println( "  private void verifyDefault( " + Util.javaName(utype) +
         " value )" ) ;
@@ -763,7 +776,7 @@
             stream.println (indent + "if (" + disName + ')');
 
             if (firstBranch == null)
-                stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
+                stream.println (indent + "  value._default(" + disName + ");");
             else {
                 stream.println (indent + '{');
                 index = readBranch (index, indent + "  ", firstBranch.typedef.name (),
@@ -774,7 +787,7 @@
             stream.println (indent + "else");
 
             if (secondBranch == null)
-                stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
+                stream.println (indent + "  value._default(" + disName + ");");
             else {
                 stream.println (indent + '{');
                 index = readBranch (index, indent + "  ", secondBranch.typedef.name (),
@@ -924,23 +937,25 @@
         firstBranch = secondBranch;
         secondBranch = tmp;
       }
-      stream.println (indent + "if (" + disName + ')');
-      if (firstBranch == null)
-        stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
-      else
-      {
-        stream.println (indent + '{');
-        index = writeBranch (index, indent + "  ", name, firstBranch.typedef, stream);
-        stream.println (indent + '}');
-      }
-      stream.println (indent + "else");
-      if (secondBranch == null)
-        stream.println (indent + "  throw new org.omg.CORBA.BAD_OPERATION ();");
-      else
-      {
-        stream.println (indent + '{');
-        index = writeBranch (index, indent + "  ", name, secondBranch.typedef, stream);
-        stream.println (indent + '}');
+      if (firstBranch != null && secondBranch != null) {
+          stream.println (indent + "if (" + disName + ')');
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, firstBranch.typedef, stream);
+          stream.println (indent + '}');
+          stream.println (indent + "else");
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, secondBranch.typedef, stream);
+          stream.println (indent + '}');
+      } else if (firstBranch != null) {
+          stream.println (indent + "if (" + disName + ')');
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, firstBranch.typedef, stream);
+          stream.println (indent + '}');
+      } else {
+          stream.println (indent + "if (!" + disName + ')');
+          stream.println (indent + '{');
+          index = writeBranch (index, indent + "  ", name, secondBranch.typedef, stream);
+          stream.println (indent + '}');
       }
     }
     return index;
--- a/src/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -31,6 +31,10 @@
 
 package org.omg.CORBA_2_3.portable;
 
+import java.io.SerializablePermission;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 /**
  * OutputStream provides interface for writing of all of the mapped IDL type
  * to the stream. It extends org.omg.CORBA.portable.OutputStream, and defines
@@ -43,6 +47,40 @@
 
 public abstract class OutputStream extends org.omg.CORBA.portable.OutputStream {
 
+    private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowOutputStreamSubclass";
+    private static final boolean allowSubclass = AccessController.doPrivileged(
+        new PrivilegedAction<Boolean>() {
+            @Override
+            public Boolean run() {
+            String prop = System.getProperty(ALLOW_SUBCLASS_PROP);
+                return prop == null ? false :
+                           (prop.equalsIgnoreCase("false") ? false : true);
+            }
+        });
+
+    private static Void checkPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            if (!allowSubclass)
+                sm.checkPermission(new
+                    SerializablePermission("enableSubclassImplementation"));
+        }
+        return null;
+    }
+    private OutputStream(Void ignore) { }
+
+    /**
+     * Create a new instance of this class.
+     *
+     * throw SecurityException if SecurityManager is installed and
+     * enableSubclassImplementation SerializablePermission
+     * is not granted or jdk.corba.allowOutputStreamSubclass system
+     * property is either not set or is set to 'false'
+     */
+    public OutputStream() {
+        this(checkPermission());
+    }
+
     /**
      * Marshals a value type to the output stream.
      * @param value is the acutal value to write
--- a/src/share/classes/sun/corba/JavaCorbaAccess.java	Wed May 22 16:12:01 2013 +0100
+++ b/src/share/classes/sun/corba/JavaCorbaAccess.java	Mon Jul 08 22:40:57 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, 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
@@ -29,4 +29,5 @@
 
 public interface JavaCorbaAccess {
     public ValueHandlerImpl newValueHandlerImpl();
+    public Class<?> loadClass(String className) throws ClassNotFoundException;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/corba/OutputStreamFactory.java	Mon Jul 08 22:40:57 2013 +0100
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2013, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.corba;
+
+import com.sun.corba.se.impl.corba.AnyImpl;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.encoding.TypeCodeOutputStream;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public final class OutputStreamFactory {
+
+    private OutputStreamFactory() {
+    }
+
+    public static TypeCodeOutputStream newTypeCodeOutputStream(
+            final ORB orb) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<TypeCodeOutputStream>() {
+                @Override
+                public TypeCodeOutputStream run() {
+                    return new TypeCodeOutputStream(orb);
+                }
+        });
+    }
+
+    public static TypeCodeOutputStream newTypeCodeOutputStream(
+            final ORB orb, final boolean littleEndian) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<TypeCodeOutputStream>() {
+                @Override
+                public TypeCodeOutputStream run() {
+                    return new TypeCodeOutputStream(orb, littleEndian);
+                }
+        });
+    }
+
+    public static EncapsOutputStream newEncapsOutputStream(
+            final ORB orb) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<EncapsOutputStream>() {
+                @Override
+                public EncapsOutputStream run() {
+                    return new EncapsOutputStream(
+                        (com.sun.corba.se.spi.orb.ORB)orb);
+                }
+        });
+    }
+
+    public static EncapsOutputStream newEncapsOutputStream(
+            final ORB orb, final GIOPVersion giopVersion) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<EncapsOutputStream>() {
+                @Override
+                public EncapsOutputStream run() {
+                    return new EncapsOutputStream(
+                        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion);
+                }
+        });
+    }
+
+    public static EncapsOutputStream newEncapsOutputStream(
+            final ORB orb, final boolean isLittleEndian) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<EncapsOutputStream>() {
+                @Override
+                public EncapsOutputStream run() {
+                    return new EncapsOutputStream(
+                        (com.sun.corba.se.spi.orb.ORB)orb, isLittleEndian);
+                }
+        });
+    }
+
+    public static CDROutputObject newCDROutputObject(
+            final ORB orb, final MessageMediator messageMediator,
+            final Message header, final byte streamFormatVersion) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<CDROutputObject>() {
+                @Override
+                public CDROutputObject run() {
+                    return new CDROutputObject(orb, messageMediator,
+                        header, streamFormatVersion);
+                }
+        });
+    }
+
+    public static CDROutputObject newCDROutputObject(
+            final ORB orb, final MessageMediator messageMediator,
+            final Message header, final byte streamFormatVersion,
+            final int strategy) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<CDROutputObject>() {
+                @Override
+                public CDROutputObject run() {
+                    return new CDROutputObject(orb, messageMediator,
+                        header, streamFormatVersion, strategy);
+                }
+        });
+    }
+
+    public static CDROutputObject newCDROutputObject(
+            final ORB orb, final CorbaMessageMediator mediator,
+            final GIOPVersion giopVersion, final CorbaConnection connection,
+            final Message header, final byte streamFormatVersion) {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<CDROutputObject>() {
+                @Override
+                public CDROutputObject run() {
+                    return new CDROutputObject(orb, mediator,
+                        giopVersion, connection, header, streamFormatVersion);
+                }
+        });
+    }
+
+}