[GitHub] [commons-vfs] garydgregory commented on a change in pull request #44: More efficient comparison in FileExtensionSelector
garydgregory commented on a change in pull request #44: More efficient comparison in FileExtensionSelector URL: https://github.com/apache/commons-vfs/pull/44#discussion_r270672262 ## File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java ## @@ -57,9 +61,7 @@ public FileExtensionSelector(final Collection extensions) { * @param extensions The extensions to be included by this selector. */ public FileExtensionSelector(final String... extensions) { -if (extensions != null) { -this.extensions.addAll(Arrays.asList(extensions)); -} +this(Arrays.asList(extensions)); Review comment: +1 to reusing the ctor. 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
[GitHub] [commons-vfs] garydgregory commented on a change in pull request #44: More efficient comparison in FileExtensionSelector
garydgregory commented on a change in pull request #44: More efficient comparison in FileExtensionSelector URL: https://github.com/apache/commons-vfs/pull/44#discussion_r270672247 ## File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/FileExtensionSelector.java ## @@ -47,7 +47,11 @@ */ public FileExtensionSelector(final Collection extensions) { if (extensions != null) { -this.extensions.addAll(extensions); +for (String ext : extensions) { +if (ext != null) { Review comment: +1 to the null check. 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
[GitHub] [commons-vfs] garydgregory commented on a change in pull request #44: More efficient comparison in FileExtensionSelector
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