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 2019/08/02 09:45:21 UTC

[myfaces] branch master updated (30588f4 -> 30efb69)

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

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


    from 30588f4  cosmetics
     new f955a3b  cosmetics
     new 30efb69  cosmetics

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../myfaces/view/facelets/tag/MetaRulesetImpl.java | 23 +++++-----------------
 .../myfaces/view/facelets/tag/TagHandlerUtils.java |  2 +-
 .../myfaces/view/facelets/tag/UserTagHandler.java  |  3 ++-
 .../tag/composite/AttachedObjectTargetImpl.java    |  5 ++---
 .../CompositeComponentPropertyDescriptor.java      |  2 +-
 .../facelets/tag/composite/InsertFacetHandler.java |  1 -
 .../tag/jsf/ComponentTagHandlerDelegate.java       | 23 ++++++++++------------
 7 files changed, 21 insertions(+), 38 deletions(-)


[myfaces] 02/02: cosmetics

Posted by ta...@apache.org.
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

commit 30efb69367fe74fe3354727e3869783a8788a247
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri Aug 2 11:43:46 2019 +0200

    cosmetics
---
 .../apache/myfaces/view/facelets/tag/UserTagHandler.java    |  3 ++-
 .../facelets/tag/composite/AttachedObjectTargetImpl.java    |  5 ++---
 .../tag/composite/CompositeComponentPropertyDescriptor.java |  2 +-
 .../view/facelets/tag/composite/InsertFacetHandler.java     |  1 -
 .../view/facelets/tag/jsf/ComponentTagHandlerDelegate.java  | 13 ++++++++-----
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java
index 99f74a7..c82c0d6 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java
@@ -116,6 +116,7 @@ final class UserTagHandler extends TagHandler implements TemplateClient, Compone
             }
             actx.pushTemplateContext(new TemplateContextImpl());
             actx.pushClient(this);
+
             FaceletCompositionContext fcc = FaceletCompositionContext.getCurrentInstance(ctx);
             String uniqueId = fcc.startComponentUniqueIdSection();
             try
@@ -127,7 +128,6 @@ final class UserTagHandler extends TagHandler implements TemplateClient, Compone
                         FaceletState faceletState = ComponentSupport.getFaceletState(ctx, parent, true);
                         for (int i = 0; i < this._vars.length; i++)
                         {
-                            //((AbstractFaceletContext) ctx).getTemplateContext().setParameter(names[i], values[i]);
                             faceletState.putBinding(uniqueId, names[i], values[i]);
                             ValueExpression ve = new FaceletStateValueExpression(uniqueId, names[i]);
                             actx.getTemplateContext().setParameter(names[i], ve);
@@ -141,6 +141,7 @@ final class UserTagHandler extends TagHandler implements TemplateClient, Compone
                         }
                     }
                 }
+
                 // Disable caching always, even in 'always' mode
                 // The only mode that can support EL caching in this condition is alwaysRedirect.
                 if (!ELExpressionCacheMode.alwaysRecompile.equals(actx.getELExpressionCacheMode()))
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetImpl.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetImpl.java
index 2b0a59c..c4cc65c 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetImpl.java
@@ -40,7 +40,6 @@ public class AttachedObjectTargetImpl implements AttachedObjectTarget, Serializa
     private static final long serialVersionUID = -7214478234269252354L;
     
     protected ValueExpression _name;
-    
     protected ValueExpression _targets;
 
     public AttachedObjectTargetImpl()
@@ -65,7 +64,7 @@ public class AttachedObjectTargetImpl implements AttachedObjectTarget, Serializa
         
         if (targetsArray.length > 0)
         {
-            List<UIComponent> targetsList = new ArrayList<UIComponent>(targetsArray.length);
+            List<UIComponent> targetsList = new ArrayList<>(targetsArray.length);
             final char separatorChar = facesContext.getNamingContainerSeparatorChar();
             UIComponent facetBase = topLevelComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME);
             for (String target : targetsArray)
@@ -106,7 +105,7 @@ public class AttachedObjectTargetImpl implements AttachedObjectTarget, Serializa
                         name, null);
                 if (innerComponent != null)
                 {
-                    List<UIComponent> targetsList = new ArrayList<UIComponent>(1);
+                    List<UIComponent> targetsList = new ArrayList<>(1);
                     targetsList.add(innerComponent);
                     return targetsList;
                 }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentPropertyDescriptor.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentPropertyDescriptor.java
index 1a92ef4..8d705cb 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentPropertyDescriptor.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentPropertyDescriptor.java
@@ -83,7 +83,7 @@ public class CompositeComponentPropertyDescriptor extends PropertyDescriptor
         
         // Properties that comes here are targets, default, required,
         // method-signature and type.
-        Map<String,Object> map = new HashMap<String, Object>(6,1);
+        Map<String,Object> map = new HashMap<>(6,1);
         
         for (Enumeration<String> e = attributeNames(); e.hasMoreElements();)
         {
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
index 6bd1c18..7bf9e3b 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
@@ -143,7 +143,6 @@ public class InsertFacetHandler extends TagHandler
             String facetName = _name.getValue(ctx);
             
             AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
-            
             actx.includeCompositeComponentDefinition(parent, facetName);
         }
         
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
index 0396b7e..0034385 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
@@ -236,6 +236,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
                 }
             }
         }
