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 2022/06/27 07:12:40 UTC

[myfaces] 01/01: Revert "Reuse expression and avoid duplicate code.Easier to maintain. (#280)"

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

tandraschko pushed a commit to branch revert-280-feature/duplicate-code
in repository https://gitbox.apache.org/repos/asf/myfaces.git

commit ac80444b7bdb189ff947c0f14eca37dbdda7aa9e
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Mon Jun 27 09:12:36 2022 +0200

    Revert "Reuse expression and avoid duplicate code.Easier to maintain. (#280)"
    
    This reverts commit 6e995af7c0506d0fdcb1f09ba53293b5f38f8b10.
---
 .../config/DefaultFacesConfigurationProvider.java  |  6 ++++--
 .../view/facelets/compiler/SAXCompiler.java        | 24 ++++++++++++----------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java b/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
index 17dcf9c11..955e93972 100644
--- a/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
+++ b/impl/src/main/java/org/apache/myfaces/config/DefaultFacesConfigurationProvider.java
@@ -659,7 +659,6 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
             }
             String flowName = systemId.substring(systemId.lastIndexOf('/')+1, systemId.lastIndexOf("-flow.xml"));
             int c = pbstream.read();
-            final String startNodePath = systemId.substring(0, systemId.lastIndexOf('/') + 1) + flowName + ".xhtml";
             if (c != -1)
             {
                 pbstream.unread(c);
@@ -674,7 +673,8 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
                 flow.setId(flowName);
                 // In this case the defining document id is implicit associated
                 flow.setDefiningDocumentId(systemId);
-
+                
+                String startNodePath = systemId.substring(0, systemId.lastIndexOf('/')+1)+flowName+".xhtml";
                 flow.setStartNode(startNodePath);
                 
                 // There is a default return node with name [flow-name]-return and 
@@ -705,6 +705,8 @@ public class DefaultFacesConfigurationProvider extends FacesConfigurationProvide
                     FacesFlowDefinitionImpl flow = (FacesFlowDefinitionImpl) definition;
                     if (flow.getStartNode() == null)
                     {
+                        String startNodePath = systemId.substring(0, 
+                            systemId.lastIndexOf('/')+1)+flowName+".xhtml";
                         flow.setStartNode(startNodePath);
                     }
                 }
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java
index 1f0092239..5eb99ade9 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/SAXCompiler.java
@@ -631,15 +631,14 @@ public final class SAXCompiler extends Compiler
         @Override
         public void endElement(String uri, String localName, String qName) throws SAXException
         {
-            final boolean hasNameSpace = CompositeLibrary.NAMESPACE.equals(uri)
-                    || CompositeLibrary.JCP_NAMESPACE.equals(uri)
-                    || CompositeLibrary.SUN_NAMESPACE.equals(uri);
             if (inCompositeInterface)
             {
                 this.unit.popTag();
             }
-            else if (inCompositeImplementation &&
-                    hasNameSpace)
+            else if (inCompositeImplementation && 
+                (CompositeLibrary.NAMESPACE.equals(uri)
+                    || CompositeLibrary.JCP_NAMESPACE.equals(uri)
+                    || CompositeLibrary.SUN_NAMESPACE.equals(uri)))
             {
                 if ("insertFacet".equals(localName) ||
                     "renderFacet".equals(localName) ||
@@ -650,7 +649,9 @@ public final class SAXCompiler extends Compiler
                 }
             }
             
-            if (hasNameSpace)
+            if (CompositeLibrary.NAMESPACE.equals(uri)
+                    || CompositeLibrary.JCP_NAMESPACE.equals(uri)
+                    || CompositeLibrary.SUN_NAMESPACE.equals(uri))
             {
                 if (InterfaceHandler.NAME.equals(localName))
                 {
@@ -745,10 +746,9 @@ public final class SAXCompiler extends Compiler
         @Override
         public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
         {
-            final boolean nameSpace = CompositeLibrary.NAMESPACE.equals(uri)
+            if (CompositeLibrary.NAMESPACE.equals(uri)
                     || CompositeLibrary.JCP_NAMESPACE.equals(uri)
-                    || CompositeLibrary.SUN_NAMESPACE.equals(uri);
-            if (nameSpace)
+                    || CompositeLibrary.SUN_NAMESPACE.equals(uri))
             {
                 if (InterfaceHandler.NAME.equals(localName))
                 {
@@ -764,8 +764,10 @@ public final class SAXCompiler extends Compiler
             {
                 this.unit.pushTag(new Tag(createLocation(), uri, localName, qName, createAttributes(attributes)));
             }
-            else if (inCompositeImplementation &&
-                    (nameSpace))
+            else if (inCompositeImplementation && 
+                (CompositeLibrary.NAMESPACE.equals(uri)
+                    || CompositeLibrary.JCP_NAMESPACE.equals(uri)
+                    || CompositeLibrary.SUN_NAMESPACE.equals(uri)))
             {
                 if ("insertFacet".equals(localName)    ||
                     "renderFacet".equals(localName)    ||