IOCase.isCaseSensitive(IOCase) result is backward
* Handle static method isCaseSensitive of class IOCase.
* Update RegexFileFilter.java
Change the order of import statements, which the IDE automatically changes.
* Add a test of static method isCaseSensitive in class IOCaseTest.
MODIFY
src/main/java/org/apache/commons/io/IOCase.java
src/main/java/org/apache/commons/io/IOCase.java
@@ -91,7 +91,7 @@ public static IOCase forName(final String name) {
* @since 2.10.0
*/
public static boolean isCaseSensitive(final IOCase ioCase) {
- return ioCase != null && !ioCase.isCaseSensitive();
+ return ioCase != null && ioCase.isCaseSensitive();
}
/**

MODIFY
src/main/java/org/apache/commons/io/filefilter/RegexFileFilter.java
src/main/java/org/apache/commons/io/filefilter/RegexFileFilter.java
@@ -89,7 +89,7 @@ private static Pattern compile(final String pattern, final int flags) {
* @return Pattern compilation flags.
*/
private static int toFlags(final IOCase ioCase) {
- return IOCase.isCaseSensitive(ioCase) ? Pattern.CASE_INSENSITIVE : 0;
+ return IOCase.isCaseSensitive(ioCase) ? 0 : Pattern.CASE_INSENSITIVE;
}
/** The regular expression pattern that will be used to match file names. */

MODIFY
src/test/java/org/apache/commons/io/IOCaseTest.java
src/test/java/org/apache/commons/io/IOCaseTest.java
@@ -301,4 +301,10 @@ public void test_toString() {
assertEquals("System", IOCase.SYSTEM.toString());
}
+ @Test
+ public void test_isCaseSensitive_static() {
+ assertTrue(IOCase.isCaseSensitive(IOCase.SENSITIVE));
+ assertFalse(IOCase.isCaseSensitive(IOCase.INSENSITIVE));
+ assertEquals(!WINDOWS, IOCase.isCaseSensitive(IOCase.SYSTEM));
+ }
}

IOCase.isCaseSensitive(IOCase) result is backward (#325)

* Handle static method isCaseSensitive of class IOCase.

* Update RegexFileFilter.java

Change the order of import statements, which the IDE automatically changes.

* Add a test of static method isCaseSensitive in class IOCaseTest.

Co-authored-by: huangxiaowei <huangxw@newland.com.cn>