+
         boolean componentFound = false;
         if (c != null)
         {
@@ -284,8 +285,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
 
             if (facesContext.isProjectStage(ProjectStage.Development))
             {
-                c.getAttributes().put(UIComponent.VIEW_LOCATION_KEY,
-                        _delegate.getTag().getLocation());
+                c.getAttributes().put(UIComponent.VIEW_LOCATION_KEY, _delegate.getTag().getLocation());
             }
 
             // assign our unique id
@@ -330,8 +330,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
             if (_relocatableResourceHandler != null && 
                 _relocatableResourceHandler instanceof ComponentRelocatableResourceHandler)
             {
-                UIComponent parentCompositeComponent
-                        = mctx.getCompositeComponentFromStack();
+                UIComponent parentCompositeComponent = mctx.getCompositeComponentFromStack();
                 if (parentCompositeComponent != null)
                 {
                     c.getAttributes().put(CompositeComponentELUtils.LOCATION_KEY,
@@ -391,6 +390,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
                 }
                 ComponentSupport.setCachedFacesContext(c, facesContext);
             }
+            
             if (facetName == null)
             {
                 parent.getChildren().remove(c);
@@ -399,6 +399,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
             {
                 ComponentSupport.removeFacet(ctx, parent, c, facetName);
             }
+            
             if (mctx.isRefreshingSection())
             {
                 ComponentSupport.setCachedFacesContext(c, null);
@@ -406,7 +407,6 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
             }
         }
 
-
         if (!componentFound)
         {
             if (c instanceof ClientBehaviorHolder && !UIComponent.isCompositeComponent(c))
@@ -438,6 +438,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
                 facesContext.setProcessingEvents(false);
                 ComponentSupport.setCachedFacesContext(c, facesContext);
             }
+            
             if (facetName == null)
             {
                 parent.getChildren().add(c);
@@ -446,6 +447,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
             {
                 ComponentSupport.addFacet(ctx, parent, c, facetName);
             }
+            
             if (componentFound && mctx.isRefreshingSection())
             {
                 ComponentSupport.setCachedFacesContext(c, null);
@@ -667,6 +669,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
                 addEnclosingValidator(context, component, entry.getKey(), entry.getValue());
             }
         }
+        
         // add all defaultValidators
         Map<String, String> defaultValidators = context.getApplication().getDefaultValidatorInfo();
         if (defaultValidators != null && !defaultValidators.isEmpty())


[myfaces] 01/02: cosmetics

Posted by ta...@apache.org.
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

commit f955a3b7a266b8d8abb1c1c73952f1a63a76133f
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Fri Aug 2 10:54:57 2019 +0200

    cosmetics
---
 .../myfaces/view/facelets/tag/MetaRulesetImpl.java | 23 +++++-----------------
 .../myfaces/view/facelets/tag/TagHandlerUtils.java |  2 +-
 .../tag/jsf/ComponentTagHandlerDelegate.java       | 10 ++--------
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java
index 50fae73..13d9e32 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/MetaRulesetImpl.java
@@ -46,8 +46,6 @@ import org.apache.myfaces.view.facelets.tag.jsf.PassThroughLibrary;
  */
 public final class MetaRulesetImpl extends MetaRuleset
 {
-    private final static Metadata NONE = new NullMetadata();
-
     private final static Logger log = Logger.getLogger(MetaRulesetImpl.class.getName());
 
     /**
@@ -83,23 +81,13 @@ public final class MetaRulesetImpl extends MetaRuleset
             // per classloader to hold metadata.
             synchronized (MetaRulesetImpl.metadata)
             {
-                metadata = createMetaData(cl, metadata);
+                metadata = MetaRulesetImpl.metadata.computeIfAbsent(cl,
+                    k -> new HashMap<>());
             }
         }
 
         return metadata;
     }
-    
-    private static Map<String, MetadataTarget> createMetaData(ClassLoader cl, Map<String, MetadataTarget> metadata)
-    {
-        metadata = (Map<String, MetadataTarget>) MetaRulesetImpl.metadata.get(cl);
-        if (metadata == null)
-        {
-            metadata = new HashMap<String, MetadataTarget>();
-            MetaRulesetImpl.metadata.put(cl, metadata);
-        }
-        return metadata;
-    }
 
     private final static TagAttribute[] EMPTY = new TagAttribute[0];
     
@@ -301,7 +289,7 @@ public final class MetaRulesetImpl extends MetaRuleset
 
         if (_mappers.isEmpty())
         {
-            return NONE;
+            return NullMetadata.INSTANCE;
         }
         else
         {
@@ -360,9 +348,8 @@ public final class MetaRulesetImpl extends MetaRuleset
 
     private static class NullMetadata extends Metadata
     {
-        /**
-         * {@inheritDoc}
-         */
+        public static final NullMetadata INSTANCE = new NullMetadata();
+        
         @Override
         public void applyMetadata(FaceletContext ctx, Object instance)
         {
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagHandlerUtils.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagHandlerUtils.java
index c41eced..c758b29 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagHandlerUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagHandlerUtils.java
@@ -133,7 +133,7 @@ public final class TagHandlerUtils
 
     public static ArrayList<FaceletHandler> findNextByType(FaceletHandler nextHandler, Class<?> type1, Class<?> type2)
     {
-        ArrayList<FaceletHandler> found = new ArrayList<FaceletHandler>();
+        ArrayList<FaceletHandler> found = new ArrayList<>();
         if (type1.isAssignableFrom(nextHandler.getClass()) || type2.isAssignableFrom(nextHandler.getClass()))
         {
             found.add((FaceletHandler)nextHandler);
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
index 2502bfa..0396b7e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
@@ -84,15 +84,10 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
     private final static Logger log = Logger.getLogger(ComponentTagHandlerDelegate.class.getName());
 
     private final ComponentHandler _delegate;
-
     private final String _componentType;
-
     private final TagAttribute _id;
-
     private final String _rendererType;
-    
     private final ComponentBuilderHandler _componentBuilderHandlerDelegate;
-    
     private final RelocatableResourceHandler _relocatableResourceHandler;
 
     @SuppressWarnings("unchecked")
@@ -780,8 +775,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
                                               String validatorId)
     {
         // check if the validatorId is on the exclusion list on the component
-        List<String> exclusionList 
-                = (List<String>) ((UIComponent) component).getAttributes()
+        List<String> exclusionList = (List<String>) ((UIComponent) component).getAttributes()
                         .get(ValidatorTagHandlerDelegate.VALIDATOR_ID_EXCLUSION_LIST_KEY);
         if (exclusionList != null)
         {
@@ -804,7 +798,7 @@ public class ComponentTagHandlerDelegate extends TagHandlerDelegate
                 boolean validatorIdAvailable = entry.getKey() != null && !entry.getKey().isEmpty();
                 if (validatorIdAvailable && entry.getKey().equals(validatorId))
                 {
-                    if (((ValidatorHandler)((FacesWrapper<ValidatorHandler>)entry.getValue()).getWrapped())
+                    if (((ValidatorHandler) ((FacesWrapper<ValidatorHandler>) entry.getValue()).getWrapped())
                             .isDisabled(ctx))
                     {
                         return false;