From ad41e7a1c9fe7c05c6ecc571cc15cbf9176780cc Mon Sep 17 00:00:00 2001 From: Uma Maheswara Rao G Date: Fri, 24 Jan 2014 06:28:50 +0000 Subject: [PATCH] Merge HADOOP-10248. Property name should be included in the exception where property value is null. Contributed by Akira AJISAKA. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1560907 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/conf/Configuration.java | 2 +- .../test/java/org/apache/hadoop/conf/TestConfiguration.java | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index cf5d8a782f3..b3e96b9d9de 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -260,6 +260,9 @@ Release 2.3.0 - UNRELEASED HADOOP-10132. RPC#stopProxy() should log the class of proxy when IllegalArgumentException is encountered (Ted yu via umamahesh) + HADOOP-10248. Property name should be included in the exception where property value + is null (Akira AJISAKA via umamahesh) + OPTIMIZATIONS HADOOP-10142. Avoid groups lookup for unprivileged users such as "dr.who" diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java index 627b2ea6b48..ddee96671a9 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java @@ -957,7 +957,7 @@ public class Configuration implements Iterable>, "Property name must not be null"); Preconditions.checkArgument( value != null, - "Property value must not be null"); + "The value of property " + name + " must not be null"); DeprecationContext deprecations = deprecationContext.get(); if (deprecations.getDeprecatedKeyMap().isEmpty()) { getProps(); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java index bbdcea49a1d..079c1718ca5 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java @@ -1162,6 +1162,8 @@ public class TestConfiguration extends TestCase { fail("Should throw an IllegalArgumentException exception "); } catch (Exception e) { assertTrue(e instanceof IllegalArgumentException); + assertEquals(e.getMessage(), + "The value of property testClassName must not be null"); } } @@ -1172,6 +1174,7 @@ public class TestConfiguration extends TestCase { fail("Should throw an IllegalArgumentException exception "); } catch (Exception e) { assertTrue(e instanceof IllegalArgumentException); + assertEquals(e.getMessage(), "Property name must not be null"); } }