garydgregory commented on a change in pull request #44: More efficient 
comparison in FileExtensionSelector
URL: https://github.com/apache/commons-vfs/pull/44#discussion_r270672315
 
 

 ##########
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java
 ##########
 @@ -70,15 +72,7 @@ public FileExtensionSelector(final String... extensions) {
      */
     @Override
     public boolean includeFile(final FileSelectInfo fileInfo) throws Exception 
{
-        if (this.extensions == null) {
-            return false;
-        }
-        for (final String extension : this.extensions) {
-            if 
(fileInfo.getFile().getName().getExtension().equalsIgnoreCase(extension)) {
-                return true;
-            }
-        }
-        return false;
+        return 
this.extensions.contains(fileInfo.getFile().getName().getExtension().toLowerCase());
 
 Review comment:
   I'm not sure that's quite right. Unit tests would help check that case is 
handled properly. Note that not all file systems are case-insenstive. OTOH, if 
that is an issue with this code, it was already there! ;-)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to