You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "AppChecker (JIRA)" <ji...@apache.org> on 2017/02/28 22:15:46 UTC

[jira] [Created] (YARN-6252) Suspicious code fragments: comparing with itself

AppChecker created YARN-6252:
--------------------------------

             Summary: 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


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