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

Character encoder IBM970 throws a BufferOverflowException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 6
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      XP SP2 and Windows Vista

      A DESCRIPTION OF THE PROBLEM :
      Character encoder IBM970 throws a BufferOverflowException.

      ACTUAL -
      Throws a BufferOverflowException.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.nio.BufferOverflowException
              at java.nio.charset.CoderResult.throwException(CoderResult.java:259)
              at java.lang.StringCoding$StringEncoder.encode(StringCoding.java:242)
              at java.lang.StringCoding.encode(StringCoding.java:272)
              at java.lang.String.getBytes(String.java:947)
              at EncErr1.main(EncErr1.java:11).

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;
      import java.nio.charset.*;
      import java.util.*;
      public class EncErr1 {
          public static void main(String[] args){
              for (int c = Character.MIN_VALUE; c <= Character.MAX_VALUE; c++){
                  if (!Character.isDefined((char)c)) continue;
                  String s = String.valueOf((char)c);
                  byte[] bb = null;
                  try {
                      bb = s.getBytes("x-IBM970");
                  } catch (InternalError tr){
                      continue;
                  } catch (UnsupportedEncodingException th){
                  }
              }
          }
      }
      ---------- END SOURCE ----------

            sherman Xueming Shen
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: