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/07/11 09:41:20 UTC

[myfaces] branch master updated (507cf6c -> a161593)

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 507cf6c  refactored
     new 084fa4f  cosmetics
     new a161593  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:
 .../compiler/CheckDuplicateIdFaceletUtils.java     | 53 ++++++++--------------
 .../myfaces/view/facelets/compiler/Compiler.java   | 21 ++-------
 .../compiler/RefreshDynamicComponentListener.java  | 17 +++----
 .../facelets/tag/jsf/html/DefaultTagDecorator.java |  2 +-
 .../tag/jstl/core/IndexedValueExpression.java      |  4 +-
 .../tag/jstl/core/IteratedValueExpression.java     |  2 -
 .../util/FaceletsTemplateMappingUtils.java         |  8 ++--
 7 files changed, 37 insertions(+), 70 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 a1615933e1790a4b2bde31909a6556ff82e29a30
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Thu Jul 11 11:41:13 2019 +0200

    cosmetics
---
 .../myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java   | 2 +-
 .../view/facelets/tag/jstl/core/IndexedValueExpression.java       | 4 +---
 .../view/facelets/tag/jstl/core/IteratedValueExpression.java      | 2 --
 .../myfaces/view/facelets/util/FaceletsTemplateMappingUtils.java  | 8 ++++----
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java
index 717558f..dd6f019 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/DefaultTagDecorator.java
@@ -322,7 +322,7 @@ public class DefaultTagDecorator implements TagDecorator
                 //convertedTagAttributes[j] = tagAttribute;
                 
                 convertedNamespace = PASS_THROUGH_NAMESPACE;
-                qname = "p:"+tagAttribute.getLocalName();
+                qname = "p:" + tagAttribute.getLocalName();
                 
                 convertedTagAttributes[j] = new TagAttributeImpl(tagAttribute.getLocation(), 
                     convertedNamespace, tagAttribute.getLocalName(), qname, tagAttribute.getValue());
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IndexedValueExpression.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IndexedValueExpression.java
index 1946ac3..da15452 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IndexedValueExpression.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IndexedValueExpression.java
@@ -27,16 +27,14 @@ import javax.el.ValueExpression;
  */
 public final class IndexedValueExpression extends ValueExpression
 {
-
     private static final long serialVersionUID = 1L;
 
     private final Integer i;
-
     private final ValueExpression orig;
 
     public IndexedValueExpression(ValueExpression orig, int i)
     {
-        this.i = Integer.valueOf(i);
+        this.i = i;
         this.orig = orig;
     }
 
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java
index ebe7dea..5fa34b4 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/core/IteratedValueExpression.java
@@ -27,11 +27,9 @@ import javax.el.ValueExpression;
  */
 public final class IteratedValueExpression extends ValueExpression
 {
-
     private static final long serialVersionUID = 1L;
 
     private ValueExpression orig;
-
     private Object value;
 
     public IteratedValueExpression(ValueExpression orig, Object value)
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/util/FaceletsTemplateMappingUtils.java b/impl/src/main/java/org/apache/myfaces/view/facelets/util/FaceletsTemplateMappingUtils.java
index 834b370..7272733 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/util/FaceletsTemplateMappingUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/util/FaceletsTemplateMappingUtils.java
@@ -18,19 +18,19 @@
  */
 package org.apache.myfaces.view.facelets.util;
 
+import java.util.List;
 import org.apache.myfaces.config.RuntimeConfig;
 import org.apache.myfaces.config.element.FaceletsTemplateMapping;
 import org.apache.myfaces.util.UrlPatternMatcher;
 
-/**
- *
- */
 public class FaceletsTemplateMappingUtils
 {
     public static final boolean matchTemplate(RuntimeConfig runtimeConfig, String path)
     {
-        for (FaceletsTemplateMapping mapping : runtimeConfig.getFaceletsTemplateMappings())
+        List<FaceletsTemplateMapping> mappings = runtimeConfig.getFaceletsTemplateMappings();
+        for (int i = 0; i < mappings.size(); i++)
         {
+            FaceletsTemplateMapping mapping = mappings.get(i);
             if (UrlPatternMatcher.match(path, mapping.getUrlPattern()))
             {
                 return true;


[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 084fa4f615908929a27be0457f4daf9968884182
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Thu Jul 11 11:27:27 2019 +0200

    cosmetics
---
 .../compiler/CheckDuplicateIdFaceletUtils.java     | 53 ++++++++--------------
 .../myfaces/view/facelets/compiler/Compiler.java   | 21 ++-------
 .../compiler/RefreshDynamicComponentListener.java  | 17 +++----
 3 files changed, 31 insertions(+), 60 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CheckDuplicateIdFaceletUtils.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CheckDuplicateIdFaceletUtils.java
index b8a26c2..0a2ebac 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CheckDuplicateIdFaceletUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/CheckDuplicateIdFaceletUtils.java
@@ -36,29 +36,24 @@ import org.apache.myfaces.util.ComponentUtils;
 public final class CheckDuplicateIdFaceletUtils
 {
     
-    public static void checkIdsStatefulComponents (FacesContext context, UIComponent view)
+    public static void checkIdsStatefulComponents(FacesContext context, UIComponent view)
     {
-        checkIdsStatefulComponents (context, view, new HashSet<String>());
+        checkIdsStatefulComponents(context, view, new HashSet<>());
     }
 
-    private static void checkIdsStatefulComponents (FacesContext context, 
-            UIComponent component, Set<String> existingIds)
+    private static void checkIdsStatefulComponents(FacesContext context, UIComponent component,
+            Set<String> existingIds)
     {
-        String id;
-        
         if (component == null)
         {
             return;
         }
-        
+
         // Need to use this form of the client ID method so we generate the client-side ID.
-        
-        id = component.getClientId (context);
-        
+        String id = component.getClientId(context);
         if (!existingIds.add (id))
         {
-            DuplicateIdException duplicateIdException = createAndQueueException(context, component, id);
-            throw duplicateIdException;
+            throw createAndQueueException(context, component, id);
         }
         
         int facetCount = component.getFacetCount();
@@ -84,40 +79,35 @@ public final class CheckDuplicateIdFaceletUtils
 
     public static void checkIds(FacesContext context, UIComponent view)
     {
-        checkIds (context, view, new HashSet<String>());
+        checkIds(context, view, new HashSet<>());
     }
     
     private static void checkIds(FacesContext context, UIComponent component, Set<String> existingIds)
     {
-        String id;
-        
         if (component == null)
         {
             return;
         }
-        
+
         // Need to use this form of the client ID method so we generate the client-side ID.
-        
-        id = component.getClientId (context);
-        
-        if (!existingIds.add (id))
+        String id = component.getClientId(context);
+        if (!existingIds.add(id))
         {
-            DuplicateIdException duplicateIdException = createAndQueueException(context, component, id);
-            throw duplicateIdException;
+            throw createAndQueueException(context, component, id);
         }
-        
+
         int facetCount = component.getFacetCount();
         if (facetCount > 0)
         {
             for (UIComponent facet : component.getFacets().values())
             {
-                checkIds (context, facet, existingIds);
+                checkIds(context, facet, existingIds);
             }
         }
         for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
         {
             UIComponent child = component.getChildren().get(i);
-            checkIds (context, child, existingIds);
+            checkIds(context, child, existingIds);
         }
     }
 
@@ -143,17 +133,14 @@ public final class CheckDuplicateIdFaceletUtils
             // doesn't come from Facelets VDL.
             message += ComponentUtils.getPathToComponent(firstComponent);
         }
-        
+
         // 2) we store the first commponent in exception attributes
-        DuplicateIdException duplicateIdException = new DuplicateIdException 
-                (message, firstComponent, component);
-        
-        ExceptionQueuedEventContext exceptionContext 
-        = new ExceptionQueuedEventContext(context, duplicateIdException,
-                component, context.getCurrentPhaseId());
+        DuplicateIdException duplicateIdException = new DuplicateIdException(message, firstComponent, component);
 
-        
+        ExceptionQueuedEventContext exceptionContext = new ExceptionQueuedEventContext(context, duplicateIdException,
+                component, context.getCurrentPhaseId());
         context.getApplication().publishEvent(context, ExceptionQueuedEvent.class, exceptionContext);
+
         return duplicateIdException;
     }
 }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/Compiler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/Compiler.java
index a10d807..1051d56 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/Compiler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/Compiler.java
@@ -61,24 +61,14 @@ public abstract class Compiler
     private static final TagLibrary EMPTY_LIBRARY = new CompositeTagLibrary(new TagLibrary[0]);
 
     private boolean validating = false;
-
     private boolean trimmingWhitespace = false;
-
     private boolean trimmingComments = false;
-
-    private final List<TagLibrary> libraries = new ArrayList<TagLibrary>();
-
-    private final List<TagDecorator> decorators = new ArrayList<TagDecorator>();
-
-    private final Map<String, String> features = new HashMap<String, String>();
-
+    private final List<TagLibrary> libraries = new ArrayList<>();
+    private final List<TagDecorator> decorators = new ArrayList<>();
+    private final Map<String, String> features = new HashMap<>();
     private boolean developmentProjectStage = false;
-
     private Collection<FaceletsProcessing> faceletsProcessingConfigurations;
 
-    /**
-     * 
-     */
     public Compiler()
     {
 
@@ -128,9 +118,9 @@ public abstract class Compiler
                 new CompositeTagDecorator(this.decorators.toArray(
                     new TagDecorator[this.decorators.size()])));
         }
+
         // JSF 2.2 has always enabled the default tag decorator.
         return new BaseTagDecorator(new DefaultTagDecorator());
-        //return EMPTY_DECORATOR;
     }
 
     public final void addTagDecorator(TagDecorator decorator)
@@ -144,8 +134,7 @@ public abstract class Compiler
 
     public final ExpressionFactory createExpressionFactory()
     {
-        ExpressionFactory el = null;
-        el = (ExpressionFactory) this.featureInstance(EXPRESSION_FACTORY);
+        ExpressionFactory el = (ExpressionFactory) this.featureInstance(EXPRESSION_FACTORY);
         if (el == null)
         {
             try
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java
index 08f2193..12b2a24 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/RefreshDynamicComponentListener.java
@@ -66,13 +66,7 @@ public final class RefreshDynamicComponentListener implements
     public void processEvent(ComponentSystemEvent event)
     {
         FacesContext facesContext = FacesContext.getCurrentInstance();
-        //if (!PhaseId.RESTORE_VIEW.equals(facesContext.getCurrentPhaseId()))
-        //{
-            // This listener is only active when PostAddToViewEvent occur
-            // on restore view phase. 
-            //return;
-        //}
-        
+
         FaceletViewDeclarationLanguage vdl = (FaceletViewDeclarationLanguage) 
             facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
                 facesContext, facesContext.getViewRoot().getViewId());
@@ -161,9 +155,10 @@ public final class RefreshDynamicComponentListener implements
     @Override
     public Object saveState(FacesContext context)
     {
-        RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(
-            context.getExternalContext());
+        RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(context);
+
         Object[] values = new Object[4];
+
         Integer tagId = runtimeConfig.getIdByNamespace().get(taglibURI);
         if (tagId != null)
         {
@@ -184,6 +179,7 @@ public final class RefreshDynamicComponentListener implements
         values[1] = tagName;
         values[2] = attributes;
         values[3] = baseKey;
+
         return values;
     }
 
@@ -197,8 +193,7 @@ public final class RefreshDynamicComponentListener implements
         }
         else if (values[0] instanceof Integer)
         {
-            RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(
-                context.getExternalContext());
+            RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(context);
             taglibURI = runtimeConfig.getNamespaceById().get((Integer)values[0]);
         }
         else if (values[0] instanceof Object[])