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

ParseException thrown for certain months with russian locale

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b05
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        A DESCRIPTION OF THE PROBLEM :
        Possible JAVA 8 bug while parsing dates using pattern with dot after short month (like dd MMM.yyyy) for several months (not all of them) in russian locale.



        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Date should be parsed
        ACTUAL -
            Exception in thread "main" java.text.ParseException: Unparseable date: "28 дек.2018"
             at java.text.DateFormat.parse(DateFormat.java:366)
             at Main.main(Main.java:12)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)


        ---------- BEGIN SOURCE ----------
        import java.text.ParseException;
        import java.text.SimpleDateFormat;
        import java.util.Locale;

        public class Main {

            public static void main(String[] args) throws ParseException {

                Locale locale = new Locale("ru");

                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM.yyyy", locale);
                Object date = simpleDateFormat.parse("28 дек.2018");
                System.out.println(date);
            }
        }

        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: