|
From: Michael R. <mr...@us...> - 2004-07-28 12:07:21
|
Update of /cvsroot/openorb/OpenORB/src/main/org/openorb/orb/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30667/OpenORB/src/main/org/openorb/orb/core Modified Files: ORB.java Log Message: Do not perform a lookup_value_factory for RMI types Index: ORB.java =================================================================== RCS file: /cvsroot/openorb/OpenORB/src/main/org/openorb/orb/core/ORB.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ORB.java 21 Jul 2004 11:24:51 -0000 1.26 +++ ORB.java 28 Jul 2004 12:06:53 -0000 1.27 @@ -490,7 +490,7 @@ if ( null != mapped ) { reference = NamingUtils.resolveObjectFromNamingService( this, mapped, - object_name.equals( NamingUtils.NS_NAME_LONG ), getLogger() ); + object_name.equals( NamingUtils.NS_NAME_LONG ) ); } else { @@ -1265,59 +1265,64 @@ /** * This function is used to find a value factory. * - * @param id - * @return ValueFactory + * @param id The type id of the value type. + * @return ValueFactory The value factory if one was found, or null otherwise. */ public org.omg.CORBA.portable.ValueFactory lookup_value_factory( String id ) { - org.omg.CORBA.portable.ValueFactory ret; - synchronized ( m_sync_state ) + // Looking for a RMI type factory is _very_ unusual + org.omg.CORBA.portable.ValueFactory ret = null; + if ( !id.startsWith( "RMI:" ) ) { - Map factories = ( Map ) getFeature( "ValueFactory" ); - if ( factories != null ) + synchronized ( m_sync_state ) { - ret = ( org.omg.CORBA.portable.ValueFactory ) factories.get( id ); - if ( ret != null ) + Map factories = ( Map ) getFeature( "ValueFactory" ); + if ( factories != null ) { - return ret; + ret = ( org.omg.CORBA.portable.ValueFactory ) factories.get( id ); + if ( ret != null ) + { + return ret; + } } } - } - - // load the default factory if it can be found - String classname; - try - { - classname = RepoIDHelper.idToClass( id, RepoIDHelper.TYPE_DEFAULT_FACTORY ); - } - catch ( final IllegalArgumentException ex ) - { - return null; - } - Class clz = null; - if ( classname != null ) - { + // load the default factory if it can be found + String classname; try { - clz = Thread.currentThread().getContextClassLoader().loadClass( classname ); + classname = RepoIDHelper.idToClass( id, RepoIDHelper.TYPE_DEFAULT_FACTORY ); } - catch ( final Throwable ex ) + catch ( final IllegalArgumentException ex ) { return null; } - } - try - { - return ( org.omg.CORBA.portable.ValueFactory ) clz.newInstance(); - } - catch ( final Exception ex ) - { - final String error = "Default value factory for '" - + classname + "' raised a instantiation error."; - throw new ORBRuntimeException( error, ex ); + Class clz = null; + if ( classname != null ) + { + try + { + clz = Thread.currentThread().getContextClassLoader().loadClass( classname ); + } + catch ( final Throwable ex ) + { + return null; + } + } + + try + { + ret = ( org.omg.CORBA.portable.ValueFactory ) clz.newInstance(); + } + catch ( final Exception ex ) + { + final String error = "Default value factory for '" + + classname + "' raised a instantiation error."; + throw new ORBRuntimeException( error, ex ); + } } + return ret; } /** |