changeset 1255:aba690a4e1de jdk7u171-b00

8160104: CORBA communication improvements Reviewed-by: dfuchs, msheppar
author aefimov
date Mon, 15 Jan 2018 17:24:36 +0000
parents a4ce841000ff
children c0181fdc21a7
files src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java src/share/classes/com/sun/corba/se/impl/ior/IORTypeCheckRegistryImpl.java src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java src/share/classes/com/sun/corba/se/spi/ior/IORTypeCheckRegistry.java src/share/classes/com/sun/corba/se/spi/orb/ORB.java
diffstat 7 files changed, 318 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java	Thu Nov 30 02:51:50 2017 +0000
+++ b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java	Mon Jan 15 17:24:36 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
@@ -26,11 +26,13 @@
 package com.sun.corba.se.impl.encoding;
 
 import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
 import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
 import com.sun.corba.se.impl.encoding.BufferManagerWrite;
 import com.sun.corba.se.pept.encoding.OutputObject;
 import com.sun.corba.se.pept.transport.Connection;
 import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBData;
 
 public class BufferManagerWriteGrow extends BufferManagerWrite
 {
@@ -48,7 +50,20 @@
      * buffer manager as set in the ORB.
      */
     public int getBufferSize() {
-        return orb.getORBData().getGIOPBufferSize();
+        ORBData orbData = null;
+        int bufferSize = ORBConstants.GIOP_DEFAULT_BUFFER_SIZE;
+        if (orb != null) {
+            orbData = orb.getORBData();
+            if (orbData != null) {
+                bufferSize = orbData.getGIOPBufferSize();
+                dprint("BufferManagerWriteGrow.getBufferSize: bufferSize == " + bufferSize);
+            } else {
+                dprint("BufferManagerWriteGrow.getBufferSize: orbData reference is NULL");
+            }
+        } else {
+            dprint("BufferManagerWriteGrow.getBufferSize: orb reference is NULL");
+        }
+        return bufferSize;
     }
 
     public void overflow (ByteBufferWithInfo bbwi)
@@ -89,4 +104,9 @@
      */
     public void close() {}
 
+    private void dprint(String msg) {
+        if (orb.transportDebugFlag) {
+            ORBUtility.dprint(this, msg);
+        }
+    }
 }
--- a/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java	Thu Nov 30 02:51:50 2017 +0000
+++ b/src/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java	Mon Jan 15 17:24:36 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -32,18 +32,9 @@
 
 package com.sun.corba.se.impl.encoding;
 
-import java.io.IOException;
 import java.io.Serializable;
-import java.io.ByteArrayInputStream;
-import java.io.ObjectInputStream;
 import java.io.IOException;
-import java.io.StreamCorruptedException;
-import java.io.OptionalDataException;
-import java.io.IOException;
-
-import java.util.Stack;
-
-import java.net.URL;
+
 import java.net.MalformedURLException;
 
 import java.nio.ByteBuffer;
@@ -53,19 +44,11 @@
 
 import java.math.BigDecimal;
 
-import java.rmi.Remote;
-import java.rmi.StubNotFoundException;
-
 import java.security.AccessController;
 import java.security.PrivilegedExceptionAction;
 import java.security.PrivilegedActionException;
 
 import org.omg.CORBA.SystemException;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Any;
-import org.omg.CORBA.portable.Delegate;
 import org.omg.CORBA.portable.ValueBase;
 import org.omg.CORBA.portable.IndirectionException;
 import org.omg.CORBA.CompletionStatus;
@@ -82,15 +65,12 @@
 import org.omg.CORBA.MARSHAL;
 import org.omg.CORBA.portable.IDLEntity;
 
-import javax.rmi.PortableRemoteObject;
 import javax.rmi.CORBA.Tie;
-import javax.rmi.CORBA.Util;
 import javax.rmi.CORBA.ValueHandler;
 
 import com.sun.corba.se.pept.protocol.MessageMediator;
 import com.sun.corba.se.pept.transport.ByteBufferPool;
 
-import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
 import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
 
 import com.sun.corba.se.spi.ior.IOR;
@@ -99,9 +79,6 @@
 
 import com.sun.corba.se.spi.orb.ORB;
 import com.sun.corba.se.spi.orb.ORBVersionFactory;
-import com.sun.corba.se.spi.orb.ORBVersion;
-
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
 
 import com.sun.corba.se.spi.logging.CORBALogDomains;
 import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
@@ -725,12 +702,14 @@
     //    IDLEntity.class.isAssignableFrom( clz ).
     // 3. If clz is an interface, use it to create the appropriate
     //    stub factory.
+
     public org.omg.CORBA.Object read_Object(Class clz)
     {
         // In any case, we must first read the IOR.
         IOR ior = IORFactories.makeIOR(parent) ;
-        if (ior.isNil())
+        if (ior.isNil()) {
             return null ;
+        }
 
         PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
         String codeBase = ior.getProfile().getCodebase() ;
@@ -739,6 +718,7 @@
         if (clz == null) {
             RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
             String className = rid.getClassName() ;
+            orb.validateIORClass(className);
             boolean isIDLInterface = rid.isIDLType() ;
 
             if (className == null || className.equals( "" ))
@@ -761,11 +741,9 @@
         } else {
             // clz is an interface class
             boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;
-
             stubFactory = sff.createStubFactory( clz.getName(),
                 isIDL, codeBase, clz, clz.getClassLoader() ) ;
         }
-
         return internalIORToObject( ior, stubFactory, orb ) ;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/corba/se/impl/ior/IORTypeCheckRegistryImpl.java	Mon Jan 15 17:24:36 2018 +0000
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2017, 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.ior;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.spi.ior.IORTypeCheckRegistry;
+import com.sun.corba.se.spi.orb.ORB;
+
+public class IORTypeCheckRegistryImpl implements IORTypeCheckRegistry {
+
+    private final Set<String> iorTypeNames;
+    private static final Set<String> builtinIorTypeNames;
+    private ORB theOrb;
+
+    static {
+        builtinIorTypeNames = initBuiltinIorTypeNames();
+    }
+
+    public IORTypeCheckRegistryImpl(String filterProperties, ORB orb) {
+        theOrb = orb;
+        iorTypeNames = parseIorClassNameList(filterProperties);
+    }
+
+    /*
+     *
+     * A note on the validation flow:
+     * 1. against the filter class name list
+     * 2. against the builtin class name list
+     */
+    @Override
+    public boolean isValidIORType(String iorClassName) {
+        dprintTransport(".isValidIORType : iorClassName == " + iorClassName);
+        return validateIorTypeByName(iorClassName);
+    }
+
+
+    private boolean validateIorTypeByName(String iorClassName) {
+        dprintTransport(".validateIorTypeByName : iorClassName == " + iorClassName);
+        boolean isValidType;
+
+        isValidType = checkIorTypeNames(iorClassName);
+
+        if (!isValidType) {
+            isValidType = checkBuiltinClassNames(iorClassName);
+        }
+
+        dprintTransport(".validateIorTypeByName : isValidType == " + isValidType);
+        return isValidType;
+    }
+
+
+    /*
+     * check if the class name corresponding to an IOR Type name
+     * is in the ior class name list as generated from the filter property.
+     * So if the IOR type is recorded in the registry then allow the creation of the
+     * stub factory and let it resolve and load the class. That is if current
+     * type check deliberation permits.
+     * IOR Type names are configured by the filter property
+     */
+    private boolean checkIorTypeNames(
+            String theIorClassName) {
+        return (iorTypeNames != null) && (iorTypeNames.contains(theIorClassName));
+    }
+
+    /*
+     * Check the IOR interface class name against the set of
+     * class names that correspond to the builtin JDK IDL stub classes.
+     */
+    private boolean checkBuiltinClassNames(
+            String theIorClassName) {
+        return builtinIorTypeNames.contains(theIorClassName);
+    }
+
+    private Set<String> parseIorClassNameList(String filterProperty) {
+        Set<String> _iorTypeNames = null;
+        if (filterProperty != null) {
+            String[] tempIorClassNames = filterProperty.split(";");
+            _iorTypeNames = Collections.unmodifiableSet(new HashSet<>(Arrays
+                    .asList(tempIorClassNames)));
+            if (theOrb.orbInitDebugFlag) {
+                dprintConfiguredIorTypeNames();
+            }
+        }
+        return _iorTypeNames;
+    }
+
+    private static Set<String> initBuiltinIorTypeNames() {
+        Set<Class<?>> builtInCorbaStubTypes = initBuiltInCorbaStubTypes();
+        String[] tempBuiltinIorTypeNames = new String[builtInCorbaStubTypes.size()];
+        int i = 0;
+        for (Class<?> _stubClass : builtInCorbaStubTypes) {
+            tempBuiltinIorTypeNames[i++] = _stubClass.getName();
+        }
+        return Collections.unmodifiableSet(new HashSet<>(Arrays
+                .asList(tempBuiltinIorTypeNames)));
+    }
+
+    private static Set<Class<?>> initBuiltInCorbaStubTypes() {
+        Class<?> tempBuiltinCorbaStubTypes[] = {
+            com.sun.corba.se.spi.activation.Activator.class,
+            com.sun.corba.se.spi.activation._ActivatorStub.class,
+            com.sun.corba.se.spi.activation._InitialNameServiceStub.class,
+            com.sun.corba.se.spi.activation._LocatorStub.class,
+            com.sun.corba.se.spi.activation._RepositoryStub.class,
+            com.sun.corba.se.spi.activation._ServerManagerStub.class,
+            com.sun.corba.se.spi.activation._ServerStub.class,
+            org.omg.CosNaming.BindingIterator.class,
+            org.omg.CosNaming._BindingIteratorStub.class,
+            org.omg.CosNaming.NamingContextExt.class,
+            org.omg.CosNaming._NamingContextExtStub.class,
+            org.omg.CosNaming.NamingContext.class,
+            org.omg.CosNaming._NamingContextStub.class,
+            org.omg.DynamicAny.DynAnyFactory.class,
+            org.omg.DynamicAny._DynAnyFactoryStub.class,
+            org.omg.DynamicAny.DynAny.class,
+            org.omg.DynamicAny._DynAnyStub.class,
+            org.omg.DynamicAny.DynArray.class,
+            org.omg.DynamicAny._DynArrayStub.class,
+            org.omg.DynamicAny.DynEnum.class,
+            org.omg.DynamicAny._DynEnumStub.class,
+            org.omg.DynamicAny.DynFixed.class,
+            org.omg.DynamicAny._DynFixedStub.class,
+            org.omg.DynamicAny.DynSequence.class,
+            org.omg.DynamicAny._DynSequenceStub.class,
+            org.omg.DynamicAny.DynStruct.class,
+            org.omg.DynamicAny._DynStructStub.class,
+            org.omg.DynamicAny.DynUnion.class,
+            org.omg.DynamicAny._DynUnionStub.class,
+            org.omg.DynamicAny._DynValueStub.class,
+            org.omg.DynamicAny.DynValue.class,
+            org.omg.PortableServer.ServantActivator.class,
+            org.omg.PortableServer._ServantActivatorStub.class,
+            org.omg.PortableServer.ServantLocator.class,
+            org.omg.PortableServer._ServantLocatorStub.class};
+        return new HashSet<>(
+                Arrays.asList(tempBuiltinCorbaStubTypes));
+    }
+
+    private void dprintConfiguredIorTypeNames() {
+        if (iorTypeNames != null) {
+            for (String iorTypeName : iorTypeNames) {
+                ORBUtility.dprint(this, ".dprintConfiguredIorTypeNames: " + iorTypeName);
+            }
+        }
+    }
+
+    private void dprintTransport(String msg) {
+        if (theOrb.transportDebugFlag) {
+            ORBUtility.dprint(this, msg);
+        }
+    }
+}
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java	Thu Nov 30 02:51:50 2017 +0000
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java	Mon Jan 15 17:24:36 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, 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
@@ -32,37 +32,25 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
-import java.lang.reflect.InvocationTargetException;
 
 import java.util.Set;
 import java.util.HashSet;
-import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.Properties;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Collection;
 import java.util.Collections;
-import java.util.StringTokenizer;
 import java.util.Enumeration;
 import java.util.WeakHashMap;
 
 import java.net.InetAddress;
 
 import java.security.PrivilegedAction;
+import java.security.Security;
 import java.security.AccessController;
 
-import javax.rmi.CORBA.Util;
 import javax.rmi.CORBA.ValueHandler;
 
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.ExceptionList;
-import org.omg.CORBA.ORBPackage.InvalidName;
 import org.omg.CORBA.NVList;
 import org.omg.CORBA.TCKind;
 import org.omg.CORBA.NamedValue;
@@ -75,7 +63,6 @@
 import org.omg.CORBA.UnionMember;
 import org.omg.CORBA.ValueMember;
 import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.MARSHAL;
 
 import org.omg.CORBA.portable.ValueFactory;
 
@@ -83,10 +70,7 @@
 
 import com.sun.org.omg.SendingContext.CodeBase;
 
-import com.sun.corba.se.pept.broker.Broker;
 import com.sun.corba.se.pept.protocol.ClientInvocationInfo;
-import com.sun.corba.se.pept.transport.ContactInfo;
-import com.sun.corba.se.pept.transport.ConnectionCache;
 import com.sun.corba.se.pept.transport.TransportManager;
 
 import com.sun.corba.se.spi.ior.IOR;
@@ -95,8 +79,6 @@
 import com.sun.corba.se.spi.ior.IORFactories;
 import com.sun.corba.se.spi.ior.ObjectKey;
 import com.sun.corba.se.spi.ior.ObjectKeyFactory;
-import com.sun.corba.se.spi.ior.iiop.IIOPFactories;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
 import com.sun.corba.se.spi.oa.OAInvocationInfo;
 import com.sun.corba.se.spi.oa.ObjectAdapterFactory;
 import com.sun.corba.se.spi.orb.DataCollector;
@@ -113,24 +95,18 @@
 import com.sun.corba.se.spi.protocol.ClientDelegateFactory;
 import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
 import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
-import com.sun.corba.se.spi.protocol.RequestDispatcherDefault;
 import com.sun.corba.se.spi.protocol.PIHandler;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.protocol.ForwardException;
 import com.sun.corba.se.spi.resolver.Resolver;
 import com.sun.corba.se.spi.resolver.LocalResolver;
-import com.sun.corba.se.spi.orb.StringPair;
-import com.sun.corba.se.spi.orb.StringPair;
 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
 import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.spi.ior.IORTypeCheckRegistry;
 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
 import com.sun.corba.se.spi.copyobject.CopierManager;
-import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
-import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
 import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
 import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry;
 
-import com.sun.corba.se.impl.corba.TypeCodeFactory;
 import com.sun.corba.se.impl.corba.TypeCodeImpl;
 import com.sun.corba.se.impl.corba.NVListImpl;
 import com.sun.corba.se.impl.corba.ExceptionListImpl;
@@ -139,9 +115,6 @@
 import com.sun.corba.se.impl.corba.EnvironmentImpl;
 import com.sun.corba.se.impl.corba.AsynchInvoke;
 import com.sun.corba.se.impl.corba.AnyImpl;
-import com.sun.corba.se.impl.corba.RequestImpl;
-import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
 import com.sun.corba.se.impl.encoding.CachedCodeBase;
 import com.sun.corba.se.impl.interceptors.PIHandlerImpl;
 import com.sun.corba.se.impl.interceptors.PINoOpHandlerImpl;
@@ -150,12 +123,10 @@
 import com.sun.corba.se.impl.ior.TaggedProfileTemplateFactoryFinderImpl;
 import com.sun.corba.se.impl.oa.toa.TOAFactory;
 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.ORBConstants;
 import com.sun.corba.se.impl.orbutil.ORBUtility;
 import com.sun.corba.se.impl.orbutil.StackImpl;
-import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl;
 import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolManagerImpl;
 import com.sun.corba.se.impl.protocol.RequestDispatcherRegistryImpl;
 import com.sun.corba.se.impl.protocol.CorbaInvocationInfo;
@@ -164,7 +135,7 @@
 import com.sun.corba.se.impl.util.Utility;
 import com.sun.corba.se.impl.logging.ORBUtilSystemException;
 import com.sun.corba.se.impl.copyobject.CopierManagerImpl;
-import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl;
+import com.sun.corba.se.impl.ior.IORTypeCheckRegistryImpl;
 
 /**
  * The JavaIDL ORB implementation.
@@ -226,6 +197,8 @@
 
     private ServiceContextRegistry serviceContextRegistry ;
 
+    private IORTypeCheckRegistry iorTypeCheckRegistry;
+
     // Needed here to implement connect/disconnect
     private TOAFactory toaFactory ;
 
@@ -274,6 +247,8 @@
     // insNamingDelegate.
     private final Object resolverLock = new Object() ;
 
+    private static final String IORTYPECHECKREGISTRY_FILTER_PROPNAME = "com.sun.CORBA.ORBIorTypeCheckRegistryFilter";
+
     private TaggedComponentFactoryFinder taggedComponentFactoryFinder ;
 
     private IdentifiableFactoryFinder taggedProfileFactoryFinder ;
@@ -413,6 +388,37 @@
         serviceContextRegistry = new ServiceContextRegistry( this ) ;
     }
 
+    private void initIORTypeCheckRegistry() {
+        String filterProps = AccessController
+                .doPrivileged(new PrivilegedAction<String>() {
+                    public String run() {
+                        String props = System
+                                .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
+                        if (props == null) {
+                            props = Security
+                                    .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
+                        }
+                        return props;
+                    }
+                });
+        if (filterProps != null) {
+            try {
+                iorTypeCheckRegistry = new IORTypeCheckRegistryImpl(filterProps, this);
+            } catch (Exception ex) {
+                throw wrapper.bootstrapException(ex);
+            }
+
+            if (this.orbInitDebugFlag) {
+                dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl created for properties == "
+                        + filterProps);
+            }
+        } else {
+            if (this.orbInitDebugFlag) {
+                dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl NOT created for properties == ");
+            }
+        }
+    }
+
     protected void setDebugFlags( String[] args )
     {
         for (int ctr=0; ctr<args.length; ctr++ ) {
@@ -494,6 +500,8 @@
         getThreadPoolManager();
 
         super.getByteBufferPool();
+
+        initIORTypeCheckRegistry();
     }
 
     private synchronized POAFactory getPOAFactory()
@@ -2089,6 +2097,17 @@
         }
         return copierManager ;
     }
+
+    @Override
+    public void validateIORClass(String iorClassName) {
+        if (iorTypeCheckRegistry != null) {
+            if (!iorTypeCheckRegistry.isValidIORType(iorClassName)) {
+                throw ORBUtilSystemException.get( this,
+                        CORBALogDomains.OA_IOR ).badStringifiedIor();
+            }
+        }
+    }
+
 } // Class ORBImpl
 
 ////////////////////////////////////////////////////////////////////////
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java	Thu Nov 30 02:51:50 2017 +0000
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java	Mon Jan 15 17:24:36 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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,28 +31,16 @@
 
 package com.sun.corba.se.impl.orb;
 
-import java.util.Collection;
 import java.util.Properties;
-import java.util.Hashtable;
 
 import java.applet.Applet;
 
 import java.net.URL;
 
-import java.io.IOException ;
-
-import java.util.logging.Logger ;
-
-import org.omg.CORBA.Context;
-import org.omg.CORBA.ContextList;
-import org.omg.CORBA.Environment;
-import org.omg.CORBA.ExceptionList;
 import org.omg.CORBA.ORBPackage.InvalidName;
 import org.omg.CORBA.NVList;
 import org.omg.CORBA.TCKind;
-import org.omg.CORBA.NamedValue;
 import org.omg.CORBA.NO_IMPLEMENT;
-import org.omg.CORBA.Object;
 import org.omg.CORBA.Request;
 import org.omg.CORBA.TypeCode;
 import org.omg.CORBA.Any;
@@ -63,7 +51,6 @@
 import org.omg.CORBA.PolicyError;
 
 import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.RemarshalException;
 
 import com.sun.corba.se.pept.protocol.ClientInvocationInfo ;
 import com.sun.corba.se.pept.transport.ContactInfo;
@@ -71,15 +58,12 @@
 import com.sun.corba.se.pept.transport.Selector ;
 import com.sun.corba.se.pept.transport.TransportManager;
 
-import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
 import com.sun.corba.se.spi.orb.ORBData;
 import com.sun.corba.se.spi.orb.Operation;
 import com.sun.corba.se.spi.orb.ORB;
 import com.sun.corba.se.spi.orb.ORBVersion;
 import com.sun.corba.se.spi.orb.ORBVersionFactory;
 import com.sun.corba.se.spi.oa.OAInvocationInfo;
-import com.sun.corba.se.spi.oa.ObjectAdapter;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
 import com.sun.corba.se.spi.protocol.ClientDelegateFactory;
 import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
 import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
@@ -92,22 +76,17 @@
 import com.sun.corba.se.spi.ior.ObjectKey;
 import com.sun.corba.se.spi.ior.ObjectKeyFactory;
 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.pept.transport.ByteBufferPool ;
 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
 import com.sun.corba.se.spi.transport.CorbaTransportManager;
 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
 import com.sun.corba.se.spi.orbutil.closure.Closure;
 import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
-import com.sun.corba.se.spi.logging.LogWrapperFactory;
-import com.sun.corba.se.spi.logging.LogWrapperBase;
 import com.sun.corba.se.spi.copyobject.CopierManager;
 import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
 
 import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry;
-import com.sun.corba.se.spi.servicecontext.ServiceContexts;
 
-import com.sun.corba.se.impl.corba.TypeCodeFactory;
 import com.sun.corba.se.impl.corba.TypeCodeImpl;
 import com.sun.corba.se.impl.corba.NVListImpl;
 import com.sun.corba.se.impl.corba.NamedValueImpl;
@@ -117,9 +96,6 @@
 import com.sun.corba.se.impl.corba.AnyImpl;
 import com.sun.corba.se.impl.encoding.BufferManagerFactory;
 import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
-import com.sun.corba.se.impl.encoding.MarshalInputStream;
-import com.sun.corba.se.impl.encoding.EncapsOutputStream;
-import com.sun.corba.se.impl.encoding.MarshalOutputStream;
 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
 import com.sun.corba.se.impl.orbutil.ORBConstants;
 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
@@ -768,6 +744,12 @@
     public CopierManager getCopierManager() {
         return null ;
     }
+
+    @Override
+    public void validateIORClass(String iorClassName) {
+        getFullORB().validateIORClass(iorClassName);
+    }
+
 }
 
 // End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/corba/se/spi/ior/IORTypeCheckRegistry.java	Mon Jan 15 17:24:36 2018 +0000
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017, 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.spi.ior;
+
+public interface IORTypeCheckRegistry {
+    public boolean isValidIORType(String iorClassName);
+}
+
--- a/src/share/classes/com/sun/corba/se/spi/orb/ORB.java	Thu Nov 30 02:51:50 2017 +0000
+++ b/src/share/classes/com/sun/corba/se/spi/orb/ORB.java	Mon Jan 15 17:24:36 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, 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,16 +42,13 @@
 import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
 import com.sun.corba.se.spi.protocol.ClientDelegateFactory ;
 import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator ;
 import com.sun.corba.se.spi.protocol.PIHandler ;
 import com.sun.corba.se.spi.resolver.LocalResolver ;
 import com.sun.corba.se.spi.resolver.Resolver ;
 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
-import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
 import com.sun.corba.se.spi.monitoring.MonitoringConstants;
 import com.sun.corba.se.spi.monitoring.MonitoringManager;
-import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
 import com.sun.corba.se.spi.monitoring.MonitoringFactories;
 
 import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
@@ -60,8 +57,6 @@
 import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
 import com.sun.corba.se.spi.ior.IOR ;
 
-import com.sun.corba.se.spi.orbutil.closure.Closure ;
-
 import com.sun.corba.se.spi.orb.Operation ;
 import com.sun.corba.se.spi.orb.ORBData ;
 import com.sun.corba.se.spi.orb.ORBVersion ;
@@ -135,6 +130,7 @@
     public boolean shutdownDebugFlag = false;
     public boolean giopDebugFlag = false;
     public boolean invocationTimingDebugFlag = false ;
+    public boolean orbInitDebugFlag = false;
 
     // SystemException log wrappers.  Protected so that they can be used in
     // subclasses.
@@ -565,6 +561,23 @@
 
     public abstract CopierManager getCopierManager() ;
 
+    /*
+     * This method is called to verify that a stringified IOR passed to
+     * an org.omg.CORBA.ORB::string_to_object method contains a valid and acceptable IOR type.
+     * If an ORB is configured with IOR type checking enabled,
+     * the ORB executes a IOR type registry lookup to
+     * validate that the class name extract from a type id in
+     * a stringified IOR is a known and accepted type.
+     * A CORBA {@code org.omg.CORBA.DATA_CONVERSION} exception will be thrown should the type check fail.
+     *
+     * @param iorClassName
+     *        a string representing the class name corresponding to the type id of an IOR
+     * @throws org.omg.CORBA.DATA_CONVERSION
+     *           exception with an indication that it is a "Bad stringified IOR", which is thrown
+     *           when the type check fails.
+     */
+    public abstract void validateIORClass(String iorClassName);
+
 }
 
 // End of file.