Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25811

XarInstalledExtensionRepository#getBackwardDependencies returns null instead of an empty collection for non-XAR extensions

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    Description

      The xar InstalledExtensionRepository component (XarInstalledExtensionRepository) returns null from both getBackwardDependencies methods when the extension is not a XAR extension. The InstalledExtensionRepository contract says these methods return an empty collection when no backward dependency is found, so code that gets this repository through the generic role and calls isEmpty() or iterates over the result fails with a NullPointerException.

      In addition, getBackwardDependencies(ExtensionId, boolean withOptional) ignores withOptional: it always calls getBackwardDependencies(ExtensionId), so optional backward dependencies are never returned for a XAR extension.

      Expected

      • An empty collection (or map) is returned for an extension which is not a XAR.
      • withOptional is passed through to the underlying repository.

      SonarCloud reports this as possible NullPointerException}}s in callers such as {{OrphanedExtensionsResolver (rule javabugs:S2259).

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              tmortagne Thomas Mortagne
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: