--- mx4j-3.0.1/src/core/mx4j/remote/resolver/iiop/Resolver.java 2005-03-01 11:14:14.000000000 +0100 +++ mx4j-3.0.1/src/core/mx4j/remote/resolver/iiop/Resolver.java-gil 2009-03-17 00:52:47.000000000 +0100 @@ -32,6 +32,7 @@ private static final String IOR_CONTEXT = "/ior/"; private ORB orb; + private static final String ORB_KEY = "java.naming.corba.orb"; //********************************************************************************************************************// @@ -110,19 +111,29 @@ { if (orb == null) { - Properties props = new Properties(); - // Using putAll() on a Properties is discouraged, since it expects only Strings - for (Iterator i = environment.entrySet().iterator(); i.hasNext();) - { - Map.Entry entry = (Map.Entry)i.next(); - Object key = entry.getKey(); - Object value = entry.getValue(); - if (key instanceof String && value instanceof String) - { - props.setProperty((String)key, (String)value); + Object candidateORB = environment.get(ORB_KEY); + if (candidateORB != null) + { + // Throw as required by the spec + if (!(candidateORB instanceof ORB)) throw new IllegalArgumentException("Property " + ORB_KEY + " must specify a " + ORB.class.getName() + ", not " + candidateORB.getClass().getName()); + orb = (ORB)candidateORB; + } + else + { + Properties props = new Properties(); + // Using putAll() on a Properties is discouraged, since it expects only Strings + for (Iterator i = environment.entrySet().iterator(); i.hasNext();) + { + Map.Entry entry = (Map.Entry)i.next(); + Object key = entry.getKey(); + Object value = entry.getValue(); + if (key instanceof String && value instanceof String) + { + props.setProperty((String)key, (String)value); + } } - } - orb = ORB.init((String[])null, props); + orb = ORB.init((String[])null, props); + } } return orb; }