Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1121

FastDateFormat.parse() does not handle wrong length string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 3.3.2
    • None
    • lang.time.*
    • None

    Description

      FDFP does not handled wrong length string.

      for example,

      // Wed Apr 29 00:00:00 KST 2015
      FastDateFormat.getInstance("yyyyMMdd").parse("20150429");
      // throws ParseException
      FastDateFormat.getInstance("yyyyMMdd").parse("2015");
      // Thu Mar 16 00:00:00 KST 81724
      FastDateFormat.getInstance("yyyyMMdd").parse("20150429113100");
      

      I think result of third throws ParseException,
      but FastDateFormat.parse() returns wrong year, ex, 81724 instead of 2015.

      As I tested,
      regex.matcher.group => (2015)(04)(29113100) => setCalendar => March 16, 81724

      Attachments

        Activity

          People

            chonton Charles Honton
            freeism Henry Kang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: