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

firstSentence() method of JavaDoc cannot parse Japanese sentences.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.6
    • tools



      Name: paC48320 Date: 02/20/98


      firstSentence() method of JavaDoc cannot parse Japanese sentences.
      In JDK1.1.x,
      sun.tools.javadoc.DocumentationGenerator#firstSentence(String)
      uses no i18n coding.
      Full stop characters are hard-coded.
      So javadoc cannot get a fisrt sentence
      from Japanese sentences correctly.

      Javadoc should use java.text.BreakIterator#getSentence().
      But BreakIterator of JDK1.1.6G can iterate sentences correctly.
      I send a bug report about this BreakIterator today.
      When BreakIterator is modified as the bug report,
      you can use BreakIterator safely.

      I recommend BreakIterator will be modified,
      and Javadoc will use new BreakIterator.
      And I also hope this bug is applied to JDK1.2 Javadoc.
      (In JDK1.2beta3_G,
       sun.tools.javadoc.doclets.HtmlDocWriter#firstSentence(String))

      But if BreakIterator is not modified,
      you can use a workaround as following code.
      But it is only considered of English and Japanese.
      So you should not use this workaround.

      for (int i = 0 ; i < len ; i++) {
      switch (s.charAt(i)) {
      case '\u3002': // PUNCTUATION IDEOGRAPHIC FULL STOP
      return s.substring(0, i + 1);
      case '.':
      case '\uff0e': // FULLWIDTH FULL STOP
      period = true;
      break;
      case '@':
      return s.substring(0, i);
      case ' ':
      case '\t':
      case '\n':
      if (period) {
      return s.substring(0, i);
      }
      break;
      default:
      period = false;
      }
      }
      (Review ID: 25410)
      ======================================================================

            rfield Robert Field (Inactive)
            pallenba Peter Allenbach (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: