You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Bryan Duxbury (JIRA)" <ji...@apache.org> on 2009/02/07 04:04:59 UTC

[jira] Created: (THRIFT-319) Generated structs should check that lists, sets, and maps are of the proper type

Generated structs should check that lists, sets, and maps are of the proper type
--------------------------------------------------------------------------------

                 Key: THRIFT-319
                 URL: https://issues.apache.org/jira/browse/THRIFT-319
             Project: Thrift
          Issue Type: Improvement
            Reporter: Bryan Duxbury


Some languages' generated structs don't check that a collection's element types are of the expected types. This could lead to trying to read the wrong types from the wire after only checking that you read the right kind of collection header, which would be disastrous.

In the case of finding the right collection type but the wrong element type, we can either throw an exception of just silently skip the collection. I'm not sure off hand which approach would be superior. 

One additional caveat: we should only check the element type after we've checked the collection size. If it's 0-length, then it doesn't matter what the types are. (This is an optimization the compact protocol in THRIFT-110 requires.) 

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