This is an automated email from the ASF dual-hosted git repository.

suvasude pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new fef18ec  [GOBBLIN-1454] Fix NPE when trying to fetch delegation tokens 
for multiple remote namenodes
fef18ec is described below

commit fef18ec933426f4a352dc6d4599c6cde5483be0a
Author: dukumar <[email protected]>
AuthorDate: Mon Jun 7 10:01:20 2021 -0700

    [GOBBLIN-1454] Fix NPE when trying to fetch delegation tokens for multiple 
remote namenodes
    
    Closes #3293 from dushyantk1509/GOBBLIN-1454
---
 .../main/java/org/apache/gobblin/util/hadoop/TokenUtils.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java 
b/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java
index 7bb4fee..70aa6e0 100644
--- 
a/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java
+++ 
b/gobblin-utility/src/main/java/org/apache/gobblin/util/hadoop/TokenUtils.java
@@ -424,11 +424,13 @@ public class TokenUtils {
     Path[] ps = new Path[remoteNamenodesList.size()];
     for (int i = 0; i < ps.length; i++) {
       ps[i] = new Path(remoteNamenodesList.get(i).trim());
-      FileSystem otherNameNodeFS = ps[i].getFileSystem(conf);
+    }
 
-      if (StringUtils.isEmpty(renewer)) {
-        TokenCache.obtainTokensForNamenodes(cred, ps, conf);
-      } else {
+    if (StringUtils.isEmpty(renewer)) {
+      TokenCache.obtainTokensForNamenodes(cred, ps, conf);
+    } else {
+      for(Path p: ps) {
+        FileSystem otherNameNodeFS = p.getFileSystem(conf);
         final Token<?>[] tokens = otherNameNodeFS.addDelegationTokens(renewer, 
cred);
         if (tokens != null) {
           for (Token<?> token : tokens) {

Reply via email to