test/java/nio/file/PathMatcher/Basic.java
Print this page
rev 11561 : 8073445: (fs) FileSystem.getPathMatcher(...) should check syntax component without regard to case
Summary: Change String equals() to equalsIgnoreCase() where needed.
Reviewed-by: alanb
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -20,11 +20,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
- * @bug 4313887 6866397
+ * @bug 4313887 6866397 8073445
* @summary Unit test for java.nio.file.PathMatcher
*/
import java.nio.file.*;
import java.util.regex.PatternSyntaxException;
@@ -171,10 +171,35 @@
failures++;
} catch (UnsupportedOperationException e) {
System.out.println(" OKAY");
}
+ // GLOB_SYNTAX case sensitivity of getPathMatcher: should not throw UOE
+ try {
+ FileSystems.getDefault().getPathMatcher("glob:java");
+ FileSystems.getDefault().getPathMatcher("Glob:java");
+ FileSystems.getDefault().getPathMatcher("GLOB:java");
+ System.out.println("Test GLOB_SYNTAX case sensitivity OKAY");
+ } catch (UnsupportedOperationException e) {
+ System.err.println("getPathMatcher GLOB_SYNTAX case sensitivity");
+ e.printStackTrace();
+ failures++;
+ }
+
+ // REGEX_SYNTAX case sensitivity of getPathMatcher: should not throw UOE
+ try {
+ FileSystems.getDefault().getPathMatcher("regex:java");
+ FileSystems.getDefault().getPathMatcher("Regex:java");
+ FileSystems.getDefault().getPathMatcher("RegEx:java");
+ FileSystems.getDefault().getPathMatcher("REGEX:java");
+ System.out.println("Test REGEX_SYNTAX case sensitivity OKAY");
+ } catch (UnsupportedOperationException e) {
+ System.err.println("getPathMatcher REGEX_SYNTAX case sensitivity");
+ e.printStackTrace();
+ failures++;
+ }
+
if (failures > 0)
throw new RuntimeException(failures +
" sub-test(s) failed - see log for details");
}
}