You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2003/02/18 05:14:05 UTC

DO NOT REPLY [Bug 17151] New: - VelocityLayoutServlet assumes that $layout will be a String

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17151>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17151

VelocityLayoutServlet assumes that $layout will be a String

           Summary: VelocityLayoutServlet assumes that $layout will be a
                    String
           Product: Velocity
           Version: 1.3-rc1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Source
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: tpv@spamcop.net


This means that if the designer puts a non-string into the context under the
name "layout" then the servlet will throw a ClassCastException (which hides the
real error - an incorrect object in the context)

My preference would be to use a toString on the object (if it exists).

If there is an accidental object in the context named "layout", the servlet will
print a moderately useful message ('Can't load template
"layout/java.util.AbstractList$Itr@11121f6"'), and fall back to the standard layout

(You could instead check the type of the context object, but that would require
that $layout had to be a String, and it's probably more useful to just require
that toString() returns something useful.)

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org