You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by vo...@apache.org on 2023/10/11 14:46:02 UTC
[myfaces] branch 4.0.x updated: myfaces-4623 check for dup ids to avoid DuplicateIdException
This is an automated email from the ASF dual-hosted git repository.
volosied pushed a commit to branch 4.0.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/4.0.x by this push:
new 318c39a54 myfaces-4623 check for dup ids to avoid DuplicateIdException
new a03fd8f64 Merge pull request #627 from volosied/myfaces-4623-4.x
318c39a54 is described below
commit 318c39a54b4d7c1b75edb90b3f0a4f457d2e4a26
Author: Volodymyr Siedlecki <vo...@gmail.com>
AuthorDate: Thu Aug 17 12:05:48 2023 -0400
myfaces-4623 check for dup ids to avoid DuplicateIdException
---
.../view/facelets/PartialStateManagementStrategy.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategy.java b/impl/src/main/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategy.java
index ca0c8e533..0b214bf0f 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategy.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/PartialStateManagementStrategy.java
@@ -642,7 +642,17 @@ public class PartialStateManagementStrategy extends StateManagementStrategy
{
try
{
- target.getChildren().add(childIndex, child);
+ UIComponent parent = target;
+ UIComponent dup = parent.getChildren().get(childIndex);
+ if (child.getId().equals(dup.getId())) // avoid DuplicateIdException - myfaces-4623
+ {
+ parent.getChildren().remove(childIndex.intValue());
+ parent.getChildren().add(childIndex, child);
+ }
+ else
+ {
+ target.getChildren().add(childIndex, child);
+ }
}
catch (IndexOutOfBoundsException e)
{
@@ -650,6 +660,7 @@ public class PartialStateManagementStrategy extends StateManagementStrategy
// item, so just add it.
target.getChildren().add(child);
}
+
}
}
}