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

some newly added locale cannot parse uppercased date string.

XMLWordPrintable

    • b08
    • generic
    • generic
    • Not verified

      A DESCRIPTION OF THE PROBLEM :
      Hi.
      In your latest jdk15 versions, we found something not quite right.
      a related pr is at https://github.com/apache/commons-lang/pull/558
      In short, some codes like this cannot pass tests for some Locale like "ff_LR_#Adlm"
       
      BUT in jdk 8-14's all locales can pass the tests, only ones newlly added in jdk15 fails.
      I wanna know whether it be by design or just a bug.

      REGRESSION : Last worked in version 14.0.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the tests below with Junit.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      tests pass
      ACTUAL -
      tests failed

      ---------- BEGIN SOURCE ----------
          @Test
          public void java15BuggyLocaleTestAll() throws ParseException {
              for (final Locale locale : Locale.getAvailableLocales()) {
                  testSingleLocale(locale);
              }
          }

          @Test
          public void java15BuggyLocaleTest() throws ParseException {
              final String buggyLocaleName = "ff_LR_#Adlm";
              Locale buggyLocale = null;
              for (final Locale locale : Locale.getAvailableLocales()) {
                  if (buggyLocaleName.equals(locale.toString())) {
                      buggyLocale = locale;
                      break;
                  }
              }
              if (buggyLocale == null) {
                  return;
              }
              testSingleLocale(buggyLocale);
          }

          private void testSingleLocale(Locale locale) throws ParseException {
              final Calendar cal = Calendar.getInstance(GMT);
              cal.clear();
              cal.set(2003, Calendar.FEBRUARY, 10);
              final SimpleDateFormat sdf = new SimpleDateFormat(LONG_FORMAT, locale);
              final String formattedDate = sdf.format(cal.getTime());
              sdf.parse(formattedDate);
              sdf.parse(formattedDate.toUpperCase(locale));
              sdf.parse(formattedDate.toLowerCase(locale));
          }
      ---------- END SOURCE ----------

      FREQUENCY : always


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

              Created:
              Updated:
              Resolved: