[omniORB] FW: May not return NULL???

Carlos carlos at canama.net
Wed Nov 26 13:24:40 GMT 2003


Pánczél Levente wrote:
> Hello!
> 
> I have a function in an interface wich simply reads the name of an object instance:
> string GetName();
> which generates the C++ code
> char *GetName();
> My problem is that the name of an object is allowed to be _anything_ but the object might be in a state where Name is not initialised yet. To indicate this internally the server uses NULL pointers, so I'd really like this function to be lagally able to return NULL.
> I do understand that this would be a problem, when I'm interfacing other languages, where there is no such external string value like a NULL pointer. Though it would be acceptable for me if in case of returning a NULL omniORB sent an exception making the client aware of the non-marshalable value. Now the case is that when omniORB is beginning to marshal the value it generates a segfault, causing not only the ORB subsystem of the server but the whole server to crash.
> Please note that the last thing I would like to change is the IDL.

No a string f() doesn't return NULL, you must return an empty string or 
throw and exception like NullValue, but you must indicate it in idl:

exception NullValue;
string GetName() raises (NullValue);

I think this is correct.

Carlos.

> Thanks in advance.
> Panczel, Levente
> 
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
> 
> 






More information about the omniORB-list mailing list