Harmony
  1. Harmony
  2. HARMONY-6594

[classlib][nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0M14
    • Fix Version/s: 5.0M15
    • Component/s: Classlib
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      Java 5 spec says the fulsh() will throw IllegalStateException If the previous step of the current encoding operation was an invocation neither of the reset method nor of the three-argument encode method with a value of true for the endOfInput parameter.
      Our harmony one doesn't follow this behavior and won't throw Exception.

      1. HARMONY-6594_v2.diff
        6 kB
        deven you
      2. HARMONY-6594.diff
        3 kB
        deven you

        Issue Links

          Activity

          deven you created issue -
          deven you made changes -
          Field Original Value New Value
          Attachment HARMONY-6594.diff [ 12450016 ]
          deven you made changes -
          Link This issue blocks HARMONY-6590 [ HARMONY-6590 ]
          deven you made changes -
          Summary [classlib][luni] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior [classlib][nio_cahr] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior
          deven you made changes -
          Attachment HARMONY-6594_v2.diff [ 12450263 ]
          Hide
          deven you added a comment -

          I have put the updated version HARMONY-6594_v2.diff, it can fix our flush() behavior so that our flush() will completely follows RI5's behavior. The basic concept of this fix is that dividing the INIT state into 2 states INIT and READY, the former indicates the encoder just is initiated and won't accept the flush() operation, the latter indicates the encoder is ready to accept the flush() operation, and following RI5's behavior set the state as INIT after calling the constructor and reset() methods. This simple concept will comply with RI5 and won't cause it complex to understand.
          Anyone want to test this fix? Thanks a lot!

          Show
          deven you added a comment - I have put the updated version HARMONY-6594 _v2.diff, it can fix our flush() behavior so that our flush() will completely follows RI5's behavior. The basic concept of this fix is that dividing the INIT state into 2 states INIT and READY, the former indicates the encoder just is initiated and won't accept the flush() operation, the latter indicates the encoder is ready to accept the flush() operation, and following RI5's behavior set the state as INIT after calling the constructor and reset() methods. This simple concept will comply with RI5 and won't cause it complex to understand. Anyone want to test this fix? Thanks a lot!
          Tim Ellison made changes -
          Assignee Tim Ellison [ tellison ]
          Hide
          Tim Ellison added a comment -

          Thanks Deven.

          I agree with v2 as a good patch, and I applied it to the NIO_CHAR module at repo revision r967069 (with minor style changes).

          Please verify it was applied as you expected.

          Show
          Tim Ellison added a comment - Thanks Deven. I agree with v2 as a good patch, and I applied it to the NIO_CHAR module at repo revision r967069 (with minor style changes). Please verify it was applied as you expected.
          Tim Ellison made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 5.0M15 [ 12315054 ]
          Resolution Fixed [ 1 ]
          Tim Ellison made changes -
          Summary [classlib][nio_cahr] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior [classlib][nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior
          Hide
          Hudson added a comment -

          Integrated in Harmony-1.5-head-linux-x86_64 #901 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/901/)
          Apply patch for HARMONY-6594 ([classlib][nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior)

          Show
          Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #901 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/901/ ) Apply patch for HARMONY-6594 ( [classlib] [nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior)
          Hide
          Hudson added a comment -

          Integrated in Harmony-select-1.5-head-linux-x86_64 #71 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/71/)
          Apply patch for HARMONY-6594 ([classlib][nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior)

          Show
          Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #71 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/71/ ) Apply patch for HARMONY-6594 ( [classlib] [nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior)
          Hide
          Tim Ellison added a comment -

          My commit caused test failures in LUNI, so reverting the patch at r979613 and re-opening the issue.

          Show
          Tim Ellison added a comment - My commit caused test failures in LUNI, so reverting the patch at r979613 and re-opening the issue.
          Tim Ellison made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Hudson added a comment -

          Integrated in Harmony-1.5-head-linux-x86_64 #906 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/906/)
          Revert r967069
          "Apply patch for HARMONY-6594 ([classlib][nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior)"
          Causes test failures in LUNI module.

          Show
          Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #906 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/906/ ) Revert r967069 "Apply patch for HARMONY-6594 ( [classlib] [nio_char] CharsetEncoder.flush(Bytebuffer) doesn't follow the spec and RI's behavior)" Causes test failures in LUNI module.
          Hide
          Tim Ellison added a comment -

          The patch was re-applied at r979647 in conjunction with the fix for HARMONY-6590 (which was causing the test failures).

          Show
          Tim Ellison added a comment - The patch was re-applied at r979647 in conjunction with the fix for HARMONY-6590 (which was causing the test failures).
          Tim Ellison made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Hide
          Hudson added a comment -

          Integrated in Harmony-select-1.5-head-linux-x86_64 #75 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/75/)

          Show
          Hudson added a comment - Integrated in Harmony-select-1.5-head-linux-x86_64 #75 (See http://hudson.zones.apache.org/hudson/job/Harmony-select-1.5-head-linux-x86_64/75/ )
          Hide
          Hudson added a comment -

          Integrated in Harmony-1.5-head-linux-x86_64 #909 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/909/)

          Show
          Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #909 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/909/ )
          Gavin made changes -
          Link This issue blocks HARMONY-6590 [ HARMONY-6590 ]
          Gavin made changes -
          Link This issue is depended upon by HARMONY-6590 [ HARMONY-6590 ]

            People

            • Assignee:
              Tim Ellison
              Reporter:
              deven you
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 96h
                96h
                Remaining:
                Remaining Estimate - 96h
                96h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development