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

ByteToCharISO8859_1.convert() has inconsistent behavior in some similar cases

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 1.4.0
    • core-libs
    • None

      The behavior of ByteToCharISO8859_1.convert(byte[] input, int inOff, int inEnd, char[] output, int outOff, int outEnd) is confusing in following cases.

      For any valid input and output arrays:
      Case 1: inOff=-10, inEnd=5, outOff=55, outEnd=50
        The method throws a sun.io.ConversionBufferFullException.

      Case 2: inOff=-10, inEnd=-15, outOff=55, outEnd=50
        No exception and returns -5.

      The above results are very confusing. The javadoc says that ConversionBufferFullException is being thrown if output array is filled prior to converting all the input. In both of above cases, no characters is filled to the output array. So the output array is never full as long as it's length > 0. So the ConversionBufferFullException is not correct in the first case. In the second case, the return value is -5, which means -5 inputs were converted. This is also confusing because there is really no byte converted.

            ilittlesunw Ian Little (Inactive)
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: