Bug 4154 - Boolean value packaged in the value field of a CosNotification::StructuredEvent filterable_data element is not extracted correctly
Summary: Boolean value packaged in the value field of a CosNotification::StructuredEve...
Status: ASSIGNED
Alias: None
Product: TAO
Classification: Unclassified
Component: Notification Service (show other bugs)
Version: 2.2.0
Hardware: x86 Linux
: P3 major
Assignee: DOC Center Support List (internal)
URL:
Depends on:
Blocks:
 
Reported: 2014-02-20 08:52 CST by Markus Manck
Modified: 2014-05-13 08:19 CDT (History)
1 user (show)

See Also:


Attachments
Unit test for reproducing the bug above (218.52 KB, application/octet-stream)
2014-02-20 08:52 CST, Markus Manck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Manck 2014-02-20 08:52:48 CST
Created attachment 1487 [details]
Unit test for reproducing the bug above

A boolean value is pushed on EventChannel via push_structured_event.
Consumers receive this value using push_structured_event callback.
Filtering is used.

The value extracted by consumers is always 0 even if a true value was packaged.
This can be reproduced by packaging and extraction of a boolean value in a CosNotification::StructuredEvent locally without actually sending the event like this:

  CosNotification::StructuredEvent event;
  CORBA::Boolean bExtract=false;
  CORBA::Any aBool;
  bool value=true;
  // header handling skipped
  aBool<<=CORBA::Any::from_boolean(value);
  event.filterable_data.length (1);
  event.filterable_data[0].name = CORBA::string_dup("anyname");
  event.filterable_data[0].value <<= aBool;
  // reextract bool value
  event.filterable_data[0].value>>=CORBA::Any::to_boolean(bExtract);

The above code is the basis for the attached unit test which is an alteration of the ACE_wrappers/TAO/orbsvcs/tests/Notify/Basic/Events test.
The content was placed in the directory ACE_wrappers/TAO/orbsvcs/tests/Notify.

The test packages and extracts a false and a true boolean value and checks if it is extracted as expected, which fails for the true value.

The used linux is a CentOs 6.2 with an ACE 6.2 as basis.

The bug was also reported on the tao-users@list.isis.vanderbilt.edu mailing list.
The original report form is included below.

Thanks in advance for your efforts
  Markus


    ACE VERSION: 6.1.1

    HOST MACHINE and OPERATING SYSTEM:
        Intel i5 with CentOS 6.2

    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
    COMPILER NAME AND VERSION (AND PATCHLEVEL):

    THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
    specific file, simply state which one]:
        config-linux.h

    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
    use a link to a platform-specific file, simply state which one
    (unless this isn't used in this case, e.g., with Microsoft Visual
    C++)]:
        platform_linux.GNU
    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
    (used by MPC when you generate your own makefiles):
        not used

    AREA/CLASS/EXAMPLE AFFECTED:
        EventChannel usage

    DOES THE PROBLEM AFFECT:
        EXECUTION of application is affected

    SYNOPSIS:
        A boolean value is pushed on EventChannel via push_structured_event.
        Client received value using push_structured_event callback.
        The boolan value is extracted as CORBA::Boolean and as int.
        The CORBA::Boolean is always false, while the int is as set.
    DESCRIPTION:
        I push a boolean value on the server side as follows(skipping channel creation):
        
            CosNotification::StructuredEvent    event;

            // set header
            // header domain
            event.header.fixed_header.event_type.domain_name = CORBA::string_dup(
                    domainName.c_str());

            /// header type name
            event.header.fixed_header.event_type.type_name = CORBA::string_dup(
                    headerName.c_str());
            event.header.variable_header.length(0);

            // header event name
            event.header.fixed_header.event_name = CORBA::string_dup(
                    eventName.c_str() );

            // filterable data event name
            event.filterable_data.length(1);
            event.filterable_data[0].name    = CORBA::string_dup(
                    eventName.c_str() );

            // filterable data event value
            CORBA::Boolean b_bool;
            b_bool=CORBA::Boolean(value);
            event.filterable_data[0].value <<= b_bool;
            m_channelConsumerProxy->push_structured_event(event);
            
        The client receives the value as follows(again skipping channel creation and subscription):
            void EventConsumer::push_structured_event(const CosNotification::StructuredEvent &notification)
            {
                bool value=false;
                CORBA::Boolean boolValue=false;
                int boolInt=0;
                notification.filterable_data[0].value>>=CORBA::Any::to_boolean(boolValue);
                notification.filterable_data[0].value>>=boolInt;
                notification.filterable_data[0].value>>=CORBA::Any::to_boolean(value);

                cout << "Extracted Boolean " << boolValue << endl;
                cout << "Extracted int " << boolInt << endl;

                cout << "EventConsumer::push_structured_event received with domain \"" << myEventDomain << "\", type \"" << myEventType
                        << "\", value \"" << value << "\"" << endl;

                cout << "EventConsumer::push_structured_event end" << endl;

            }        
        
        As a result the boolInt value correctly represents the sent boolean while boolValue and value variables are always false.
        This comes quite unexpected.
    REPEAT BY:

    SAMPLE FIX/WORKAROUND:
        Not available