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/trunk@1560906 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uma Maheswara Rao G 2014-01-24 06:27:40 +00:00
parent 4c197b5d56
commit 817be26c17
3 changed files with 7 additions and 1 deletions

View File

@ -556,6 +556,9 @@ Release 2.3.0 - UNRELEASED
HADOOP-10132. RPC#stopProxy() should log the class of proxy when IllegalArgumentException HADOOP-10132. RPC#stopProxy() should log the class of proxy when IllegalArgumentException
is encountered (Ted yu via umamahesh) 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 OPTIMIZATIONS
HADOOP-10142. Avoid groups lookup for unprivileged users such as "dr.who" HADOOP-10142. Avoid groups lookup for unprivileged users such as "dr.who"

View File

@ -963,7 +963,7 @@ public void set(String name, String value, String source) {
"Property name must not be null"); "Property name must not be null");
Preconditions.checkArgument( Preconditions.checkArgument(
value != null, value != null,
"Property value must not be null"); "The value of property " + name + " must not be null");
DeprecationContext deprecations = deprecationContext.get(); DeprecationContext deprecations = deprecationContext.get();
if (deprecations.getDeprecatedKeyMap().isEmpty()) { if (deprecations.getDeprecatedKeyMap().isEmpty()) {
getProps(); getProps();

View File

@ -1183,6 +1183,8 @@ public void testSettingValueNull() throws Exception {
fail("Should throw an IllegalArgumentException exception "); fail("Should throw an IllegalArgumentException exception ");
} catch (Exception e) { } catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException); assertTrue(e instanceof IllegalArgumentException);
assertEquals(e.getMessage(),
"The value of property testClassName must not be null");
} }
} }
@ -1193,6 +1195,7 @@ public void testSettingKeyNull() throws Exception {
fail("Should throw an IllegalArgumentException exception "); fail("Should throw an IllegalArgumentException exception ");
} catch (Exception e) { } catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException); assertTrue(e instanceof IllegalArgumentException);
assertEquals(e.getMessage(), "Property name must not be null");
} }
} }