[ 
https://issues.apache.org/jira/browse/HADOOP-13140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15287297#comment-15287297
 ] 

Colin Patrick McCabe commented on HADOOP-13140:
-----------------------------------------------

{code}
  /** Called after a new FileSystem instance is constructed.
   * @param name a uri whose authority section names the host, port, etc.
   *   for this FileSystem
   * @param conf the configuration
   */
  public void initialize(URI name, Configuration conf) throws IOException {
    statistics = getStatistics(name.getScheme(), getClass());    
    resolveSymlinks = conf.getBoolean(
        CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_KEY,
        CommonConfigurationKeys.FS_CLIENT_RESOLVE_REMOTE_SYMLINKS_DEFAULT);
  }
{code}

If {{name#getScheme()}} is empty or null here, we can use 
{{FileSystem#getDefaultUri#getScheme}} to pass a non-null scheme.  That should 
cover almost all the cases where a null scheme would be passed.

If the user intentionally passes a null or empty scheme directly to 
{{FileSystem#getStatistics}}, we should throw an exception.

> GlobalStorageStatistics should check null FileSystem scheme to avoid NPE
> ------------------------------------------------------------------------
>
>                 Key: HADOOP-13140
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13140
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 2.8.0
>            Reporter: Brahma Reddy Battula
>            Assignee: Mingliang Liu
>         Attachments: HADOOP-13140.000.patch
>
>
> {{org.apache.hadoop.fs.GlobalStorageStatistics#put}} is not checking the null 
> scheme, and the internal map will complain NPE. This was reported by a flaky 
> test {{TestFileSystemApplicationHistoryStore}}. Thanks [~brahmareddy] for 
> reporting.
> To address this,
> # Fix the test by providing a valid URI, e.g. {{file:///}}
> # Guard the null scheme in {{GlobalStorageStatistics#put}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to