mark-bathori commented on code in PR #7121: URL: https://github.com/apache/nifi/pull/7121#discussion_r1158162517
########## nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java: ########## @@ -211,18 +211,22 @@ public String getClassloaderIsolationKey(final PropertyContext context) { return explicitKerberosPrincipal; } - final KerberosCredentialsService credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); - if (credentialsService != null) { - final String credentialsServicePrincipal = credentialsService.getPrincipal(); - if (credentialsServicePrincipal != null) { - return credentialsServicePrincipal; + try { + final KerberosCredentialsService credentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); + if (credentialsService != null) { + final String credentialsServicePrincipal = credentialsService.getPrincipal(); + if (credentialsServicePrincipal != null) { + return credentialsServicePrincipal; + } } - } - final KerberosUserService kerberosUserService = context.getProperty(KERBEROS_USER_SERVICE).asControllerService(KerberosUserService.class); - if (kerberosUserService != null) { - final KerberosUser kerberosUser = kerberosUserService.createKerberosUser(); - return kerberosUser.getPrincipal(); + final KerberosUserService kerberosUserService = context.getProperty(KERBEROS_USER_SERVICE).asControllerService(KerberosUserService.class); + if (kerberosUserService != null) { + final KerberosUser kerberosUser = kerberosUserService.createKerberosUser(); + return kerberosUser.getPrincipal(); + } + } catch (Exception e) { Review Comment: Thanks @turcsanyip for the review. I originally wanted to use `ControllerServiceDisabledException` but faced with the same issue that it is not visible there, that's why I used `Exception` but using `IllegalStateException` is a good idea. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org