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

JavaScript: Initialization of Base Types with 0 instead of null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.3
    • 0.6
    • JavaScript - Compiler
    • None
    • Patch Available

    Description

      I had a problem with the exception avaliable on the tutorial.
      i32 calculate(1:i32 logid, 2:Work w) throws (1:InvalidOperation ouch),

      It couldn't be thrown because initialization of numeric base types is done with 0 instead of null and the checks do compare against null.
      This was not visible with the Tests provided with first patch for JavaScript bindings above, the ThriftTest.thrift definition does not have a combination of a base type return value and an exception.

      I've made a patch that initializes the base types I16,I32, I64 and DOUBLE with null. This could probably solve other issues as well

      Regards

      Roger

      Attachments

        1. THRIFT-807_initialize_with_null.patch
          0.6 kB
          Roger Meier
        2. THRIFT-807_initialize_with_null.v2.patch
          1 kB
          Roger Meier
        3. THRIFT-807_initialize_with_null.v3.patch
          1 kB
          Roger Meier

        Issue Links

          Activity

            People

              roger Roger Meier
              roger Roger Meier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: