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 2020/09/08 15:17:06 UTC

[myfaces] branch master updated: refactored

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 1fdbe19  refactored
1fdbe19 is described below

commit 1fdbe195c9daddda7229c65127f4a0d123587e62
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Tue Sep 8 17:16:56 2020 +0200

    refactored
---
 .../DefaultFaceletsStateManagementStrategy.java    | 23 ++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java b/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
index 09d377c..80b584f 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
@@ -466,16 +466,20 @@ public class DefaultFaceletsStateManagementStrategy extends StateManagementStrat
         List<String> clientIdsAdded = getClientIdsAdded(view);
         if (clientIdsAdded != null)
         {
-            Set<String> idsAddedSet = new HashSet<>(HashMapUtils.calcCapacity(clientIdsAdded.size()));
-            
-            AddComponentCallback addCallback = null;
-            
-            // perf: clientIds are ArrayList: see method setClientsIdsAdded(String)
-            for (int i = 0, size = clientIdsAdded.size(); i < size; i++)
+            if (!clientIdsAdded.isEmpty())
             {
-                String clientId = clientIdsAdded.get(i);
-                if (!idsAddedSet.contains(clientId))
+                Set<String> idsAddedSet = new HashSet<>(HashMapUtils.calcCapacity(clientIdsAdded.size()));
+                AddComponentCallback addCallback = null;
+
+                // perf: clientIds are ArrayList: see method setClientsIdsAdded(String)
+                for (int i = 0, size = clientIdsAdded.size(); i < size; i++)
                 {
+                    String clientId = clientIdsAdded.get(i);
+                    if (idsAddedSet.contains(clientId))
+                    {
+                        continue;
+                    }
+
                     final AttachedFullStateWrapper wrapper = (AttachedFullStateWrapper) states.get(clientId);
                     if (wrapper != null)
                     {
@@ -484,8 +488,7 @@ public class DefaultFaceletsStateManagementStrategy extends StateManagementStrat
                         {
                             if (addedState.length == 2)
                             {
-                                view = (UIViewRoot)
-                                        internalRestoreTreeStructure((TreeStructComponent) addedState[0]);
+                                view = (UIViewRoot) internalRestoreTreeStructure((TreeStructComponent) addedState[0]);
                                 view.processRestoreState(context, addedState[1]);
                                 break;
                             }