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

sentence BreakIterator stops too soon (more)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.1.6, 1.2.0
    • core-libs
    • None
    • 1.2fcs
    • generic, sparc
    • solaris_2.6
    • Not verified

      javadoc now uses a sentence BreakIterator to find the end of
      the first sentence to use for the summary. Some common
      constructs cause it to break too soon. For example:

      CASE #1 --------------------------------------------------
      import java.text.BreakIterator;

      public class SentenceBug {
          public static void main(String[] argv) {
              BreakIterator bi = BreakIterator.getSentenceInstance();
              String test = "Test <code>Flags.Flag</code> class. Another test.";
              bi.setText(test);
              System.out.println(test.substring(bi.first(), bi.next()));
              System.exit(0);
          }
      }

      This prints "Test <code>Flags."
      A period followed by a capital letter should not be a sentence boundary;
      there should be whitespace between them.

      CASE #2 --------------------------------------------------
      import java.text.BreakIterator;

      public class SentenceBug2 {
          public static void main(String[] argv) {
              BreakIterator bi = BreakIterator.getSentenceInstance();
              String test = "<P>Provides a set of &quot;lightweight&quot; (all-Java<FONT SIZE=\"-2\"><SUP>TM</SUP></FONT> language) components that, to the maximum degree possible, work the same on all platforms. Another test.";
              bi.setText(test);
              System.out.println(test.substring(bi.first(), bi.next()));
              System.exit(0);
          }
      }

      This prints:

         <P>Provides a set of &quot;lightweight&quot; (all-Java<FONT SIZE="-2"

      Notice that it stops between the double quote (") and greater-than symbol (>).
      There is no period, exclamation mark or question mark anywhere near.
                        
      ----
      For sample files, see /java/web/docs/bugs/javadoc-bugs/bug4158381-breakiterator
      doug.kramer@Eng 1998-09-17

            rgillamsunw Richard Gillam (Inactive)
            bshannon Bill Shannon (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: