Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8073445

(fs) FileSystem.getPathMatcher(...) should check syntax component without regard to case

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u31
    • core-libs
    • b54
    • x86
    • windows_8
    • Verified

        FULL PRODUCT VERSION :
        java version "1.8.0_31"
        Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
        Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.3.9600]

        A DESCRIPTION OF THE PROBLEM :
        The method getPathMatcher in the class java.nio.file.FileSystem specifies: "The value of the syntax component is compared without regard to case."
        However, this is not the case: in the current implementation, the syntax component must be lowercase or else an UnsupportedOperationException is thrown.

        Either it has to be specified that the syntax component must always be lowercase, or the implementation has to be fixed to obey the specification.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the program in the test case


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The program exits successfully.
        ACTUAL -
        An UnsupportedOperationException is thrown.

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Exception in thread "main" java.lang.UnsupportedOperationException: Syntax 'Regex' not recognized
        at sun.nio.fs.WindowsFileSystem.getPathMatcher(WindowsFileSystem.java:299)
        at com.mooo.ther.lang.Test.main(Test.java:8)

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.nio.file.FileSystems;

        class Test {

        public static void main(String[] args) {
            FileSystems.getDefault().getPathMatcher("Regex:java");
        }

        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        always use lowercase for the syntax component

              bpb Brian Burkhalter
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: