Author: hermanns
Date: Wed Sep 13 04:06:55 2006
New Revision: 442939
URL: http://svn.apache.org/viewvc?view=rev&rev=442939
Log:
Better error reporting for errornous list tags
o backport from WW 2.2.3/2.2.4
Issue Number: WW-1439
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java?view=diff&rev=442939&r1=442938&r2=442939
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
Wed Sep 13 04:06:55 2006
@@ -215,7 +215,9 @@
* @return the constructed <code>StrutsException</code>.
*/
protected StrutsException fieldError(String field, String errorMsg,
Exception e) {
- String msg = "tag " + getComponentName() + ", field " + field + ": " +
errorMsg;
+ String msg = "tag '" + getComponentName() + "', field '" + field + (
id != null ?"', id '" + id:"") +
+ ( parameters != null && parameters.containsKey("name")?"',
name '" + parameters.get("name"):"") +
+ "': " + errorMsg;
throw new StrutsException(msg, e);
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java?view=diff&rev=442939&r1=442938&r2=442939
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ListUIBean.java
Wed Sep 13 04:06:55 2006
@@ -73,7 +73,7 @@
if (throwExceptionOnNullValueAttribute) {
// will throw an exception if not found
value = findValue((list == null) ? (String) list :
list.toString(), "list",
- "You must specify a
collection/array/map/enumeration/iterator. " +
+ "The requested list key '" + list + "' could not be
resolved as a collection/array/map/enumeration/iterator type. " +
"Example: people or people.{name}");
}
else {
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java?view=diff&rev=442939&r1=442938&r2=442939
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
Wed Sep 13 04:06:55 2006
@@ -196,7 +196,7 @@
tag.doEndTag();
fail("Should have thrown RuntimeException");
} catch (StrutsException e) {
- assertEquals("tag actioncomponent, field name: Action name is
required. Example: updatePerson", e.getMessage());
+ assertEquals("tag 'actioncomponent', field 'name': Action name is
required. Example: updatePerson", e.getMessage());
}
}
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java?view=diff&rev=442939&r1=442938&r2=442939
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
Wed Sep 13 04:06:55 2006
@@ -42,7 +42,7 @@
tag.doEndTag();
fail("Should have thrown exception as no URL is specified in
setValue");
} catch (StrutsException e) {
- assertEquals("tag include, field value: You must specify the URL
to include. Example: /foo.jsp", e.getMessage());
+ assertEquals("tag 'include', field 'value': You must specify the
URL to include. Example: /foo.jsp", e.getMessage());
}
}
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java?view=diff&rev=442939&r1=442938&r2=442939
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
Wed Sep 13 04:06:55 2006
@@ -231,7 +231,7 @@
}
public void testNoNameDefined() throws Exception {
- String msg = "tag text, field name: You must specify the i18n key.
Example: welcome.header";
+ String msg = "tag 'text', field 'name': You must specify the i18n key.
Example: welcome.header";
try {
tag.doStartTag();
tag.doEndTag();