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 2002/07/24 15:05:16 UTC

DO NOT REPLY [Bug 11126] New: - #parse / #include causing ClassCastException

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=11126>.
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=11126

#parse / #include causing ClassCastException

           Summary: #parse / #include causing ClassCastException
           Product: Velocity
           Version: 1.3-rc1
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Source
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: simon@cpd.co.uk


If caching is on, and a template has been previously cached due to a #parse or 
#include directive, subsequently using the other directive will cause a 
ClassCastException and fail.

Example: if I have two templates, the first one loaded includes the line:
  #include( "include/header.vtl" )
and the second one the line: 
  #parse( "include/header.vtl" )

When the second page is viewed, a ClassCastException is thrown with an error in 
the log like:

[error] #parse() : arg = include/header.vtl.  Exception : 
java.lang.ClassCastException: 
org.apache.velocity.runtime.resource.ContentResource

A solution might be to include the resourceType as part of the key when 
caching/retrieving the resource, within the getResource() method of the 
org.apache.velocity.runtime.resource.ResourceManagerImpl class. Alternatively 
seperate caches could be used for the different types of Resource.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>