AbstractCalendar.getEra compares Era and String

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 10
    • Affects Version/s: 8, 9
    • Component/s: core-libs
    • None
    • b11
    • Verified

      (as found by errorprone)
      The code below is bogus because eras[i] is an Era while eraName is a String, and so it looks like getEra always returns null, which further suggests this method is never tested.

          public Era getEra(String eraName) {
              if (eras != null) {
                  for (int i = 0; i < eras.length; i++) {
                      if (eras[i].equals(eraName)) {
                          return eras[i];
                      }
                  }
              }
              return null;
          }

            Assignee:
            Naoto Sato
            Reporter:
            Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: