You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cm...@apache.org on 2016/06/20 21:30:01 UTC
hadoop git commit: HADOOP-13288. Guard null stats key in
FileSystemStorageStatistics (Mingliang Liu via Colin P. McCabe)
Repository: hadoop
Updated Branches:
refs/heads/trunk aa1b583cf -> 8c1f81d4b
HADOOP-13288. Guard null stats key in FileSystemStorageStatistics (Mingliang Liu via Colin P. McCabe)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8c1f81d4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8c1f81d4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8c1f81d4
Branch: refs/heads/trunk
Commit: 8c1f81d4bf424bdc421cf4952b230344e39a7b68
Parents: aa1b583
Author: Colin Patrick Mccabe <cm...@cloudera.com>
Authored: Mon Jun 20 14:25:07 2016 -0700
Committer: Colin Patrick Mccabe <cm...@cloudera.com>
Committed: Mon Jun 20 14:25:07 2016 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/fs/FileSystemStorageStatistics.java | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c1f81d4/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 f179cce..7c08863 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;
@@ -81,6 +82,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();
@@ -107,6 +111,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