Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why we can't provide a null parameter to method in CORBA?

5 views
Skip to first unread message

billd...@gmail.com

unread,
Jul 3, 2007, 5:21:02 AM7/3/07
to
If I have a method like this in my idl defined interface:
string echoString(in string mesg);

And if I call this method with a null parameter, ORB will fail in
serializing this parameter and report a org.omg.CORBA.BAD_PARAM.

But why CORBA has such a limitation? What's the history?
And how can I avoid this? Always check the parameter before CORBA
method invoke?

BTW:
My environment is JDK1.5 and the ORB is inline JAVA IDL.
The same thing happens in ORBACUS 4.3.

Yakov Gerlovin

unread,
Jul 3, 2007, 10:54:02 AM7/3/07
to
CORBA allows you to pass an empty string.

Passing 'null' means you don't want to send data. If you don't want to
pass data, there is no reason to specify parameters.
What you actually want is 2 functions:
string echoString(in string mesg);
and another
void echoString();
Unfortunately, CORBA does not allow overloading (to allow mappings to
programming languages with this limitation)

Further, since the string is passed by value (deep copied) you can not
pass 'null'.

billd...@gmail.com

unread,
Jul 4, 2007, 12:31:32 AM7/4/07
to
Thanks Yakov!

But I still think it's a little strange. Actually, when doing remote
data transfering, it's possible to mark a null value. In my memory,
this limitation does not exist in RMI.

Yakov Gerlovin

unread,
Jul 4, 2007, 3:32:34 AM7/4/07
to
RMI is (Java) language specific while CORBA is not limited to specific
language, nor platform. In order to simplify mapping to as wide range
of languages as possible CORBA adopted some limitations, for example,
CORBA does not allow overloading (like C). Some languages does not
have pointers, that is probably the reason why passing 'null' is not
allowed.

Piet van Oostrum

unread,
Jul 7, 2007, 5:14:14 PM7/7/07
to
>>>>> billd...@gmail.com (b) wrote:

>b> Thanks Yakov!
>b> But I still think it's a little strange. Actually, when doing remote
>b> data transfering, it's possible to mark a null value. In my memory,
>b> this limitation does not exist in RMI.

In Corba you can use a valuetype (if the implementation you are using
supports them). A valuetype can accept null values.
--
Piet van Oostrum <pi...@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: pi...@vanoostrum.org

0 new messages