Return-Path: X-Original-To: apmail-crunch-dev-archive@www.apache.org Delivered-To: apmail-crunch-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DF685175B1 for ; Tue, 19 May 2015 21:54:53 +0000 (UTC) Received: (qmail 18033 invoked by uid 500); 19 May 2015 21:54:53 -0000 Delivered-To: apmail-crunch-dev-archive@crunch.apache.org Received: (qmail 17987 invoked by uid 500); 19 May 2015 21:54:53 -0000 Mailing-List: contact dev-help@crunch.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@crunch.apache.org Delivered-To: mailing list dev@crunch.apache.org Received: (qmail 17976 invoked by uid 99); 19 May 2015 21:54:53 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 May 2015 21:54:53 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 0BED11A302C for ; Tue, 19 May 2015 21:54:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.999 X-Spam-Level: ** X-Spam-Status: No, score=2.999 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id UsXGHIBNRw57 for ; Tue, 19 May 2015 21:54:46 +0000 (UTC) Received: from mail-qg0-f51.google.com (mail-qg0-f51.google.com [209.85.192.51]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 3276123151 for ; Tue, 19 May 2015 21:54:46 +0000 (UTC) Received: by qgew3 with SMTP id w3so14961699qge.2 for ; Tue, 19 May 2015 14:54:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=BhgVVeUAsMvhz2nzyCLkX5Moxci7HAJR0pKBSu2Ykk8=; b=MP4ZRzng4Z3ysyzjoeCVByS4gVY5yHwXP5A2yqfteeN6+KPagL/3Bo6Erl2WvOwgmA 1xDGbMoZm0Xm83UlqZ1e5LWBvfR95Ueg6a6pq/mCR/9U0su02eZGu2m95EOofnQkBxdg 42T5LNQTMNFgZlqXwjPsAf1sH3tIdq/BRdi2McBalUwP3kfQSgcVs5iTchn5JplxhZGI D1eXblSZekHKKfGAWyeala593O7FcBzQouKg+3ZMU407KLW3Yb9K4ZXWoSfJmYGzK/UE f2KmSFThzKVZ+2A3DWqt6fx1OyfAtVCnRr4wyXdbwPMGsT0iWr7ePau1cKBPfo0+r7ei YLZQ== X-Gm-Message-State: ALoCoQnMBtrkerQv84GY2Ly8xbfgF15R2v50KTsAkSZ610m7uNRDGb7EVrJRYFUhWPOELpf77V6G X-Received: by 10.140.151.15 with SMTP id 15mr39347802qhx.104.1432072485184; Tue, 19 May 2015 14:54:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.96.21.199 with HTTP; Tue, 19 May 2015 14:54:24 -0700 (PDT) From: Sean Owen Date: Tue, 19 May 2015 22:54:24 +0100 Message-ID: Subject: Another Coverity scan? To: dev@crunch.apache.org Content-Type: multipart/alternative; boundary=001a113746ccc5c2060516765b1d --001a113746ccc5c2060516765b1d Content-Type: text/plain; charset=UTF-8 Hi all, I'd like to run by you all a little bit of analysis I did a while ago on Crunch (https://issues.apache.org/jira/browse/CRUNCH-380) and wanted to try again. I've been experimenting again with static analysis, in particular Coverity, and gave it another pass over the Crunch code. It turned up a few minor potential issues, and a number of reasonable touch-ups, so I wanted to propose another omnibus change to zap several of them. You can see the current state at https://scan.coverity.com/projects/1983?tab=overview but it does require login. As a preview, the minor touch-ups are: - Replace use of old junit.framework.* with org.unit.* for consistency - Remove some unused imports - String.getBytes() -> String.getBytes(Charset) to avoid platform dependence - Remove a few dead stores - Replace one Map.keySet() + many get()s with Map.entrySet() iteration - Remove a few @Nullable on method args that can't be (immediately dereferenced) - Closing some objects in a finally block that are Closable - Math.abs is technically a bad idea for something that can == Integer.MIN_VALUE There are a few changes that might be minor bug fixes: Aggregators:1059 "maxInputLength > 0 && next.length() > maxInputLength" also needs a check for next != null, but doesn't the second clause also need parentheses? TupleWritable:337 The call to skip() doesn't check that the expected number of bytes were skipped. OrcWritable Missing hashCode for equals WritableGroupedTableType:97 options is checked for null but is always dereferenced at the end CrunchOutputs:201 baseContext can't be null at this point because of line 192 SparkRuntime:342 Not a bug but redundant I think since this occurs inside a block also guarded by "if (t instance MapReduceTarget) {" Does some of this sound worth a look at a patch? I've actually got it ready and can make a JIRA. --001a113746ccc5c2060516765b1d--