Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4989

Run time exception when using TCompactProtocol

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.13.0
    • 0.14.0
    • Swift - Compiler
    • None

    Description

      When serialising a struct using the TCompactProtocol we have discovered a run-time error on line https://github.com/apache/thrift/blob/08a6eb6e1f21aa15682e414e124d7ee1a51a39c7/lib/swift/Sources/TCompactProtocol.swift#L474

      The Swift implementation of TCompactProtocol assumes that the properties of autogenerated classes for Thrift Structs will be ordered by field key, but the current behaviour of the generator preserves the order from the original thrift definitions  These are not required to be ordered by field key.

      Either the Swift lib needs to check for out-of-order properties, or the generator should order properties.  Since the generator is only executed once and the Swift lib runs every time a message is serialised, I think it makes more sense to make this change in the generator.

       I've made the necessary change, and will soon open a PR.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davidfurey David Furey
            davidfurey David Furey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m

                Issue deployment