[ https://issues.apache.org/jira/browse/IO-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16506252#comment-16506252 ]
Gary Gregory edited comment on IO-579 at 6/8/18 4:56 PM: --------------------------------------------------------- We are attempting top abstract things like case-sensitivity in a new enum in trunk called {{org.apache.commons.io.FileSystem}} but it is not fully baked; any help is appreciated. Basically, for now, I think you should write code like: {code:java} FilenameUtils.isExtenstion(myString.toLowerCase(Locale.ROOT), new String[] {"jpg", "gif", "andSoOn" }); {code} For now, I'd rather not add a case-sensitive boolean to a bunch of APIs. Ideally, we should have APIs in {{org.apache.commons.io.FileSystem}} that factor that in. was (Author: garydgregory): We are attempting top abstract things like case-sensitivity in a new enum in trunk called {{org.apache.commons.io.FileSystem}} but it is not fully baked. Actually, case-sensitivity is not in that enum yet. Basically, for now, I think you should write code like: {code:java} FilenameUtils.isExtenstion(myString.toLowerCase(Locale.ROOT), new String[] {"jpg", "gif", "andSoOn" }); {code} For now, I'd rather not add a case-sensitive boolean to a bunch of APIs. Ideally, we should have APIs in {{org.apache.commons.io.FileSystem}} that factor that in. > FilenameUtils.isExtension() is case-sensitive > --------------------------------------------- > > Key: IO-579 > URL: https://issues.apache.org/jira/browse/IO-579 > Project: Commons IO > Issue Type: Bug > Components: Utilities > Affects Versions: 2.6 > Reporter: Ohad R > Priority: Major > Labels: easyfix > Original Estimate: 24h > Remaining Estimate: 24h > > FilenameUtils.isExtension() is case-sensitive. > All 3 implementations of this method call String.equals() rather than > equalsIgnoreCase(), so it means that if my extension is "jpg", for example, > and my filename is something.JPG, the method (any of them) will return > 'false'. > > fix suggestion: should use the method > [FilenameUtils.eqauls(...)|https://github.com/apache/commons-io/blob/master/src/main/java/org/apache/commons/io/FilenameUtils.java#L1200] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)