This is a compatibility fix for JacORB. This code assumes that
org.omg.PortableServer.Servant will throw an
org.omg.CORBA.BAD_INV_ORDER exception if _set_delegate hasn't been
called:
try
{
((org.omg.PortableServer.Servant)wrapper)._get_delegate();
}
catch( org.omg.CORBA.BAD_INV_ORDER bio )
{
// only set the delegate if it has not been set already
org.jacorb.orb.ServantDelegate delegate =
new org.jacorb.orb.ServantDelegate( this );
((org.omg.PortableServer.Servant)wrapper)._set_delegate(delegate);
}
So, we have to fix Servant to throw an exception in this case.
Andrew.
2007-04-11 Andrew Haley <[EMAIL PROTECTED]>
* org/omg/PortableServer/Servant.java (_get_delegate): Throw if no
delegate has been set.
Index: Servant.java
===================================================================
--- Servant.java (revision 123473)
+++ Servant.java (working copy)
@@ -39,6 +39,7 @@
package org.omg.PortableServer;
import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.OBJECT_NOT_EXIST;
import org.omg.CORBA.ORB;
@@ -109,6 +110,10 @@
*/
public final Delegate _get_delegate()
{
+ if (delegate == null) {
+ throw new BAD_INV_ORDER
+ ("The Servant has not been associated with an ORBinstance");
+ }
return delegate;
}