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

(fmt) Minor updates to existing spec/implementation of format feature

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs
    • Fix Understood
    • generic
    • generic, solaris_8

      The following changes to the spec (and possibly implementation) need to be made
      to the format feature:

      Formatter.java:
      - The specifications for 'h' and 's' should mention what happends if the
        argument is not a primitive type (to match similar references elsewhere).
      - Precision for 'a' is supported. Need to define what happens if precision is
        '0' and how precision applies to rounding. "1.0p1024" will be returned for
        values which produce infinity when rounding is applied.
      - We do not explicitly state that the "0x" will always be present for %a.
      - We do not explicitly state that '^' is not supported for %f.
      - 'E' should not be used for date/time formats (currently used for milliseconds
        since the beginning of the epoch). An alternate letter which does not
        conflict with any existing definitions in POSIX strftime or GNU date needs to
        be used instead.
      - The use of Calendar.setLenient(true) and the conversion of Date and long into
        Calendar objects needs to be considered. We need to document what TimeZone
        information will be used since it does not exist for Date and long (the VM's
        default is used).
      - We need to determine whether %c should apply to byte and short. Currently
        we convert the byte or short into a code point. Perhaps we should force the
        user to do the explicit cast. Minimally, we need to explicitly state that
        byte and shorts will be converted to code points.
      - Rephrase
          These characters are a subset of those defined by GNU date and POSIX
          strftime(3c).
        so that it is clear that these specifications are not dependencies.
      - Additional constructors Formatter(File) and Formatter(File, csn) are needed.
      - format(String, Object ...) is missing @return

      Formattable.java:
      - The wording for the @throws clause for IllegalFormatException needs to be
        adjusted to exclude exceptions which do not pertain to the arguments passed
        (e.g. those for arguments).
      - It would be nice if the flags weren't defined within this file. They
        polute the name space of anything which extends Formattable.

      Formatter.java, PrintWriter.java, PrintStream.java:
      - @throws FileNotFoundException: The wording for this exception should be more
        consistent with the changes applied for 4722178.

      -- iag@sfbay 2003-12-08

            Unassigned Unassigned
            iris Iris Clark
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: