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

AbstractCalendar.getEra compares Era and String

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 10
    • 8, 9
    • 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;
          }

            naoto Naoto Sato
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: