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

[BI] BreakIterator.isBoundary(int offset) throws unspecified IllegalArgumentException

XMLWordPrintable

    • b22
    • generic
    • generic
    • Verified

      BreakIterator.isBoundary(int offset) throws IllegalArgumentException in case when
      offset is out of bounds of the text.

      Please find below the sample for the issue:
      ----------------------------------------------------------------
              String text = "hello world";
              int values[] = {-100, -1, text.length() + 1, 100};
              BreakIterator iter = BreakIterator.getWordInstance();
              iter.setText("hello world");

              for (int offset : values) {
                  try {
                      iter.isBoundary(offset);
                      System.out.println("not thrown for offset: " + offset);
                  } catch (IllegalArgumentException ex) {
                  }
              }
      ----------------------------------------------------------------

            okutsu Masayoshi Okutsu
            dmiltsov Dmitry Miltsov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: