hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Haibo Chen (JIRA)" <j...@apache.org>
Subject [jira] [Assigned] (YARN-6252) Suspicious code fragments: comparing with itself
Date Tue, 28 Feb 2017 22:50:45 GMT

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

Haibo Chen reassigned YARN-6252:
--------------------------------

    Assignee: Haibo Chen

> 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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org


Mime
View raw message