Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6350

Incorrect matching in Path class causes MountByFS to fail (more than 2 slashes fails)

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • API 2.15.0
    • API 2.16.2
    • Extensions
    • None

    Description

      If I mount a file system path to e.g. '/libs/sling/resource-editor' jsp changes are not picked up by the jsp compiler.

      FileMonitor.sendEvents(... ObservationReporter) gets an ObservationReporter as a parameter that doesn't return ObserverConfigurations in getObserverConfigurations() thus no changes are reported to the jsp compiler.

      The reason is, that they are not added in it's constructor (BasicObservationReporter:99) because 'providerPath.matches(p.getPath())' returns false. If I manually change that in the debugger to true the mount works well. In this example the providerPath is '/libs/sling/resource-editor' and p.getPath() is 'glob:/libs/*/.jsp'. (See patch for PathTest.java)

      org.apache.sling.api.resource.path.Path.matches() in line 128 and following counts three slashes for '/libs/sling/resource-editor' and uses the substring of the glob expression until a fourth (3+1) slash or the end of the string. This leads to a glob expression of 'glob:/libs/*/.jsp' instead of 'glob:/libs/**' and returns false.

      I don't have an overview of all use cases but judging from the PathTest the amount of slashes counted should not exceed the amount of slashes in the glob expression minus one if the glob expression uses an extension. I will add a patch for org.apache.sling.api.resource.path.Path as well so you can choose not to apply it if it's not correct.

      Attachments

        1. testing-with-ant-all-tests-pass.patch
          12 kB
          Bertrand Delacretaz
        2. testing-with-ant.patch
          6 kB
          Bertrand Delacretaz
        3. testing-with-ant.patch
          7 kB
          Bertrand Delacretaz
        4. sling-api-patch.txt
          3 kB
          Sandro Boehme
        5. patch.txt
          10 kB
          Carsten Ziegeler

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            cziegeler Carsten Ziegeler
            sandro Sandro Boehme
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment