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

Akira Ajisaka commented on HADOOP-14339:
----------------------------------------

Thank [~cheersyang] for providing the patches.
{code}
    if (curLocalFiles != null) {
      HashSet<File> lf = new HashSet<File>(curLocalFiles.length);
      for (int j = 0; j < curLocalFiles.length; ++j) {
        lf.add(curLocalFiles[j]);
      }
      localizedFiles = Collections.unmodifiableSet(lf);
    }
{code}
If curLocalFiles is null, localizedFiles is not initialized, and then, 
{{relocalize()}} method calls {{!localizedFiles.contains(curLocalFiles\[j\])}} 
and it causes NPE. What do you think?
{code}
      for (int j = 0; j < curLocalFiles.length; ++j) {
        lf.add(curLocalFiles[j]);
      }
{code}
{{Collections.addAll(lf, curLocalFiles)}} can be used instead.

> Fix warnings from Spotbugs in hadoop-mapreduce
> ----------------------------------------------
>
>                 Key: HADOOP-14339
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14339
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Weiwei Yang
>            Assignee: Weiwei Yang
>         Attachments: HADOOP-14339.001.patch, HADOOP-14339.002.patch, 
> HADOOP-14339.003.patch
>
>
> Fix warnings from Spotbugs in hadoop-mapreduce since switched from findbugs 
> to spotbugs.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to