sling-dev mailing list archives

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

    [ https://issues.apache.org/jira/browse/SLING-7466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16350291#comment-16350291
] 

ASF GitHub Bot commented on SLING-7466:
---------------------------------------

cziegeler closed pull request #1: SLING-7466 - adding update of existing resource to make
sure datauri …
URL: https://github.com/apache/sling-org-apache-sling-installer-core/pull/1
 
 
   

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/EntityResourceList.java b/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
index c61af04..e143af6 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/EntityResourceList.java
@@ -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
file
+                            // same resource but different digest, we need to to update the
file
+                            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.cleanup(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:
users@infra.apache.org


> EntityResourceList cleaning up resource instead of updating
> -----------------------------------------------------------
>
>                 Key: SLING-7466
>                 URL: https://issues.apache.org/jira/browse/SLING-7466
>             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
(v7.6.3#76005)

Mime
View raw message