Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.2
    • None
    • None
    • New

    Description

      Currently, mockfilesystems wrap a path with "new FilterPath". but this "wrapping" logic is scattered everywhere in the code (and tests!). And it is hardcoded at filterpath (subclassing is not possible).

      This makes it impossible for a mock filesystem to extend FilterPath with some custom logic (example: check for special windows reserved characters).

      I don't think code/tests should be calling "new FilterPath" everywhere, this is also just messy. Instead they should ask the mockfilesystem's provider to wrap the path: provider.wrapPath(path, filesystem).

      This way, WindowsFS can then override wrapPath() with a subclass that looks for special characters.

      This issue is just for the API refactoring/cleanup. Additional Windows-simulation can happen on the parent issue.

      Attachments

        Issue Links

          Activity

            Commit 844bd8883980302ba2259f2c0a428228d3e86bad in lucene's branch refs/heads/main from Robert Muir
            [ https://gitbox.apache.org/repos/asf?p=lucene.git;h=844bd888398 ]

            LUCENE-10526: add single method to mockfile to wrap a Path (#822)

            Currently "new FilterPath" is called from everywhere, making it impossible for a mockfilesystem to use a custom subclass.
            Add FilterFileSystemProvider.wrapPath(path), which subclasses can override. Fix tests to use it instead of juggling URI objects and passing FileSystems around.

            jira-bot ASF subversion and git services added a comment - Commit 844bd8883980302ba2259f2c0a428228d3e86bad in lucene's branch refs/heads/main from Robert Muir [ https://gitbox.apache.org/repos/asf?p=lucene.git;h=844bd888398 ] LUCENE-10526 : add single method to mockfile to wrap a Path (#822) Currently "new FilterPath" is called from everywhere, making it impossible for a mockfilesystem to use a custom subclass. Add FilterFileSystemProvider.wrapPath(path), which subclasses can override. Fix tests to use it instead of juggling URI objects and passing FileSystems around.

            Commit 34d739247273200e71549e6a6e03a8d637f56253 in lucene's branch refs/heads/branch_9x from Robert Muir
            [ https://gitbox.apache.org/repos/asf?p=lucene.git;h=34d73924727 ]

            LUCENE-10526: add single method to mockfile to wrap a Path (#822)

            Currently "new FilterPath" is called from everywhere, making it impossible for a mockfilesystem to use a custom subclass.
            Add FilterFileSystemProvider.wrapPath(path), which subclasses can override. Fix tests to use it instead of juggling URI objects and passing FileSystems around.

            jira-bot ASF subversion and git services added a comment - Commit 34d739247273200e71549e6a6e03a8d637f56253 in lucene's branch refs/heads/branch_9x from Robert Muir [ https://gitbox.apache.org/repos/asf?p=lucene.git;h=34d73924727 ] LUCENE-10526 : add single method to mockfile to wrap a Path (#822) Currently "new FilterPath" is called from everywhere, making it impossible for a mockfilesystem to use a custom subclass. Add FilterFileSystemProvider.wrapPath(path), which subclasses can override. Fix tests to use it instead of juggling URI objects and passing FileSystems around.
            romseygeek Alan Woodward added a comment -

            Bulk close for 9.2.0 release

            romseygeek Alan Woodward added a comment - Bulk close for 9.2.0 release
            tomoko Tomoko Uchida added a comment -

            This issue was moved to GitHub issue: #11562.

            tomoko Tomoko Uchida added a comment - This issue was moved to GitHub issue: #11562 .

            People

              Unassigned Unassigned
              rcmuir Robert Muir
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h