Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1572

Truncates text numbers. Should be Unparse Error

XMLWordPrintableJSON

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.0.0
    • 1.1.0
    • Back End
    • None

      Test test_double_text2 cannot round trip.

      This test is a fixed length text double number.

      The data is ".555" the logical double value is 0.555.

      This unparses as 0.55 (that's 4 characters). This should be failing, not truncating this.

      The test still shouldn't round trip, it should parse fine. An unparse test that tries to unparse 0.555 to an element of fixed length 4 should be getting an unparse error, but doesn't. Instead right now it happily truncates to 0.55, then when it re-parses that, we get logical value 0.55, which fails comparison with expected 0.555.

      I traced this down to DataOutputStream.putCharBuffer, which given a char buffer of 5 chars happily writes out only 4 of them, thereby truncating the text. putCharBuffer calls putBitBuffer, but disregards the return value, checking only that it is > 0, but not considering that the number of bits written might be non-zero, but not all the characters.

              slawrence Steve Lawrence
              mbeckerle.dfdl Mike Beckerle
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: