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

SimpleDateFormat: parser crashes if hh, mm, or ss is zero

XMLWordPrintable

    • x86
    • generic, solaris_9


      takeshi.asano@Japan 1997-04-01

      Parsing string represents time, DateFormat.parse() crashes.
      Actually, SimpleDateFormat seems to crash if hh, mm, or ss
      in the string is zero.

      asano@soda[12178]$ LANG=C java ParseZero < parse_zero.data
      str: 05:55:10 oclock AM PST
      full: 5:55:10 oclock AM PST
      str: 06:10:25 oclock AM PST
      full: 6:10:25 oclock AM PST
      str: 06:51:15 oclock AM PST
      full: 6:51:15 oclock AM PST
      str: 06:58:01 oclock AM PST
      full: 6:58:01 oclock AM PST
      str: 07:58:22 oclock AM PST
      full: 7:58:22 oclock AM PST
      str: 10:41:33 oclock AM PST
      full: 10:41:33 oclock AM PST
      str: 12:00:00 oclock AM PST
      java.lang.NullPointerException
              at java.text.SimpleDateFormat.subParse(Compiled Code)
              at java.text.SimpleDateFormat.parse(Compiled Code)
              at java.text.DateFormat.parse(Compiled Code)
              at ParseZero.main(Compiled Code)

      I attached "parse_zero.java" and "parse_zero.data" for reproduction.

            bcbeck Brian Beck (Inactive)
            taasano Takeshi Asano (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: