Skip to content

Commit 92bfea8

Browse files
committed
HADOOP-18074 - fix spotbug for NPE on branch-3.3
1 parent 25abfac commit 92bfea8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,9 @@ List<String> doGetGroups(String user, int goUpHierarchy)
547547
} catch (NamingException e) {
548548
// If the first lookup failed, fall back to the typical scenario.
549549
// In order to force the fallback, we need to reset groups collection.
550-
groups.clear();
550+
if (groups != null) {
551+
groups.clear();
552+
}
551553
LOG.info("Failed to get groups from the first lookup. Initiating " +
552554
"the second LDAP query using the user's DN.", e);
553555
}

0 commit comments

Comments
 (0)