You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/09/10 00:04:23 UTC

svn commit: r279891 - in /jakarta/tapestry/trunk: framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java status.xml

Author: hlship
Date: Fri Sep  9 15:04:19 2005
New Revision: 279891

URL: http://svn.apache.org/viewcvs?rev=279891&view=rev
Log:
TAPESTRY-556: Literal bindings in template override bindings in specification for the same informal parameter

Modified:
    jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java
    jakarta/tapestry/trunk/status.xml

Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java?rev=279891&r1=279890&r2=279891&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java Fri Sep  9 15:04:19 2005
@@ -344,61 +344,64 @@
         // TODO: This is ugly! Need a better/smarter way, even if we have to extend BindingSource
         // to tell us.
 
-        boolean literal = binding instanceof LiteralBinding;
+        boolean isLiteral = binding instanceof LiteralBinding;
+        boolean isBound = component.getBinding(name) != null;
+        boolean isFormal = spec.getParameter(name) != null;
 
-        boolean isFormal = (spec.getParameter(name) != null);
-
-        if (isFormal)
+        if (!isFormal)
         {
-            if (component.getBinding(name) != null)
+            if (!spec.getAllowInformalParameters())
             {
-                // Literal bindings in the template that conflict with bound parameters
-                // from the spec are silently ignored.
+                // Again; if informal parameters are disallowed, ignore literal bindings, as they
+                // are there as placeholders or for WYSIWYG.
 
-                if (literal)
+                if (isLiteral)
                     return false;
 
-                throw new ApplicationRuntimeException(ImplMessages.dupeTemplateBinding(
-                        name,
-                        component,
-                        _loadComponent), component, binding.getLocation(), null);
+                throw new ApplicationRuntimeException(ImplMessages
+                        .templateBindingForInformalParameter(_loadComponent, name, component),
+                        component, binding.getLocation(), null);
             }
 
-            return true;
-        }
+            // If the name is reserved (matches a formal parameter
+            // or reserved name, caselessly), then skip it.
 
-        if (!spec.getAllowInformalParameters())
-        {
-            // Again; if informal parameters are disallowed, ignore literal bindings, as they
-            // are there as placeholders or for WYSIWYG.
+            if (spec.isReservedParameterName(name))
+            {
+                // Final case for literals: if they conflict with a reserved name, they are ignored.
+                // Again, there for WYSIWYG.
 
-            if (literal)
-                return false;
+                if (isLiteral)
+                    return false;
 
-            throw new ApplicationRuntimeException(ImplMessages.templateBindingForInformalParameter(
-                    _loadComponent,
-                    name,
-                    component), component, binding.getLocation(), null);
+                throw new ApplicationRuntimeException(ImplMessages
+                        .templateBindingForReservedParameter(_loadComponent, name, component),
+                        component, binding.getLocation(), null);
+            }
         }
 
-        // If the name is reserved (matches a formal parameter
-        // or reserved name, caselessly), then skip it.
+        // So, at this point it doesn't matter if the parameter is a formal parameter or
+        // an informal parameter. The binding (if any) in the specification takes precendence
+        // over the template. Literal bindings that conflict are considered to be there for WYSIWYG
+        // purposes. Non-literal bindings that conflict with a specification binding are an
+        // error.
 
-        if (spec.isReservedParameterName(name))
+        if (isBound)
         {
-            // Final case for literals: if they conflict with a reserved name, they are ignored.
-            // Again, there for WYSIWYG.
+            // Literal bindings in the template that conflict with bound parameters
+            // from the spec are silently ignored.
 
-            if (literal)
+            if (isLiteral)
                 return false;
 
-            throw new ApplicationRuntimeException(ImplMessages.templateBindingForReservedParameter(
-                    _loadComponent,
+            throw new ApplicationRuntimeException(ImplMessages.dupeTemplateBinding(
                     name,
-                    component), component, binding.getLocation(), null);
+                    component,
+                    _loadComponent), component, binding.getLocation(), null);
         }
 
         return true;
+
     }
 
     private void checkAllComponentsReferenced()

Modified: jakarta/tapestry/trunk/status.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/status.xml?rev=279891&r1=279890&r2=279891&view=diff
==============================================================================
--- jakarta/tapestry/trunk/status.xml (original)
+++ jakarta/tapestry/trunk/status.xml Fri Sep  9 15:04:19 2005
@@ -54,7 +54,8 @@
       <action type="fix" dev="HLS" fixes-bug="TAPESTRY-341">Report location of errors initializing managed beans</action>
       <action type="fix" dev="HLS" fixes-bug="TAPESTRY-270" due-to="Andy Hedges">FAQ Code example contains bug</action>
       <action type="fix" dev="HLS" fixes-bug="TAPESTRY-583">Spurious ERROR message (probably should be WARN or INFO) when template does not refer to components in page spec</action>
-      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-535">Colons in an OGNL expression may force it to be intepreted as a literal string, not an expression</action>   
+      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-535">Colons in an OGNL expression may force it to be intepreted as a literal string, not an expression</action>
+      <action type="fix" dev="HLS" fixes-bug="TAPESTRY-556">Literal bindings in template override bindings in specification for the same informal parameter</action>   
     </release>
     <release version="4.0-beta-6" date="Sep 7 2005">
       <action type="update" dev="HLS" due-to="Henri Yandell">Convert Tapestry repository from CVS to SVN</action>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org