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

java.sql.Date.toString is broken for years < 1000 and years > 9999

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.3.1_04
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      04
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: bsT130419 Date: 10/04/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      java.sql.Date.toString() is broken
      on all platforms & versions of the JRE.

      If the Date falls in a year before 1000
      or after 9999 then it produces an
      incorrectly formatted String representation.
      The specification of the String format
      (and that expected by DB2 JDBC drivers for
      example) is "yyyy-mm-dd". Unfortunately the
      current implementation only works if the
      year is >= 1000 and <= 9999.

      The fix is extremely simple; line 124 of
      java/sql/Date.java needs to pad the string
      with leading zeros.
      (Review ID: 133152)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              jbrucesunw Jonathan Bruce (Inactive)
              Reporter:
              bstrathesunw Bill Strathearn (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: