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

Module mechanism fails on modules with only optional-and-not-present dependencies

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 4.4.6
    • 4.4.4
    • core
    • None
    • Yes
    • Yes

      If a module has only optional dependencies, and none of those is present in the current system, the current dependency calculation blows up with the following exception

      java.util.NoSuchElementException
      	at java.util.AbstractList$Itr.next(AbstractList.java:350)
      	at java.util.Collections.max(Collections.java:640)
      	at info.magnolia.module.model.reader.DependencyLevelComparator.calcDependencyDepth(DependencyLevelComparator.java:110)
      	at info.magnolia.module.model.reader.DependencyLevelComparator.compare(DependencyLevelComparator.java:76)
      	at info.magnolia.module.model.reader.DependencyLevelComparator.compare(DependencyLevelComparator.java:52)
      	at java.util.Arrays.mergeSort(Arrays.java:1270)
      	at java.util.Arrays.mergeSort(Arrays.java:1281)
      	at java.util.Arrays.mergeSort(Arrays.java:1281)
      	at java.util.Arrays.mergeSort(Arrays.java:1282)
      	at java.util.Arrays.sort(Arrays.java:1210)
      	at java.util.Collections.sort(Collections.java:159)
      	at info.magnolia.module.model.reader.DependencyCheckerImpl.sortByDependencyLevel(DependencyCheckerImpl.java:65)
      	at info.magnolia.module.ModuleManagerImpl.loadDefinitions(ModuleManagerImpl.java:141)
      

      Here's a patch and test that fixes the issue.
      The attached test fails with 4.4.4.

        Acceptance criteria

              mdivilek Milan Divilek
              gjoseph Magnolia International
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD