You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/03/02 20:20:56 UTC

[GitHub] [nifi] adenes commented on a change in pull request #4868: NIFI-8285 Prevent HBase client services to throw NPE in non-kerberized environment.

adenes commented on a change in pull request #4868:
URL: https://github.com/apache/nifi/pull/4868#discussion_r585881166



##########
File path: nifi-nar-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/hadoop/SecurityUtil.java
##########
@@ -151,7 +151,19 @@ public static boolean isSecurityEnabled(final Configuration config) {
 
     public static <T> T callWithUgi(UserGroupInformation ugi, PrivilegedExceptionAction<T> action) throws IOException {
         try {
-            return ugi.doAs(action);
+            T result;
+            if (ugi == null) {
+                try {
+                    result = action.run();
+                } catch (RuntimeException re) {
+                    throw re;
+                } catch (Exception e) {

Review comment:
       I think `IOException` should be handled separately, thrown as-is without wrapping it in a `RuntimeException`. Adding `IOException` to the previous `catch` statement would be enough.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org