diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java
index b2c29c4627..67a8f82d93 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/StringUtils.java
@@ -202,8 +202,12 @@ public static String uriToString(URI[] uris){
}
/**
- *
* @param str
+ * The string array to be parsed into an URI array.
+ * @return null if str is null, else the URI array
+ * equivalent to str.
+ * @throws IllegalArgumentException
+ * If any string in str violates RFC 2396.
*/
public static URI[] stringToURI(String[] str){
if (str == null)
@@ -213,9 +217,8 @@ public static URI[] stringToURI(String[] str){
try{
uris[i] = new URI(str[i]);
}catch(URISyntaxException ur){
- System.out.println("Exception in specified URI's " + StringUtils.stringifyException(ur));
- //making sure its asssigned to null in case of an error
- uris[i] = null;
+ throw new IllegalArgumentException(
+ "Failed to create uri for " + str[i], ur);
}
}
return uris;
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestStringUtils.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestStringUtils.java
index e0dddb2ce4..fc90984608 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestStringUtils.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestStringUtils.java
@@ -269,6 +269,17 @@ public void testCamelize() {
assertEquals("Yy", StringUtils.camelize("yY"));
assertEquals("Zz", StringUtils.camelize("zZ"));
}
+
+ @Test
+ public void testStringToURI() {
+ String[] str = new String[] { "file://" };
+ try {
+ StringUtils.stringToURI(str);
+ fail("Ignoring URISyntaxException while creating URI from string file://");
+ } catch (IllegalArgumentException iae) {
+ assertEquals("Failed to create uri for file://", iae.getMessage());
+ }
+ }
// Benchmark for StringUtils split
public static void main(String []args) {
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index 8809870f52..db352254f1 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -236,6 +236,9 @@ Branch-2 ( Unreleased changes )
HADOOP-8499. Lower min.user.id to 500 for the tests.
(Colin Patrick McCabe via eli)
+ MAPREDUCE-4395. Possible NPE at ClientDistributedCacheManager
+ #determineTimestamps (Bhallamudi via bobby)
+
Release 2.0.0-alpha - 05-23-2012
INCOMPATIBLE CHANGES