Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6798515

3 additional CodingErrorAction

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 7
    • core-libs

      A DESCRIPTION OF THE REQUEST :
      Now we have 3 constants for java.nio.charset.CodingErrorAction:
      IGNORE
      REPLACE
      REPORT
      I propose to have 3 more:
      IGNORE_PROGRESSIVE
      REPLACE_PROGRESSIVE
      REPORT_PROGRESSIVE

      Alternative:
      *_ADVANCING

      Additionally:
      *_CONSERVATIVE or *_PROTECTIVE as redundant copy of the just existing.

      JUSTIFICATION :
      There was a discussion about, which length a malformed coder result should return. See:
      - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6762515
      - http://mail.openjdk.java.net/pipermail/core-libs-dev/2008-September/000695.html

      With the 3 additional CodingErrorAction developer would have both possibilities.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      E.g. in case of byte sequence of length 3 where 3rd byte is corrupted:
         IGNORE --> skip 1 byte in source buffer
         REPLACE --> insert replacement in destination buffer and advance 1 byte in source buffer
         REPORT --> report length 1 by malformed coder result
         IGNORE_PROGRESSIVE --> skip 3 byte in source buffer
         REPLACE_PROGRESSIVE --> insert replacement in destination buffer and advance 3 byte in source buffer
         REPORT_PROGRESSIVE --> report length 3 by malformed coder result

      ... in case of byte sequence which has start byte for 3 bytes where 2nd byte is corrupted:
         normal action: --> treat as malformed sequence of length 1.
         progressive action: --> treat as malformed sequence of length 2.

      ACTUAL -
      Only 1st 3 variants are offered, but not always strict, see 3rd actual result on http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6795537


      ---------- BEGIN SOURCE ----------
      For easy implementation of my proposal, method CharsetDecoder#decodeLoop() should always return the "progressive" values.
      Method CharsetDecoder#decode() should transpose to "conservative" values if requested
      ---------- END SOURCE ----------

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: