Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-712

Velocity Context clone() method doesn't do a deep cloning as mentioned in the javadoc

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None

      Description

      Looking at the code it does:

          public Object clone()
          {
              VelocityContext clone = null;
              try
              {
                  clone = (VelocityContext) super.clone();
                  clone.context = new HashMap(context);
              }
              catch (CloneNotSupportedException ignored)
              {
              }
              return clone;
          }
      

      new HashMap() will not perform deep cloning but only shallow cloning.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vmassol Vincent Massol
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: