Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5629#discussion_r172105998
  
    --- Diff: flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java ---
    @@ -496,18 +496,20 @@ static ContainerLaunchContext 
createTaskExecutorContext(
                        // NOTE: must read the tokens from the local file, not 
from the UGI context, because if UGI is login
                        // using Kerberos keytabs, there is no HDFS delegation 
token in the UGI context.
                        String fileLocation = 
System.getenv(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION);
    -                   Method readTokenStorageFileMethod = 
Credentials.class.getMethod(
    -                           "readTokenStorageFile", File.class, 
org.apache.hadoop.conf.Configuration.class);
    -
    -                   Credentials cred =
    -                           (Credentials) readTokenStorageFileMethod.invoke(
    -                                   null,
    -                                   new File(fileLocation),
    -                                   
HadoopUtils.getHadoopConfiguration(flinkConfig));
    -
    -                   cred.writeTokenStorageToStream(dob);
    -                   ByteBuffer securityTokens = 
ByteBuffer.wrap(dob.getData(), 0, dob.getLength());
    -                   ctx.setTokens(securityTokens);
    +                   if (fileLocation != null) {
    +                           Method readTokenStorageFileMethod = 
Credentials.class.getMethod(
    +                                   "readTokenStorageFile", File.class, 
org.apache.hadoop.conf.Configuration.class);
    +
    +                           Credentials cred =
    +                                   (Credentials) 
readTokenStorageFileMethod.invoke(
    +                                           null,
    +                                           new File(fileLocation),
    --- End diff --
    
    this will now throw an NPE instead.


---

Reply via email to