mx4j/src/core/mx4j/remote/resolver/iiop Resolver.java,1.1,1.2

Simone Bordet <[email protected]> Fri, 18 Mar 2005 10:17:10 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/core/mx4j/remote/resolver/iiop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9994/src/core/mx4j/remote/resolver/iiop

Modified Files:
	Resolver.java 
Log Message:
Fixed bug #1164309: use property java.naming.corba.orb to lookup an ORB in the environment map

Index: Resolver.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/remote/resolver/iiop/Resolver.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Resolver.java	16 Feb 2005 15:21:54 -0000	1.1
--- Resolver.java	18 Mar 2005 10:17:08 -0000	1.2
***************
*** 33,36 ****
--- 33,37 ----
  
     private ORB orb;
+    private static final String ORB_KEY = "java.naming.corba.orb";
  
  
***************
*** 111,127 ****
        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);
              }
           }
-          orb = ORB.init((String[])null, props);
        }
        return orb;
--- 112,138 ----
        if (orb == null)
        {
!          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);
           }
        }
        return orb;



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click