test/java/nio/file/FileSystem/Basic.java

Print this page
rev 11514 : 8073445: (fs) FileSystem.getPathMatcher(...) should check syntax component without regard to case
Summary: Change String equals() to equalsIgnoreCase() where needed.
Reviewed-by: TBD

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2008, 2012, 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 6838333
+ * @bug 4313887 6838333 8073445
  * @summary Unit test for java.nio.file.FileSystem
  * @library ..
  */
 
 import java.nio.file.*;

@@ -78,7 +78,15 @@
             checkSupported(fs, "posix", "unix", "owner", "dos", "user");
         if (os.contains("OS X"))
             checkSupported(fs, "posix", "unix", "owner");
         if (os.equals("Windows"))
             checkSupported(fs, "owner", "dos", "acl", "user");
+
+        // should NOT throw UOE
+        PathMatcher pm = FileSystems.getDefault().getPathMatcher("Regex:java");
+        // next three lines to avoid unused variable complaints about 'pm' 
+        // and any possibility of things eventually being optimized out
+        if (pm.matches(Paths.get("/foo", "bar"))) {
+            System.out.println("foobar!");
+        }
     }
 }