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 2B292200B16 for ; Mon, 20 Jun 2016 23:31:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 29F5F160A55; Mon, 20 Jun 2016 21:31:07 +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 77896160A26 for ; Mon, 20 Jun 2016 23:31:06 +0200 (CEST) Received: (qmail 90890 invoked by uid 500); 20 Jun 2016 21:31:00 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 90881 invoked by uid 99); 20 Jun 2016 21:31:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jun 2016 21:31:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7D31DDFC6F; Mon, 20 Jun 2016 21:31:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cmccabe@apache.org To: common-commits@hadoop.apache.org Message-Id: <26865eaaa587458393b65f8caf5decd0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: HADOOP-13288. Guard null stats key in FileSystemStorageStatistics (Mingliang Liu via Colin P. McCabe) Date: Mon, 20 Jun 2016 21:31:00 +0000 (UTC) archived-at: Mon, 20 Jun 2016 21:31:07 -0000 Repository: hadoop Updated Branches: refs/heads/branch-2.8 c610b6033 -> c5dafb4ad HADOOP-13288. Guard null stats key in FileSystemStorageStatistics (Mingliang Liu via Colin P. McCabe) (cherry picked from commit 8c1f81d4bf424bdc421cf4952b230344e39a7b68) (cherry picked from commit 14df17383c20cebcdb27da1f8bce0b494d47b392) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c5dafb4a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c5dafb4a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c5dafb4a Branch: refs/heads/branch-2.8 Commit: c5dafb4ad7011181f54f53c23bdc14a734538f38 Parents: c610b60 Author: Colin Patrick Mccabe Authored: Mon Jun 20 14:25:07 2016 -0700 Committer: Colin Patrick Mccabe Committed: Mon Jun 20 14:30:51 2016 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/fs/FileSystemStorageStatistics.java | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/c5dafb4a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystemStorageStatistics.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystemStorageStatistics.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystemStorageStatistics.java index 98cb70a..d85cd3f 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystemStorageStatistics.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystemStorageStatistics.java @@ -20,6 +20,7 @@ package org.apache.hadoop.fs; import java.util.Iterator; import java.util.NoSuchElementException; +import com.google.common.base.Preconditions; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.fs.FileSystem.Statistics.StatisticsData; @@ -77,6 +78,9 @@ public class FileSystemStorageStatistics extends StorageStatistics { } private static Long fetch(StatisticsData data, String key) { + Preconditions.checkArgument(key != null, + "The stat key of FileSystemStorageStatistics should not be null!"); + switch (key) { case "bytesRead": return data.getBytesRead(); @@ -95,6 +99,10 @@ public class FileSystemStorageStatistics extends StorageStatistics { FileSystemStorageStatistics(String name, FileSystem.Statistics stats) { super(name); + Preconditions.checkArgument(stats != null, + "FileSystem.Statistics can not be null"); + Preconditions.checkArgument(stats.getData() != null, + "FileSystem.Statistics can not have null data"); this.stats = stats; } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org