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

setMaximumIntegerDigits(int) specs unclear about range of input parameter

XMLWordPrintable

    • sparc
    • solaris_2.5



      Name: mgC56079 Date: 09/02/97



      The java.text.NumberFormat.setMaximumIntegerDigits(int newValue),
          java.text.NumberFormat.setMinimumIntegerDigits(int newValue),
          java.text.NumberFormat.setMaximumFractionDigits(int newValue),
          java.text.NumberFormat.setMinimumFractionDigits(int newValue)

      methods convert input parameter to byte.
      Here is the source of the setMaximumIntegerDigits() method:

          /**
           * Sets the maximum number of digits allowed in the integer portion of a
           * number. maximumIntegerDigits must be >= minimumIntegerDigits. If the
           * new value for maximumIntegerDigits is less than the current value
           * of minimumIntegerDigits, then minimumIntegerDigits will also be set to
           * the new value.

           * @see #getMaximumIntegerDigits
           */
          public void setMaximumIntegerDigits(int newValue) {
              maxIntegerDigits = (byte) Math.max(0,Math.min(newValue,127));
              if (minIntegerDigits > maxIntegerDigits)
                  minIntegerDigits = maxIntegerDigits;
          }

      All specs are silent about this.
         
      ======================================================================


      brian.beck@Eng 1997-10-25

      To put it another way, these methods limit the maxima and minima to the range
      0-127 without documenting it. Is this an intentional limit that should be documented in the spec or is it an artifact of the implementation that should be removed?

      =======================================================================

            bcbeck Brian Beck (Inactive)
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: