mirror of
https://github.com/apache/struts.git
synced 2026-08-31 19:35:40 +00:00
Better error reporting for errornous list tags
o backport from WW 2.2.3/2.2.4 Issue Number: WW-1439 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@442939 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -215,7 +215,9 @@ public class Component {
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class ListUIBean extends UIBean {
|
||||
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 {
|
||||
|
||||
@@ -196,7 +196,7 @@ public class ActionTagTest extends AbstractTagTest {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class IncludeTagTest extends AbstractTagTest {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ public class TextTagTest extends AbstractTagTest {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user