This issue came up when referring to a Hibernate object wrapped with a proxy object which is a standard pattern that Hibernate uses for working with POJOs. If any methods are called on the proxy outside of the originating Hibernate session, then Hibernate throws the dreaded LazyIntializationException, this includes the toString() method. The stack trace in this case is deep within Hibernate.
I guess I have two points, the first is that I think that Velocity should always report accurately where in a template a problem has occurred. The second, as far as I know, currently any error encountered while processing a template generates some sort of velocity exception, and the location of the problem within the template file is reported in the exception message. This patch was attempting to be consistent with that trend.
My only concern with calling toString() is that on some object this may be non-trivial, and may be surprising behavior from #if($foo). But, it's probably not a big deal.
Let me know if you think another approach would be better, and I'll provide a new patch. I don't think this has a high priority which is why I marked it as an improvement, so I don't think it's necessary for 1.6.1.