From dev-return-95571-archive-asf-public=cust-asf.ponee.io@sling.apache.org Wed Feb 27 08:08:53 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3BBC9180608 for ; Wed, 27 Feb 2019 09:08:53 +0100 (CET) Received: (qmail 53553 invoked by uid 500); 27 Feb 2019 08:08:47 -0000 Mailing-List: contact dev-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list dev@sling.apache.org Received: (qmail 53540 invoked by uid 99); 27 Feb 2019 08:08:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2019 08:08:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A3462182420 for ; Wed, 27 Feb 2019 08:08:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Gr75DJxNpyba for ; Wed, 27 Feb 2019 08:08:45 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id DB7AD5F432 for ; Wed, 27 Feb 2019 07:59:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 714D2E27E7 for ; Wed, 27 Feb 2019 07:59:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 18EDD24567 for ; Wed, 27 Feb 2019 07:59:00 +0000 (UTC) Date: Wed, 27 Feb 2019 07:59:00 +0000 (UTC) From: "Carsten Ziegeler (JIRA)" To: dev@sling.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (SLING-8296) MergingResourceProvider purges the last item if existing item is overlaid and has sling:orderBefore property set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SLING-8296?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Carsten Ziegeler resolved SLING-8296. ------------------------------------- Resolution: Fixed I've added a test case to verify the wrong behaviour and ensure the provide= d fix solves it. Revision .056c3a0 > MergingResourceProvider purges the last item if existing item is overlaid= and has sling:orderBefore property set > -------------------------------------------------------------------------= --------------------------------------- > > Key: SLING-8296 > URL: https://issues.apache.org/jira/browse/SLING-8296 > Project: Sling > Issue Type: Bug > Components: ResourceResolver > Affects Versions: Resource Merger 1.3.8 > Reporter: Janaki Ratnakar Bhagwath > Assignee: Carsten Ziegeler > Priority: Major > Fix For: Resource Merger 1.3.10 > > > The MergingResourceProvider has a logic which tends to purge the last ele= ment on the merged list if one of the overlaid nodes is from the=C2=A0origi= nal node and has a "sling:orderBefore"=C2=A0property. > Example: > */libs resource has* > create, edit, delete, update, rollout > */apps overlaid resource has* > move, create (sling:orderBefore=3Dedit) > _The_ orderBefore=C2=A0_property in the /apps resource is added to ensure= that the overlaid node is not pushed to the end._ > *Excepted Merged Resource /mnt/overlay* > create, edit, delete, update, rollout, move > *Actual Response* > create, edit, delete, update, rollout > This is due to a logical issue in the following lines of code in MergingR= esourceProvider.=C2=A0 > When the _sling:_orderBefore is set, even though childPositionInCandidate= List is actually not -1, this logic is not triggered and the first block ex= ecutes, which adds the overlaid existing node create twice and removes the = last element move in the previous example. > {code:java} > // either reorder because of explicit reording property > if (orderBeforeIndex > -1) { > candidates.add(orderBeforeIndex, holder); > candidates.remove(candidates.size() - 1); > } else { > // or reorder because overlaid resource has a different order > if (childPositionInCandidateList !=3D -1 && previousChildPositionInCa= ndidateList !=3D -1) { > candidates.remove(childPositionInCandidateList); > if (childPositionInCandidateList < previousChildPositionInCandida= teList) { > previousChildPositionInCandidateList--; > } > if(previousChildPositionInCandidateList+1 > candidates.size()){ > candidates.add(holder); > } else { > candidates.add(previousChildPositionInCandidateList + 1, hold= er); > } > previousChildPositionInCandidateList++; > } > } > {code} > =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005)