[ 
https://issues.apache.org/jira/browse/YARN-6252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Haibo Chen resolved YARN-6252.
------------------------------
    Resolution: Duplicate

> Suspicious code fragments: comparing with itself
> ------------------------------------------------
>
>                 Key: YARN-6252
>                 URL: https://issues.apache.org/jira/browse/YARN-6252
>             Project: Hadoop YARN
>          Issue Type: Bug
>    Affects Versions: 3.0.0-alpha2
>            Reporter: AppChecker
>            Assignee: Haibo Chen
>
> Hi
> 1) 
> https://github.com/apache/hadoop/blob/235203dffda1482fb38762fde544c4dd9c3e1fa8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java#L106
> {code:java}
>       return getId() > getId() ? 1 : getId() < getId() ? -1 : 0;
> {code}
> strangely, than getId() compare with itself
> Probably It should be something like this:
> {code:java}
>       return this.getId() > other.getId() ? 1 : this.getId() < other.getId() 
> ? -1 : 0;
> {code}
> 2) 
> https://github.com/apache/hadoop/blob/235203dffda1482fb38762fde544c4dd9c3e1fa8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/TestAppLogAggregatorImpl.java#L260
> {code:java}
>     if(filesUploaded.size() != filesUploaded.size()) {
>       fail(errMsgPrefix + ": actual size: " + filesUploaded.size() + " vs " +
>           "expected size: " + filesExpected.size());
>     }
> {code}
> filesUploaded.size()  compare with it self
> probably it should be:
> {code:java}
>     if(filesUploaded.size() != filesExpected.size()) {
>       fail(errMsgPrefix + ": actual size: " + filesUploaded.size() + " vs " +
>           "expected size: " + filesExpected.size());
>     }
> {code}
> These possible defects found by [static code analyzer 
> AppChecker|https://cnpo.ru/en/solutions/appchecker.php] 



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

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

Reply via email to