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

Li Lu commented on YARN-3276:
-----------------------------

Hi [~djp], a quick question (w.r.t YARN-3087), why this line will cause a NPE?

bq. this.info = (HashMap<String, Object>) info;  // Here we can have NPE if 
info is null

If info is null, we may still cast it to a HashMap, according to Java language 
specification 
(http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.8 in 
Section 5.2, "A value of the null type (the null reference is the only such 
value) may be assigned to any reference type, resulting in a null reference of 
that type."). Am I missing something here?

I agree that we should have this refactor even if our current code does not 
throw NPEs. The new approach looks much nicer. 

> Fix NPE and refactor in some map cast for TimelineEntity
> --------------------------------------------------------
>
>                 Key: YARN-3276
>                 URL: https://issues.apache.org/jira/browse/YARN-3276
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: timelineserver
>            Reporter: Junping Du
>            Assignee: Junping Du
>         Attachments: YARN-3276-v2.patch, YARN-3276.patch
>
>
> Per discussion in YARN-3087, we need to refactor some similar logic to cast 
> map to hashmap and get rid of NPE issue.



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

Reply via email to