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

DateFormat.parse fails for date in dd-MMM-yyyy format

    XMLWordPrintable

Details

    • b05
    • 13
    • generic
    • generic

    Description

      A DESCRIPTION OF THE PROBLEM :
      worked with jdk1.8.0_192, jdk-10.0.2, jdk-13.0.1
      no more works with jdk-13.0.1, jdk-19.0.2
      (see Bug ID: JDK-2013829 and JDK-4028061)

      REGRESSION : Last worked in version 8u361

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      compile and runs source example with different versions

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      e.g. from jdk1.8.0_192
      de_DE sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMo
      de=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]

      Fri Dec 31 00:00:00 CET 1999

      ACTUAL -
      from jdk-19.0.2
      de_DE sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]

      Exception in thread "main" java.text.ParseException: Unparseable date: "1999-Dez-31"
              at java.base/java.text.DateFormat.parse(DateFormat.java:399)
              at DateFormatParseBug.main(DateFormatParseBug.java:10)



      ---------- BEGIN SOURCE ----------
      import java.text.*;
      import java.util.*;

      class DateFormatParseBug
      {
         public static void main( String... args ) throws ParseException
         {
            SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MMM-dd" );
            System.out.println( Locale.getDefault() + " " + sdf.getTimeZone() );
            System.out.println( sdf.parse( "1999-Dez-31" ) );
         // System.out.println( sdf.parse( "1999-Dec-31" ) );
         }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      unknown

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: