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/02/03 17:11:41 UTC

[myfaces] 01/01: MYFACES-4550 clean up

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

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

commit dbcfd9c6c5df7eefdd2eaea581efadbeb24f580e
Author: Volodymyr Siedlecki <vo...@gmail.com>
AuthorDate: Fri Feb 3 11:07:48 2023 -0500

    MYFACES-4550 clean up
---
 .../component/validate/ValidateWholeBeanComponent.java   | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java b/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java
index a69127ee9..1c0ff35d6 100644
--- a/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java
+++ b/impl/src/main/java/org/apache/myfaces/component/validate/ValidateWholeBeanComponent.java
@@ -66,7 +66,7 @@ public class ValidateWholeBeanComponent extends UIInput
     @Override
     public void encodeBegin(FacesContext context) throws IOException
     {    
-        // https://github.com/jakartaee/faces/issues/1780
+        // Developement check: https://github.com/jakartaee/faces/issues/1780
         if (context.isProjectStage(ProjectStage.Development)) 
         {
             // find closest form
@@ -86,16 +86,10 @@ public class ValidateWholeBeanComponent extends UIInput
      * As required by https://github.com/jakartaee/faces/issues/1
      * Also ensures all inputs are available for f:wholeBeanValidate processing
      * (otherwise they'd be empty during the validation)
-     * Inspired by Mojarra's UIValidateWholeBean#misplacedComponentCheck
-     * 1) Get all children of the form component
-     * 2) Loop in reverse thorough each child in the form
-     * 3) If we find an editable component (EditableValueHolder)
-     * and it's group validator matches f:wholeBeanValidate (this part is unique to
-     * myfaces) then throw an exception.
-     * 4) If we find the f:wholeBeanValidate's client id before any
-     * EditableValueHolder tags, return.
+     * Similar to a Recursive Non-Binary Tree Search, but checks if f:wholeBeanValidate 
+     * is before any EditableValueHolders (i.e inputs)
      */
-    public void validateTagPlacement(UIComponent component, String clientId) throws IllegalStateException
+    private void validateTagPlacement(UIComponent component, String clientId) throws IllegalStateException
     {
         List<UIComponent> children = component.getChildren();
     
@@ -122,7 +116,7 @@ public class ValidateWholeBeanComponent extends UIInput
               }
               else
               {
-                  validateTagPlacement(c, clientId);
+                  validateTagPlacement(c, clientId); // continue again 
               }
           }
         }