Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 92A2E200C29 for ; Tue, 28 Feb 2017 23:50:53 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9144B160B7C; Tue, 28 Feb 2017 22:50:53 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DB9B6160B59 for ; Tue, 28 Feb 2017 23:50:52 +0100 (CET) Received: (qmail 5671 invoked by uid 500); 28 Feb 2017 22:50:52 -0000 Mailing-List: contact yarn-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list yarn-issues@hadoop.apache.org Received: (qmail 5660 invoked by uid 99); 28 Feb 2017 22:50:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Feb 2017 22:50:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 832431804B1 for ; Tue, 28 Feb 2017 22:50:51 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.346 X-Spam-Level: X-Spam-Status: No, score=-2.346 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-2.999, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id NLe6RKGJcVIw for ; Tue, 28 Feb 2017 22:50:50 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 6C42E5F23A for ; Tue, 28 Feb 2017 22:50:50 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 41C50E028F for ; Tue, 28 Feb 2017 22:50:47 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id DBDB52417A for ; Tue, 28 Feb 2017 22:50:45 +0000 (UTC) Date: Tue, 28 Feb 2017 22:50:45 +0000 (UTC) From: "Haibo Chen (JIRA)" To: yarn-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (YARN-6252) Suspicious code fragments: comparing with itself MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 28 Feb 2017 22:50:53 -0000 [ 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