You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/11/21 00:06:08 UTC

svn commit: r477389 - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/components/Any.java scripts/TestLibrary.xml scripts/TestLocalization.xml test/org/apache/tapestry/components/TestAny.java

Author: jkuhnert
Date: Mon Nov 20 15:06:08 2006
New Revision: 477389

URL: http://svn.apache.org/viewvc?view=rev&rev=477389
Log:
Fixes TAPESTRY-245. Any component now checks if it has any body content at all and appropriately
invokes writer.beginEmpty() if it doesn't.

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Any.java
    tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLibrary.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLocalization.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestAny.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Any.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Any.java?view=diff&rev=477389&r1=477388&r2=477389
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Any.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Any.java Mon Nov 20 15:06:08 2006
@@ -35,12 +35,15 @@
         if (element == null)
             throw new ApplicationRuntimeException(ComponentMessages.anyElementNotDefined(), this,
                     null, null);
-
+        
         boolean rewinding = cycle.isRewinding();
-
+        
         if (!rewinding)
         {
-            writer.begin(element);
+            if (getBodyCount() > 0)
+                writer.begin(element);
+            else
+                writer.beginEmpty(element);
             
             renderInformalParameters(writer, cycle);
             if (getId() != null && !isParameterBound("id"))
@@ -49,9 +52,9 @@
         
         renderBody(writer, cycle);
         
-        if (!rewinding)
+        if (!rewinding && getBodyCount() > 0)
         {
-            writer.end(element);
+            writer.end();
         }
 
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLibrary.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLibrary.xml?view=diff&rev=477389&r1=477388&r2=477389
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLibrary.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLibrary.xml Mon Nov 20 15:06:08 2006
@@ -72,7 +72,6 @@
 			 wouldn't interfere with each other.  -->
 			 
 		<match>foo</match>
-		<match>/foo</match>
 		
 		<match>/body</match>
 		<match>/html</match>		

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLocalization.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLocalization.xml?view=diff&rev=477389&r1=477388&r2=477389
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLocalization.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/scripts/TestLocalization.xml Mon Nov 20 15:06:08 2006
@@ -36,7 +36,7 @@
 		
 		<assert-output name="English Foo-Bar">
 <![CDATA[
-<foo bar="Totally Screwed!" id="Any">
+<foo bar="Totally Screwed!" id="Any"/>
 ]]>	
 		</assert-output>
 	</request>		
@@ -53,7 +53,7 @@
 		
 		<assert-output name="French Foo-Bar">
 <![CDATA[
-<foo bar="Merde!" id="Any">
+<foo bar="Merde!" id="Any"/>
 ]]>	
 		</assert-output>
 		

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestAny.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestAny.java?view=diff&rev=477389&r1=477388&r2=477389
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestAny.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestAny.java Mon Nov 20 15:06:08 2006
@@ -80,7 +80,7 @@
         IRender body = newRender();
         body.render(writer, cycle);
 
-        writer.end("span");
+        writer.end();
         
         expect(cycle.renderStackPop()).andReturn(any);
         
@@ -110,7 +110,7 @@
 
         body.render(writer, cycle);
 
-        writer.end("span");
+        writer.end();
         
         expect(cycle.renderStackPop()).andReturn(any);