You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Misagh Moayyed (JIRA)" <de...@velocity.apache.org> on 2010/11/04 18:39:42 UTC
[jira] Commented: (VELOCITY-712) Velocity Context clone() method
doesn't do a deep cloning as mentioned in the javadoc
[ https://issues.apache.org/jira/browse/VELOCITY-712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12928281#action_12928281 ]
Misagh Moayyed commented on VELOCITY-712:
-----------------------------------------
I am working on the deep clone issue here. I think one strategy here would be to serialize the context and then deserialize it, although the issue here is, items need to implement serializable. Otherwise, I think the context recursively needs to clone itself and the items inside.
> Velocity Context clone() method doesn't do a deep cloning as mentioned in the javadoc
> -------------------------------------------------------------------------------------
>
> Key: VELOCITY-712
> URL: https://issues.apache.org/jira/browse/VELOCITY-712
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.6.1
> Reporter: Vincent Massol
> Attachments: velocity-712.patch
>
>
> Looking at the code it does:
> {noformat}
> public Object clone()
> {
> VelocityContext clone = null;
> try
> {
> clone = (VelocityContext) super.clone();
> clone.context = new HashMap(context);
> }
> catch (CloneNotSupportedException ignored)
> {
> }
> return clone;
> }
> {noformat}
> new HashMap() will not perform deep cloning but only shallow cloning.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org