sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (SLING-7466) EntityResourceList cleaning up resource instead of updating
Date Fri, 02 Feb 2018 13:09:00 GMT


ASF GitHub Bot commented on SLING-7466:

cziegeler closed pull request #1: SLING-7466 - adding update of existing resource to make
sure datauri …

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/main/java/org/apache/sling/installer/core/impl/ b/src/main/java/org/apache/sling/installer/core/impl/
index c61af04..e143af6 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/
+++ b/src/main/java/org/apache/sling/installer/core/impl/
@@ -373,7 +373,20 @@ public void addOrUpdate(final RegisteredResourceImpl r) {
                 if ( rr.getURL().equals(r.getURL()) ) {
                     if ( RegisteredResourceImpl.isSameResource((RegisteredResourceImpl)rr,
r) ) {
                         if ( !rr.getDigest().equals(r.getDigest()) ) {
-                            // same resource but different digest, we need to remove the
+                            // same resource but different digest, we need to to update the
+                            LOGGER.debug("Updating resource with due to different digest:
{}", r);
+                            try {
+								InternalResource intRes = InternalResource.create(r.getScheme(), 
+										new InstallableResource(r.getEntityId(), 
+												r.getInputStream(), 
+												r.getDictionary(),
+												r.getDigest(), 
+												r.getType(), 
+												r.getPriority()));
+								((RegisteredResourceImpl)rr).update(intRes);
+                            } catch (IOException e) {
+								LOGGER.error("Failed to update resource with different digest: {}", r);
+							}
                             LOGGER.debug("Cleanup duplicate resource: {}", r);


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> EntityResourceList cleaning up resource instead of updating
> -----------------------------------------------------------
>                 Key: SLING-7466
>                 URL:
>             Project: Sling
>          Issue Type: Bug
>          Components: Installer
>    Affects Versions: Installer Core 3.8.10
>            Reporter: Dominik Süß
>            Assignee: Carsten Ziegeler
>            Priority: Major
>             Fix For: Installer Core 3.8.12
> In case of a replaced launchpad containing an unchanged resource the EntityResourceList
is called for "addOrUpdate" of this Resource - in case the resource already exists but the
digest differs the method currently drops the new resource without updating the existing one
keeping the old dataUri.
> The issue manifests if these RegisteredResources are currently in INSTALL state and the
INSTALLED version gets dropped subsequently.
> This isn't just a theoretical case but was observed for cases where a bundle in an n-1
version was patched to the same version provided in version n of launchpad and launchpad hasn't
changed for n+1. If the jcr version is then removed the installation of the outdated registeredResource
fails because of a wrong dataUri.

This message was sent by Atlassian JIRA

View raw message