This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
org/omg/PortableServer/Servant.java
- From: Andrew Haley <aph at gcc dot gnu dot org>
- To: Andrew Haley <aph at gcc dot gnu dot org>
- Cc: classpath at gnu dot org, java-patches at gcc dot gnu dot org
- Date: Wed, 11 Apr 2007 18:08:12 +0100
- Subject: org/omg/PortableServer/Servant.java
- References: <1175899892.12305.55.camel@dijkstra.wildebeest.org> <1175982587.4504.37.camel@dijkstra.wildebeest.org> <1176029634.3239.0.camel@localhost.localdomain> <1176066768.4504.29.camel@dijkstra.wildebeest.org> <d58509a80704081441p7f0c6b0aqfbb14812b613cdf6@mail.gmail.com> <d58509a80704081500v23bb6688y23636b33b5d34b92@mail.gmail.com> <17945.26666.93912.441902@zebedee.pink> <d58509a80704081747r6a60fc13r37078db8710a2fca@mail.gmail.com> <d58509a80704081823j303aa772jf06b24b3382d7c38@mail.gmail.com> <17947.49382.769461.8563@zebedee.pink> <17947.52236.138258.124908@zebedee.pink>
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 <aph@redhat.com>
* 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;
}