Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6326

Don't fail when a resource exists as a folder in an origin and a file in another

XMLWordPrintable

    • Yes
    • Sprint 4 (Kromeriz)
    • 5

      Unfortunately, the following situation happens quite often: java.lang.IllegalStateException: Given resources are not all directory/file: [JcrResource{path=/foo/bar}, ClasspathResource{path=/foo/bar}]

      This is happening in info.magnolia.resourceloader.layered.LayeredResourceOrigin#newLayeredResource. We originally thought this would be a really unlikely and extreme case, so we just added a protective if block. It looks like this is happening to a few folks, especially with e.g themes, where for some reason we still strip the extension when importing nodes into JCR.

      TODO:

      • improve error message (which of these resources is a folder, which one is a file)
      • log it, ignore not-matching resources (e.g simply not add them into the LayeredResource)
      • fix e.g ThemeVersionHandler so it does NOT strip extensions (and check for other uses of InstallBinaryResourceTask and InstallTextResourceTask
      • generally discourage the use of InstallBinaryResourceTask and InstallTextResourceTask since they are not all that vital anymore (since resources DON'T have to be copied to JCR to be served anymore, they can be served straight from filesystem or classpath since 5.4)

      Workarounds:

      • rename resources such that there is no filename-without-extension that conflicts with folders
      • don't use ThemeVersionHandler, or use a patched version of it (which sets stripExtension to false)
      • don't InstallBinaryResourceTask or InstallTextResourceTask, or make sure stripExtension is false)

        Acceptance criteria

              jsimak Jaroslav Simak
              gjoseph Magnolia International
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 0.25d
                    0.25d