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

AbstractCalendar.getEra compares Era and String

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 10
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b11
    • Verification:
      Verified

      Description

      (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;
          }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: