Author: musachy
Date: Fri May 23 14:11:36 2008
New Revision: 659661

URL: http://svn.apache.org/viewvc?rev=659661&view=rev
Log:
WW-2225 Check for null error and messages on templates

Modified:
    struts/struts2/trunk/core/src/main/resources/template/simple/actionerror.ftl
    
struts/struts2/trunk/core/src/main/resources/template/simple/actionmessage.ftl
    
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java
    
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java

Modified: 
struts/struts2/trunk/core/src/main/resources/template/simple/actionerror.ftl
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/actionerror.ftl?rev=659661&r1=659660&r2=659661&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/template/simple/actionerror.ftl 
(original)
+++ 
struts/struts2/trunk/core/src/main/resources/template/simple/actionerror.ftl 
Fri May 23 14:11:36 2008
@@ -32,7 +32,7 @@
 <#if parameters.cssStyle?exists>
  style="${parameters.cssStyle?html}"<#rt/>
 </#if>
->${error}</span></li>
+>${error!}</span></li>
        </#list>
        </ul>
 </#if>
\ No newline at end of file

Modified: 
struts/struts2/trunk/core/src/main/resources/template/simple/actionmessage.ftl
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/actionmessage.ftl?rev=659661&r1=659660&r2=659661&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/template/simple/actionmessage.ftl 
(original)
+++ 
struts/struts2/trunk/core/src/main/resources/template/simple/actionmessage.ftl 
Fri May 23 14:11:36 2008
@@ -32,7 +32,7 @@
 <#if parameters.cssStyle?exists>
  style="${parameters.cssStyle?html}"<#rt/>
 </#if>
->${message}</span></li>
+>${message!}</span></li>
                </#list>
        </ul>
 </#if>
\ No newline at end of file

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java?rev=659661&r1=659660&r2=659661&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java
 Fri May 23 14:11:36 2008
@@ -61,6 +61,18 @@
         verify(ActionErrorTagTest.class.getResource("actionerror-2.txt"));
     }
 
+    public void testNullError() throws Exception {
+
+        ActionErrorTag tag = new ActionErrorTag();
+        ((InternalActionSupport)action).setHasActionErrors(true);
+        ((InternalActionSupport)action).addActionError(null);
+        tag.setPageContext(pageContext);
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(ActionErrorTagTest.class.getResource("actionerror-2.txt"));
+    }
+
 
     public Action getAction() {
         return new InternalActionSupport();

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java?rev=659661&r1=659660&r2=659661&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java
 Fri May 23 14:11:36 2008
@@ -59,6 +59,18 @@
         verify(ActionMessageTagTest.class.getResource("actionmessage-2.txt"));
     }
 
+    public void testNullMessage() throws Exception {
+
+        ActionMessageTag tag = new ActionMessageTag();
+        ((InternalActionSupport)action).setHasActionMessage(true);
+        ((InternalActionSupport)action).addActionMessage(null);
+        tag.setPageContext(pageContext);
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(ActionMessageTagTest.class.getResource("actionmessage-2.txt"));
+    }
+
     public Action getAction() {
         return new InternalActionSupport();
     }


Reply via email to