[omniORB] bug report: transfer of unions with empty default valut

Poilpret Jean Francois jfpoilpret@hn.vnn.vn
Thu, 15 Jun 2000 19:52:26 +0700


Just another precision, the "default" discriminator I speak about is not the
"default" label in the definition of the union, but matches the case where
there is no label at all (ie, for which there is no associated member).

    Jean-Francois

-----Original Message-----
From: Poilpret Jean Francois <jfpoilpret@hn.vnn.vn>
To: Ruslan@Shevchenko.Kiev.UA <Ruslan@Shevchenko.Kiev.UA>;
omniorb-list@uk.research.att.com <omniorb-list@uk.research.att.com>
Date: jeudi 15 juin 2000 19:34
Subject: Re: [omniORB] bug report: transfer of unions with empty default
valut


>Hi Ruslan,
>
>I think that you should add the following line:
>
>    retval->_default();
>
>before retval->_d(1);
>
>because, according to the IDL -> C++ mapping, for unions for which you want
>the 'default' discriminator applied, you have to call that method first
>(AFAIK, unions are never automatically initialized when constructed, so that
>you have to specify their contents, be it the default).
>I think this should work fine after this.
>
>Hope this helps,
>
>    Jean-Francois
>
>-----Original Message-----
>From: Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>
>To: omniorb-list@uk.research.att.com <omniorb-list@uk.research.att.com>
>Date: jeudi 15 juin 2000 18:13
>Subject: [omniORB] bug report: transfer of unions with empty default valut
>
>
>>omniORB can't marshall/demarshall unions with empty
>>default values, i. e:
>>
>>let we have next IDL:
>>
>
>>
>>enum EX {
>>  TX,
>>  TY
>>};
>>
>>union UY switch(EX) {
>>    case TX: long vx;
>>    case TY: string vy;
>>};
>>
>>
>>union V switch(boolean)
>>{
>>  case FALSE: UY y;
>>};
>>
>>interface Bug1 {
>>  V getV();
>>};
>>
>>
>>and next Bug1 implementation:
>>
>>
>>class Bug1_i : public POA_Bug1,
>>               public PortableServer::RefCountServantBase
>>{
>>public:
>>  inline Bug1_i() {}
>>  virtual ~Bug1_i() {}
>>  virtual V* getV();
>>};
>>
>>V* Bug1_i::getV()
>>{
>>  V_var retval = new V;
>>#ifndef NO_BUG
>>  retval->_d(1);
>>#else
>>  UY y;
>>  y.vx(1);
>>  retval->y(y);
>>#endif
>>  return retval._retn();
>>}
>>
>>
>>In case, when NO_BUG is not defined, we receive
>>Marshall exception in client during reciving of V
>>
>>satory$./eg2_clt `cat x` -ORBtraceLevel 11
>>omniORB: gateKeeper is tcpwrapGK 1.0 - based on tcp_wrappers_7.6
>>omniORB configuration file: /etc/omniORB.cfg either does not exist or is
>>not a file.
>>omniORB: The omniDynamic library is not linked.
>>omniORB: Creating ref to remote: root<0>
>> target id      : IDL:omg.org/CORBA/Object:1.0
>> most derived id: IDL:Bug1:1.0
>>omniORB: LocateRequest to remote: root<0>
>>omniORB: throw MARSHAL from nbufferedStream.cc:319
>>omniORB: tcpSocketStrand::~Strand() close socket no. 3
>>Caught a CORBA::SystemException.
>>
>>Archive with complete programs (based on echo), reproducing this bug is
>>attached.
>>
>>
>>
>>
>>
>>
>>
>>
>>if we create empty v, we can't send it via CDR.
>>
>>[demime 0.97b removed an attachment of type application/x-gzip which had a
>name of bug1.tar.gz]