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

API: SimpleDateFormat: unspecified behavior for reserved pattern letter

XMLWordPrintable

    • Fix Understood
    • generic
    • generic



      Name: smR10189 Date: 06/09/2004



      The JDK 1.5 spec. doesn't specify behavior if reserved letters are
      used as pattern letters.

      It only says:
      " Within date and time pattern strings, unquoted letters from 'A' to 'Z'
      and from 'a' to 'z' are interpreted as pattern letters representing the
      components of a date or time string. Text can be quoted using single quotes
      (') to avoid interpretation. "''" represents a single quote. All other
      characters are not interpreted; they're simply copied into the output string
      during formatting or matched against the input string during parsing.

      The following pattern letters are defined (all other characters from 'A' to 'Z'
      and from 'a' to 'z' are reserved)"

      The spec. doesn't say that using reserved letters is illegal.
      In other words, "reserved" letter doesn't mean "illegal" letter.
      So an implementation behavior is undefined because it
      can handle reserved letters in the following ways:
        - simply copying them into the output string
        - ignoring them

      JDK 1.5.0 implementation rejects patters with reserved letters
      with IllegalArgumentException.

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

            naoto Naoto Sato
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: