djencks     2005/11/08 15:50:14

  Modified:    modules/core/src/java/org/openejb/corba
                        CORBAHandleDelegate.java
  Log:

  GERONIMO-1147 make handle delegate more forgiving
  
  Revision  Changes    Path
  1.3       +28 -4     
openejb/modules/core/src/java/org/openejb/corba/CORBAHandleDelegate.java
  
  Index: CORBAHandleDelegate.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/corba/CORBAHandleDelegate.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CORBAHandleDelegate.java  4 Mar 2005 21:16:32 -0000       1.2
  +++ CORBAHandleDelegate.java  8 Nov 2005 20:50:14 -0000       1.3
  @@ -50,21 +50,45 @@
   import javax.ejb.EJBHome;
   import javax.ejb.EJBObject;
   import javax.ejb.spi.HandleDelegate;
  +import javax.rmi.PortableRemoteObject;
   
   import org.apache.geronimo.naming.reference.SimpleReference;
   
   
   /**
  + * See ejb spec 2.1, 19.5.5.1
  + *
    * @version $Revision$ $Date$
    */
   public class CORBAHandleDelegate implements HandleDelegate {
  +
  +    /**
  +     * Called by home handles to deserialize stubs in any app server, 
including ones by other vendors.
  +     * The spec seems to imply that a simple cast of in.readObject() should 
work but in certain
  +     * orbs this does not seem to work and in.readObject returns a generic 
remote stub that needs
  +     * to be narrowed.  Although we think this is likely an orb bug this 
code with narrow will
  +     * work in both circumstances.
  +     * @param in
  +     * @return
  +     * @throws ClassNotFoundException
  +     * @throws IOException
  +     */
       public EJBHome readEJBHome(ObjectInputStream in) throws 
ClassNotFoundException, IOException {
  -        EJBHome home = (EJBHome) in.readObject();
  +        Object o = in.readObject();
  +        EJBHome home = (EJBHome) PortableRemoteObject.narrow(o, 
EJBHome.class);
           return home;
       }
   
  +    /**
  +     * Called by handles to deserialize stubs in any app server.  See 
comment to readEJBHome.
  +     * @param in
  +     * @return
  +     * @throws ClassNotFoundException
  +     * @throws IOException
  +     */
       public EJBObject readEJBObject(ObjectInputStream in) throws 
ClassNotFoundException, IOException {
  -        EJBObject object = (EJBObject) in.readObject();
  +        Object o = in.readObject();
  +        EJBObject object = (EJBObject) PortableRemoteObject.narrow(o, 
EJBObject.class);
           return object;
       }
   
  
  
  

Reply via email to