Anonymous avatar Anonymous committed a76d0f6

Better error reporting for errornous list tags.
o showing the tag name and/or id in error message
o showing the name of the requested collection/array/map/... type

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@2677 573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (2)

src/java/com/opensymphony/webwork/components/Component.java

      * @return  the constructed <code>WebWorkException</code>.
      */
     protected WebWorkException 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;
         if (e == null) {
             LOG.error(msg);
             return new WebWorkException(msg);

src/java/com/opensymphony/webwork/components/ListUIBean.java

         	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 {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.