You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2023/02/28 14:02:34 UTC

[myfaces] branch 3.0.x updated: MYFACES-4576

This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/3.0.x by this push:
     new 2f997abc7 MYFACES-4576
2f997abc7 is described below

commit 2f997abc7179740958190fcb0231310afe62db1f
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Tue Feb 28 15:02:18 2023 +0100

    MYFACES-4576
---
 .../myfaces/shared/renderkit/html/HtmlRadioRendererBase.java  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
index 4874dc978..bf14c8dc9 100644
--- a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
+++ b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
@@ -56,14 +56,13 @@ public class HtmlRadioRendererBase
 {
     private static final Logger log = Logger.getLogger(HtmlRadioRendererBase.class.getName());
 
+    private static final String ATTR_GROUP_FIRST = HtmlRadioRendererBase.class.getName() + "#groupFirst";
     private static final String PAGE_DIRECTION = "pageDirection";
     private static final String LINE_DIRECTION = "lineDirection";
     
     private static final Set<VisitHint> FIND_SELECT_LIST_HINTS = 
             Collections.unmodifiableSet(EnumSet.of(VisitHint.SKIP_UNRENDERED, VisitHint.SKIP_ITERATION));
 
-    private Map<String, UISelectOne> groupFirst = new HashMap<String, UISelectOne>();
-    
     @Override
     public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
     {
@@ -106,6 +105,14 @@ public class HtmlRadioRendererBase
         String group = selectOne instanceof HtmlSelectOneRadio ? ((HtmlSelectOneRadio) selectOne).getGroup() : null;
         if (group != null && !group.isEmpty())
         {
+            Map<String, UISelectOne> groupFirst = (Map<String, UISelectOne>) facesContext.getAttributes()
+                    .get(ATTR_GROUP_FIRST);
+            if (groupFirst == null)
+            {
+                groupFirst = new HashMap<>();
+                facesContext.getAttributes().put(ATTR_GROUP_FIRST, groupFirst);
+            }
+            
             if (!groupFirst.containsKey(group)) 
             {
                 groupFirst.put(group, selectOne);