hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umamah...@apache.org
Subject svn commit: r1594150 - in /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java
Date Tue, 13 May 2014 07:34:33 GMT
Author: umamahesh
Date: Tue May 13 07:34:32 2014
New Revision: 1594150

URL: http://svn.apache.org/r1594150
Log:
HDFS-6367. EnumSetParam$Domain#parse fails for parameter containing more than one enum. Contributed
by Yi Liu.

Modified:
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java
    hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1594150&r1=1594149&r2=1594150&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Tue May 13 07:34:32 2014
@@ -455,6 +455,9 @@ Release 2.5.0 - UNRELEASED
     HDFS-5522. Datanode disk error check may be incorrectly skipped.
     (Rushabh S Shah via kihwal)
 
+    HDFS-6367. EnumSetParam$Domain#parse fails for parameter containing more than one enum.
+    (Yi Liu via umamahesh)
+
 Release 2.4.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java?rev=1594150&r1=1594149&r2=1594150&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/web/resources/EnumSetParam.java
Tue May 13 07:34:32 2014
@@ -79,8 +79,8 @@ abstract class EnumSetParam<E extends En
       final EnumSet<E> set = EnumSet.noneOf(enumClass);
       if (!str.isEmpty()) {
         for(int i, j = 0; j >= 0; ) {
-          i = j;
-          j = str.indexOf(',', i+1);
+          i = j > 0 ? j + 1 : 0;
+          j = str.indexOf(',', i);
           final String sub = j >= 0? str.substring(i, j): str.substring(i);
           set.add(Enum.valueOf(enumClass, sub.trim().toUpperCase()));
         }

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java?rev=1594150&r1=1594149&r2=1594150&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java
(original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/resources/TestParam.java
Tue May 13 07:34:32 2014
@@ -21,12 +21,14 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 
 import java.util.Arrays;
+import java.util.EnumSet;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
+import org.apache.hadoop.fs.Options;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.AclEntry;
 import org.apache.hadoop.fs.permission.FsPermission;
@@ -346,4 +348,13 @@ public class TestParam {
     }
   }
  
+  @Test
+  public void testRenameOptionSetParam() {
+    final RenameOptionSetParam p = new RenameOptionSetParam(
+        Options.Rename.OVERWRITE, Options.Rename.NONE);
+    final RenameOptionSetParam p1 = new RenameOptionSetParam(
+        p.getValueString());
+    Assert.assertEquals(p1.getValue(), EnumSet.of(
+        Options.Rename.OVERWRITE, Options.Rename.NONE));
+  }
 }



Mime
View raw message