Author: nbubna
Date: Thu Oct 16 14:23:23 2008
New Revision: 705363
URL: http://svn.apache.org/viewvc?rev=705363&view=rev
Log:
put proper template/line/col info null iterator message (thx to Byron Foster)
Modified:
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java
Modified:
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java?rev=705363&r1=705362&r2=705363&view=diff
==============================================================================
---
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java
(original)
+++
velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Foreach.java
Thu Oct 16 14:23:23 2008
@@ -310,9 +310,12 @@
}
else
{
- String msg = "Uberspect returned a null iterator for #foreach
at "
- + uberInfo + ". " + node.jjtGetChild(2).literal() + " ("
+ listObject
- + ") is either of wrong type or has an invalid iterator()
implementation.";
+ Node pnode = node.jjtGetChild(2);
+ String msg = "#foreach parameter " + pnode.literal() + " at "
+ +
rsvc.getLog().formatFileString(uberInfo.getTemplateName(),
+ pnode.getLine(), pnode.getColumn())
+ + " is of type " + listObject.getClass().getName()
+ + " and is either of wrong type or cannot be iterated.";
rsvc.getLog().error(msg);
throw new VelocityException(msg);
}