Hi all,

I have started experimenting with Thrift. After running the provided
tutorial in Java I decided to extend it with my own datatype.

struct Session {
  1: bool isSessionAlive,
  2: string sessionID,
  3: optional string creatingIP,
  4: optional bool btest,
}

However, I am observing strange behaviour of the booleans. The server
creates a session object and fills all 4 fields, setting both the mandatory
and the optional bool to true.
When it is sent to the client I read out the values, and at that point the
mandatory bool "isSessionAlive" is true, but the optional bool "btest"
evaluates to FALSE.
If I change the definition file and take away the optional flag, making
"btest" mandatory, it evaluates to true as expected. The rest of the code
remains unchanged.

It seems as if I can not get optional booleans to evaluate to true after
sending an object. Is this a functionality which I don't understand or a
bug?
I have not tried in other languages so far, only in Java.

Kind regards,
Patrick

Reply via email to