Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

CORBA and java null values

843793Jul 4 2003 — edited Jul 15 2003
Hello everyone!

I am currently developing a corba application and need to send large amount of data between a server and different clients. I use variable length arrays (idl construct sequence) witch contains structs.

Some of these structs contains strings, and I have painfully experienced the problems regarding passing of java null values in strings. Sun`s IDL to Java Language Mapping Overview (http://java.sun.com/j2se/1.3/docs/guide/idl/mapping/jidlMapping.html) states that when "a type that corresponds to a Java object type (a String, for example), it is illegal to pass a Java null as the parameter value."

My question is therefor, why does the idlj compiler generate null values as default for strings in the class representation of structs that contains strings??????

Would it not be better if it generated empty strings ("") as default?

As if that wasnt enough, in a variable length array (sequence), the length of the variable length arrays cant be zero, which doubles my problem. Not only do I have to take care of not sending null-strings in structs, I also have to send a dummy struct (with no null string values) with the array...

What is the best way to handles these issues? Some state that exceptions should handle them, but then I need to handle exceptions everytime I'm sending over an array of length sero (in response to some call from a client).

Asle
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2003
Added on Jul 4 2003
1 comment
431 views