turcsanyip commented on code in PR #7121:
URL: https://github.com/apache/nifi/pull/7121#discussion_r1157608507


##########
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:
   @mark-bathori Thanks for handling this "Controller Service's State is 
currently DISABLED" issue!
   Instead of the generic `Exception`, only 
`ControllerServiceDisabledException` should be caught and handled but it is not 
visible here (and we definitely do not want to add `nifi-framework-core-api`). 
This exception is a child of `IllegalStateException` which could be used in the 
catch block to narrow the scope.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to