You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Will Glass-Husain (JIRA)" <ji...@apache.org> on 2005/09/19 08:07:54 UTC
[jira] Updated: (VELOCITY-98) #parse / #include causing ClassCastException
[ http://issues.apache.org/jira/browse/VELOCITY-98?page=all ]
Will Glass-Husain updated VELOCITY-98:
--------------------------------------
Bugzilla Id: (was: 11126)
Fix Version: 1.5
Description:
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.
was:
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.
Environment:
Operating System: Linux
Platform: All
was:
Operating System: Linux
Platform: All
Assign To: (was: Velocity-Dev List)
If someone can make a patch against the current source, it passes ant test, and it solves this problem - I'll commit it.
> #parse / #include causing ClassCastException
> --------------------------------------------
>
> Key: VELOCITY-98
> URL: http://issues.apache.org/jira/browse/VELOCITY-98
> Project: Velocity
> Type: Bug
> Components: Source
> Versions: 1.3-rc1
> Environment: Operating System: Linux
> Platform: All
> Reporter: Simon Christian
> Priority: Minor
> Fix For: 1.5
>
> 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org