refactored
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
index 15f2f6a..f76e36e 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DecorateHandler.java
@@ -39,6 +39,7 @@
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.util.lang.StringUtils;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.TemplateClient;
@@ -156,7 +157,7 @@
                     if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                     {
                         path = this._template.getValue(ctx);
-                        if (path == null || path.isEmpty())
+                        if (StringUtils.isBlank(path))
                         {
                             return;
                         }
@@ -204,8 +205,7 @@
                         //unset markInitialState flag
                         if (isBuildingInitialState == null)
                         {
-                            ctx.getFacesContext().getAttributes().remove(
-                                    StateManager.IS_BUILDING_INITIAL_STATE);
+                            ctx.getFacesContext().getAttributes().remove(StateManager.IS_BUILDING_INITIAL_STATE);
                         }
                         else
                         {
@@ -226,18 +226,20 @@
             if (!_template.isLiteral())
             {
                 fcc.endComponentUniqueIdSection();
+                
+                if (fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
+                        && !fcc.isRefreshingTransientBuild())
+                {
+                    //Mark the parent component to be saved and restored fully.
+                    ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
+                }
+                if (fcc.isDynamicComponentSection())
+                {
+                    ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
+                }
             }
         }
-        if (!_template.isLiteral() && fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()
-                && !fcc.isRefreshingTransientBuild())
-        {
-            //Mark the parent component to be saved and restored fully.
-            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
-        }
-        if (!_template.isLiteral() && fcc.isDynamicComponentSection())
-        {
-            ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);
-        }
+
     }
 
     @Override
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
index 148d0a8..4d4079a 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
@@ -39,6 +39,7 @@
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
 import org.apache.myfaces.util.lang.ClassUtils;
+import org.apache.myfaces.util.lang.StringUtils;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
@@ -126,7 +127,7 @@
                 if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                 {
                     path = this.src.getValue(ctx);
-                    if (path == null || path.length() == 0)
+                    if (StringUtils.isBlank(path))
                     {
                         return;
                     }
@@ -153,7 +154,7 @@
         }
         try
         {
-            if (path == null || path.length() == 0)
+            if (StringUtils.isBlank(path))
             {
                 return;
             }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
index f70d0d3..631d8e6 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/InsertHandler.java
@@ -19,6 +19,7 @@
 package org.apache.myfaces.view.facelets.tag.ui;
 
 import java.io.IOException;
+import java.util.Objects;
 
 import javax.el.ELException;
 import javax.faces.FacesException;
@@ -86,6 +87,7 @@
     {
         AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
         actx.extendClient(this);
+
         boolean found = false;
         try
         {
@@ -105,11 +107,12 @@
     public boolean apply(FaceletContext ctx, UIComponent parent, String name) throws IOException, FacesException,
             FaceletException, ELException
     {
-        if (this.name == name || this.name != null && this.name.equals(name))
+        if (Objects.equals(this.name, name))
         {
             this.nextHandler.apply(ctx, parent);
             return true;
         }
+
         return false;
     }
 }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java
index 3e03746..39b2c1a 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyDecorateHandler.java
@@ -36,6 +36,7 @@
 import javax.faces.view.facelets.TagAttribute;

 import javax.faces.view.facelets.TagConfig;

 import javax.faces.view.facelets.TagHandler;

+import org.apache.myfaces.util.lang.StringUtils;

 import org.apache.myfaces.view.facelets.AbstractFaceletContext;

 import org.apache.myfaces.view.facelets.FaceletCompositionContext;

 import org.apache.myfaces.view.facelets.TemplateClient;

@@ -148,7 +149,7 @@
                 if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))

                 {

                     path = this._template.getValue(ctx);

-                    if (path == null || path.length() == 0)

+                    if (StringUtils.isBlank(path))

                     {

                         return;

                     }

@@ -198,8 +199,7 @@
                         //unset markInitialState flag

                         if (isBuildingInitialState == null)

                         {

-                            ctx.getFacesContext().getAttributes().remove(

-                                    StateManager.IS_BUILDING_INITIAL_STATE);

+                            ctx.getFacesContext().getAttributes().remove(StateManager.IS_BUILDING_INITIAL_STATE);

                         }

                         else

                         {

@@ -221,18 +221,19 @@
             if (!_template.isLiteral())

             {

                 fcc.endComponentUniqueIdSection();

+                

+                if (fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()

+                        && !fcc.isRefreshingTransientBuild())

+                {

+                    //Mark the parent component to be saved and restored fully.

+                    ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);

+                }

+                if (fcc.isDynamicComponentSection())

+                {

+                    ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);

+                }

             }

         }

-        if (!_template.isLiteral() && fcc.isUsingPSSOnThisView() && fcc.isRefreshTransientBuildOnPSS()

-                && !fcc.isRefreshingTransientBuild())

-        {

-            //Mark the parent component to be saved and restored fully.

-            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);

-        }

-        if (!_template.isLiteral() && fcc.isDynamicComponentSection())

-        {

-            ComponentSupport.markComponentToRefreshDynamically(ctx.getFacesContext(), parent);

-        }

     }

 

     @Override

diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
index 5e9fed5..95071c0 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/LegacyIncludeHandler.java
@@ -36,6 +36,7 @@
 import javax.faces.view.facelets.TagHandler;
 
 import org.apache.myfaces.util.lang.ClassUtils;
+import org.apache.myfaces.util.lang.StringUtils;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
@@ -116,7 +117,7 @@
                 if (!PhaseId.RESTORE_VIEW.equals(ctx.getFacesContext().getCurrentPhaseId()))
                 {
                     path = this.src.getValue(ctx);
-                    if (path == null || path.length() == 0)
+                    if (StringUtils.isBlank(path))
                     {
                         return;
                     }
@@ -143,7 +144,7 @@
         }
         try
         {
-            if (path == null || path.length() == 0)
+            if (StringUtils.isBlank(path))
             {
                 return;
             }