Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 48409 invoked from network); 7 Sep 2010 17:28:55 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Sep 2010 17:28:55 -0000 Received: (qmail 13910 invoked by uid 500); 7 Sep 2010 17:28:55 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 13861 invoked by uid 500); 7 Sep 2010 17:28:54 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 13854 invoked by uid 99); 7 Sep 2010 17:28:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 17:28:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Sep 2010 17:28:53 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o87HSXvx019724 for ; Tue, 7 Sep 2010 17:28:33 GMT Message-ID: <33011797.57791283880513389.JavaMail.jira@thor> Date: Tue, 7 Sep 2010 13:28:33 -0400 (EDT) From: "Leonardo Uribe (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Reopened: (MYFACES-2908) UIViewRoot.addComponentResource() adding multiple components with same ID instead of replacing In-Reply-To: <12996088.145941283454713095.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MYFACES-2908?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Leonardo Uribe reopened MYFACES-2908: ------------------------------------- The code that check for a duplicate component is on the right place. It seems the previous algorithm takes into consideration facelets added components but not programatically added ones. So the fix is correct if a component is added programatically but makes facelets added component (h:outputScript, h:outputStylesheet). Right now, we have tag handlers for h:outputScript and h:outputStylesheet that prevents double addition, but if some user create a tag with a similar behavior it will fail. > UIViewRoot.addComponentResource() adding multiple components with same ID instead of replacing > ---------------------------------------------------------------------------------------------- > > Key: MYFACES-2908 > URL: https://issues.apache.org/jira/browse/MYFACES-2908 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-314 > Affects Versions: 2.0.2-SNAPSHOT > Reporter: Michael Concini > Assignee: Michael Concini > Fix For: 2.0.2-SNAPSHOT > > Attachments: MYFACES-2908-patch.txt > > > Looks like when MYFACES-2854 was committed, there were two issues it caused where we break spec compliance. Both are around behavior that "If the component ID of componentResource matches the the ID of a resource that has allready been added, remove the old resource." > The first is that it looks like the "else if (componentId != null)" statement is in the wrong place. > If a UIComponent is added with the same ID as an existing component, we'll never get to this check since we'll be false on the isInView() check. > This will cause duplicate ID exceptions to be thrown if multiple objects with the same ID are added. > This is easily resolved by moving the else if to kick in whenever isInView() is false. > The second issue, and the more important since this is breaking a TCK test, is that since we were only comparing to the parent's ID to the location prefix, we weren't handling the case where the same object gets added a second time after updating the target. > This can be resolved by changing > if (componentResource.getParent() != null && > componentResource.getParent().getId() != null && > componentResource.getParent().getId().startsWith(JAVAX_FACES_LOCATION_PREFIX)) ... > to > if (componentResource.getParent() != null && > componentResource.getParent().getId() != null && > componentResource.getParent().getId().equals(JAVAX_FACES_LOCATION_PREFIX + target)) > I'll attach a patch for review while I wait for our CTS team to try the change out. I probably wont' be able to commit until after the US Labor Day holiday since I'm away Friday. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.