Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-3005

[JDK7] Use switch statement for String instead of if-else statement in RegistrySecurity.java

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.7.0
    • Fix Version/s: 2.7.0
    • Component/s: None
    • Labels:
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      Since we have moved to JDK7, we can refactor the below if-else statement for String.

          // TODO JDK7 SWITCH
          if (REGISTRY_CLIENT_AUTH_KERBEROS.equals(auth)) {
            access = AccessPolicy.sasl;
          } else if (REGISTRY_CLIENT_AUTH_DIGEST.equals(auth)) {
            access = AccessPolicy.digest;
          } else if (REGISTRY_CLIENT_AUTH_ANONYMOUS.equals(auth)) {
            access = AccessPolicy.anon;
          } else {
            throw new ServiceStateException(E_UNKNOWN_AUTHENTICATION_MECHANISM
                                            + "\"" + auth + "\"");
          }
      

        Attachments

        1. YARN-3005.001.patch
          1 kB
          Kengo Seki
        2. YARN-3005.002.patch
          1 kB
          Kengo Seki

          Activity

            People

            • Assignee:
              sekikn Kengo Seki
              Reporter:
              ajisakaa Akira Ajisaka
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: