You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2014/06/29 21:46:45 UTC
svn commit: r1606590 - in /commons/proper/configuration/trunk/src:
main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java
test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
Author: oheger
Date: Sun Jun 29 19:46:44 2014
New Revision: 1606590
URL: http://svn.apache.org/r1606590
Log:
FileBasedBuilderParametersImpl now throws IAE for null input.
This is compliant to the rest of the library.
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java?rev=1606590&r1=1606589&r2=1606590&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java Sun Jun 29 19:46:44 2014
@@ -98,7 +98,7 @@ public class FileBasedBuilderParametersI
*
* @param params the map with parameters (must not be <b>null</b>
* @return the instance obtained from the map or <b>null</b>
- * @throws NullPointerException if the map is <b>null</b>
+ * @throws IllegalArgumentException if the map is <b>null</b>
*/
public static FileBasedBuilderParametersImpl fromParameters(
Map<String, Object> params)
@@ -117,11 +117,17 @@ public class FileBasedBuilderParametersI
* the map; if <b>true</b>, a new instance with default settings is
* created; if <b>false</b>, <b>null</b> is returned
* @return the instance obtained from the map or <b>null</b>
- * @throws NullPointerException if the map is <b>null</b>
+ * @throws IllegalArgumentException if the map is <b>null</b>
*/
public static FileBasedBuilderParametersImpl fromParameters(
Map<String, Object> params, boolean createIfMissing)
{
+ if (params == null)
+ {
+ throw new IllegalArgumentException(
+ "Parameters map must not be null!");
+ }
+
FileBasedBuilderParametersImpl instance =
(FileBasedBuilderParametersImpl) params.get(PARAM_KEY);
if (instance == null && createIfMissing)
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java?rev=1606590&r1=1606589&r2=1606590&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java Sun Jun 29 19:46:44 2014
@@ -262,6 +262,15 @@ public class TestFileBasedBuilderParamet
}
/**
+ * Tries to obtain an instance from a null parameters map.
+ */
+ @Test(expected = IllegalArgumentException.class)
+ public void testFromParametersNull()
+ {
+ FileBasedBuilderParametersImpl.fromParameters(null);
+ }
+
+ /**
* Tests whether reflection-based property access through BeanUtils is
* possible.
*/