From cbd17834c0d3c865310b1785eda4458e97fe7425 Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Wed, 13 Jun 2012 05:34:19 +0000 Subject: [PATCH] HDFS-766. Error message not clear for set space quota out of boundary values. Contributed by Jon Zuanich. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1349640 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java | 7 ++++++- .../hadoop-hdfs/src/test/resources/testHDFSConf.xml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 542b8f87fb1..150c97ecfa5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -210,6 +210,9 @@ Release 2.0.1-alpha - UNRELEASED HDFS-3531. EditLogFileOutputStream#preallocate should check for incomplete writes. (Colin Patrick McCabe via eli) + HDFS-766. Error message not clear for set space quota out of boundary + values. (Jon Zuanich via atm) + BREAKDOWN OF HDFS-3042 SUBTASKS HDFS-2185. HDFS portion of ZK-based FailoverController (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java index c7c206fcb73..211220803eb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java @@ -239,7 +239,12 @@ public class DFSAdmin extends FsShell { CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE); List parameters = c.parse(args, pos); String str = parameters.remove(0).trim(); - quota = StringUtils.TraditionalBinaryPrefix.string2long(str); + try { + quota = StringUtils.TraditionalBinaryPrefix.string2long(str); + } catch (NumberFormatException nfe) { + throw new IllegalArgumentException("\"" + str + "\" is not a valid value for a quota."); + } + this.args = parameters.toArray(new String[parameters.size()]); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml index 8f769cec38f..cdd10bd5857 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testHDFSConf.xml @@ -15470,7 +15470,7 @@ SubstringComparator - For input string: "a5" + setSpaceQuota: "a5" is not a valid value for a quota.