You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2019/02/01 16:56:38 UTC

[sling-org-apache-sling-feature-extension-content] 04/46: SLING-7991 - setting order to Integer.MAX_VALUE for processing last if start-order is not set.

This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-extension-content.git

commit 8db9091e8e70e971632390a5af4654184e937244
Author: Dominik Suess <su...@adobe.com>
AuthorDate: Tue Oct 9 09:16:28 2018 +0200

    SLING-7991 - setting order to Integer.MAX_VALUE for processing last if start-order is not set.
---
 .../apache/sling/feature/extension/content/ContentHandler.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java b/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
index e19ba12..8a84ddb 100644
--- a/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
+++ b/src/main/java/org/apache/sling/feature/extension/content/ContentHandler.java
@@ -95,7 +95,14 @@ public class ContentHandler implements ExtensionHandler {
                 && extension.getName().equals(FeatureConstants.EXTENSION_NAME_CONTENT_PACKAGES)) {
             MultiValueMap orderedArtifacts = MultiValueMap.decorate(new LinkedHashMap<Integer, Collection<Artifact>>());
             for (final Artifact a : extension.getArtifacts()) {
-                orderedArtifacts.put(Integer.valueOf(a.getStartOrder()), a);
+                int order;
+                // content-packages without explicit start-order to be installed last
+                if (a.getMetadata().get(Artifact.KEY_START_ORDER) != null) {
+                    order = Integer.valueOf(a.getStartOrder());
+                } else {
+                    order = Integer.MAX_VALUE;
+                }
+                orderedArtifacts.put(order, a);
             }
             List<String> executionPlans = new ArrayList<String>();
             for (Object key : orderedArtifacts.keySet()) {