Throwing CORBA exceptions from an IDL-defined interface?
August 23, 2006 5:52 PM   Subscribe

Any CORBA experts here? I have an IDL/exceptions question.

My code is implementing an interface that is defined in IDL. I have two implementations, one in C++ and one in Java, and I want to throw a "CORBA" exception, such as InvalidName, back to a caller. In Java, that exception is known as org.omg.CORBA.ORBPackage.InvalidName. In C++, it goes by CORBA::ORB::InvalidName.

Is there a way in IDL to define an interface capable of throwing this exception, or am I forced to only throw exceptions that I personally define in IDL?
posted by knave to Computers & Internet (7 answers total)
 
This page should help, no?

I hate CORBA.
posted by devilsbrigade at 6:01 PM on August 23, 2006


Response by poster: I'm not sure, it seems like they don't say if it's possible to do what I'm trying to do.

I should clarify, this is a "local" IDL interface, which is implemented by C++ and Java libraries. They are making CORBA requests on behalf of the caller, and the request may result in an InvalidName. My hope is to pass the InvalidName exception back to the user, through my local interface. If this isn't possible, I'll have to create my own exception that basically means the same thing, and throw that instead.
posted by knave at 6:15 PM on August 23, 2006


If you take this, and scroll down to "Raising Exceptions in IDL Operations", it says:

"System exceptions are a set of standard exceptions defined by CORBA. ... Implicitly, all IDL operations can raise any of the CORBA system exceptions. No reference to system exceptions appears in an IDL. specification." [emphasis mine]

So, you don't need to declare that you're throwing InvalidName. It's a freebie. Throw away.
posted by maschnitz at 7:39 PM on August 23, 2006


Or, to flip it another way: you can't declare that you're throwing InvalidName. The specification says you can't. Too bad.

Instead, put the fact that you plan to throw an InvalidName comment in a comment.
posted by maschnitz at 7:41 PM on August 23, 2006


Response by poster: For some reason, if I throw the exception as-is, it gets converted into a CORBA::UNKNOWN before the receiver sees it. And I am unable to put in my code's throw spec that I throw CORBA::ORB::InvalidName, because then my spec looks different than the parent class's spec (compile error).
posted by knave at 7:43 PM on August 23, 2006


You sure the UNKNOWN doesn't contain the original exception in some way?

Yeah, it sounds like one side or the other of your CORBA software is out of spec. Or you've got it configured wrong, somehow. Go on their site(s), raise hell.
posted by maschnitz at 7:50 PM on August 23, 2006


Response by poster: Thanks for the help, maschnitz. I worked around it, my code no longer can throw invalidname. As far as I can tell, the answer is "no, you cannot throw CORBA exceptions across an IDL-defined interface." However, if someone with conclusive evidence to the contrary comes across this thread, feel free to update it for posterity.
posted by knave at 7:12 AM on August 24, 2006


« Older Is the headphone plug on my iPod doomed?   |   Help me nourish my brain. Newer »
This thread is closed to new comments.