You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Rafael H. Schloming (JIRA)" <qp...@incubator.apache.org> on 2007/10/15 15:05:50 UTC

[jira] Commented: (QPID-640) The C++ struct encode/decode always includes nested structs even when they're empty, and (I believe) transforms empty strings to null

    [ https://issues.apache.org/jira/browse/QPID-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534844 ] 

Rafael H. Schloming commented on QPID-640:
------------------------------------------

A good example to think of here is the content-length field. A content-length of zero is not the same thing as no content-length at all.

> The C++ struct encode/decode always includes nested structs even when they're empty, and (I believe) transforms empty strings to null
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-640
>                 URL: https://issues.apache.org/jira/browse/QPID-640
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Broker
>            Reporter: Rafael H. Schloming
>
> The code that detectes whether or not a struct field is present does so by checking the size or value of the field. This results in some odd behavior. 
>  - nested structs will always be included on the wire even when empty because the size is computed to always include the packing flags
>  - empy strings can never be encoded onto the wire
>  - zero values will be omitted
> As the specification doesn't state that empty values are equivalent to absent ones, this behavior is probably unsafe since to clients that treat null separately from empty ("" or 0), the broker would appear to be transforming the specified field value.
> As a general rule I'd suggest that when the client presents us fields encoded in a certain way we should probably leave the encoding of those fields alone unless we're modifying the semantic value somehow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.