TextMeasurer/deleteChar function fails when deleting more than one characters.

XMLWordPrintable

    • Type: CSR
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Component/s: client-libs
    • None
    • 2d
    • behavioral
    • minimal
    • The change in this CSR updates specification to explicitly mention the outcome of executing the concerned methods with an invalid argument.
    • Java API
    • SE

      Summary

      Make the exceptional behavior of java.awt.font.TextMeasurer and java.awt.font.LineBreakMeasurer more explicitly specified for exception conditions on text insertion and deletion.

      Problem

      . The specification for the methods - insertChar and deleteChar of classes <br>      . java.awt.font.TextMeasurer and <br>      . java.awt.font.LineBreakMeasurer <br> mention that the methods are to be used to insert or delete a single character from the respective objects. <br> . However, the specification does not mention the outcome when a programmer attempts to insert or delete multiple characters from these objects. <br>

      Solution

      . Update the specification to explicitly mention the outcome - IllegalArgumentException, when programmer attempts to insert or delete multiple characters from TextMeasurer and LineBreakMeasurer Objects.

      Specification

      File: TextMeasurer.java Method: insertChar <br>

       /** <br>   * Updates the {@code TextMeasurer} after a single character has<br>   * been inserted<br>   * into the paragraph currently represented by this<br>   * {@code TextMeasurer}.<br>   ...<br> ++ * @throws IllegalArgumentException if multiple characters are inserted<br> ++ * in the text represented by {@code newParagraph}<br>    ...<br>   */<br>

      File TextMeasurer.java Method: deleteChar <br>  /** <br>   * Updates the {@code TextMeasurer} after a single character has <br>   * been deleted<br>   * from the paragraph currently represented by this<br>   * {@code TextMeasurer}.<br>   ...<br> ++ * @throws IllegalArgumentException if multiple characters are deleted from<br> ++ * the text represented by {@code newParagraph}<br>   ...<br>   */<br>

      File: LineBreakMeasurer.java Method: insertChar <br>   /** <br>    * Updates this {@code LineBreakMeasurer} after a single <br>    * character is inserted into the text, and sets the current <br>    * position to the beginning of the paragraph.<br>    ...<br> ++ * @throws IllegalArgumentException if multiple characters are inserted<br> ++ * in the text represented by {@code newParagraph}<br>    ...<br>    */<br>

      File: LineBreakMeasurer.java Method: deleteChar <br>   /** <br>    * Updates this {@code LineBreakMeasurer} after a single<br>    * character is deleted from the text, and sets the current<br>    * position to the beginning of the paragraph.<br>    ...<br> ++ * @throws IllegalArgumentException if multiple characters are deleted from<br> ++ * the text represented by {@code newParagraph}<br>    ...<br>    */ <br>

            Assignee:
            Unassigned
            Reporter:
            Jane Wang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: