goiri commented on a change in pull request #3739:
URL: https://github.com/apache/hadoop/pull/3739#discussion_r759784877



##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/CompressionCodecFactory.java
##########
@@ -199,7 +201,7 @@ public CompressionCodec getCodec(Path file) {
     if (codecs != null) {
       String filename = file.getName();
       String reversedFilename =
-          new StringBuilder(filename).reverse().toString();
+          toLowerCase(new StringBuilder(filename).reverse().toString());

Review comment:
       Extract the StringUtils.toLowerCase().
   Probably call it lowerReversedFilename.

##########
File path: 
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/TestCodecFactory.java
##########
@@ -137,9 +138,15 @@ private static CompressionCodecFactory setClasses(Class[] 
classes) {
   
   private static void checkCodec(String msg, 
                                  Class expected, CompressionCodec actual) {
-    assertEquals(msg + " unexpected codec found",
-                 expected.getName(),
-                 actual.getClass().getName());
+    if (expected == null) {
+      assertNull(msg, actual);
+    } else if (actual == null) {

Review comment:
       Is this tested?

##########
File path: 
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/CompressionCodecFactory.java
##########
@@ -29,6 +29,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.hadoop.util.StringUtils.toLowerCase;

Review comment:
       Just for this, there is no need to the import, just use 
StringUtils.toLowerCase() in 204.

##########
File path: 
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/TestCodecFactory.java
##########
@@ -137,9 +138,15 @@ private static CompressionCodecFactory setClasses(Class[] 
classes) {
   
   private static void checkCodec(String msg, 
                                  Class expected, CompressionCodec actual) {
-    assertEquals(msg + " unexpected codec found",
-                 expected.getName(),
-                 actual.getClass().getName());
+    if (expected == null) {

Review comment:
       Is there any test case that passes null for expected?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to