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

AIOOBE from RuleBasedBreakIterator.lookupState for some suppl. chars

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b61
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0_01"
      Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
      Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)

      (but this problem also exists in 1.5, 1.6, etc)

      ADDITIONAL OS VERSION INFORMATION :
      Linux beast 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      BreakIterator has problems with some supplementary character sequences. When iterating text that contains these characters, it throws an internal ArrayIndexOutOfBoundsException in RuleBasedBreakIterator.lookupState

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the included test program

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      it should not throw an exception, instead next() should return next text boundary or BreakIterator.DONE
      ACTUAL -
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 268
      at java.text.RuleBasedBreakIterator.lookupState(RuleBasedBreakIterator.java:1036)
      at java.text.RuleBasedBreakIterator.handleNext(RuleBasedBreakIterator.java:931)
      at java.text.RuleBasedBreakIterator.next(RuleBasedBreakIterator.java:621)
      at test.main(test.java:8)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.BreakIterator;
      import java.util.Locale;

      public class test {
        public static void main(String args[]) {
          BreakIterator bi = BreakIterator.getSentenceInstance(Locale.US);
          bi.setText("\udb40\udc53"); // U+E0053, TAG LATIN CAPITAL LETTER S
          bi.next();
        }
      }

      ---------- END SOURCE ----------

        Activity

        Hide
        peytoia Yuka Kamiya added a comment -
        BT2:EVALUATION

        AIOOBE should not be thrown.
        This bug needs to be fixed in JDK 8.
        Show
        peytoia Yuka Kamiya added a comment - BT2:EVALUATION AIOOBE should not be thrown. This bug needs to be fixed in JDK 8.
        Hide
        peytoia Yuka Kamiya added a comment - - edited
        SupplementaryCharacterData.getValue(int codepoint) returns (int)0xFF for codepoints w/ a specific category. It is not same as (byte)0xFF(=-1) which is defined as RuleBasedBreakIterator.IGNORE.

        Changed the return value of getValue() to return IGNORE if the gotten value is 0xFF.

        Show
        peytoia Yuka Kamiya added a comment - - edited SupplementaryCharacterData.getValue(int codepoint) returns (int)0xFF for codepoints w/ a specific category. It is not same as (byte)0xFF(=-1) which is defined as RuleBasedBreakIterator.IGNORE. Changed the return value of getValue() to return IGNORE if the gotten value is 0xFF.
        Hide
        hgupdate HG Updates added a comment -
        URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/4744dc70e5d1
        User: peytoia
        Date: 2012-10-03 06:13:55 +0000
        Show
        hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/4744dc70e5d1 User: peytoia Date: 2012-10-03 06:13:55 +0000
        Hide
        hgupdate HG Updates added a comment -
        URL: http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/4744dc70e5d1
        User: lana
        Date: 2012-10-12 18:08:25 +0000
        Show
        hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/4744dc70e5d1 User: lana Date: 2012-10-12 18:08:25 +0000

          People

          • Assignee:
            peytoia Yuka Kamiya
            Reporter:
            webbuggrp Webbug Group
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Imported:
              Indexed: