You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pr...@apache.org on 2003/06/23 02:16:26 UTC

cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly JellyContext.java

proyal      2003/06/22 17:16:26

  Modified:    jelly/src/java/org/apache/commons/jelly JellyContext.java
  Added:       jelly/src/test/org/apache/commons/jelly
                        TestJellyContext.java
  Log:
  Fix for 20534. Prevent existing variables from being inadvertently deleted
  during a JellyContext.setVariables() call.
  
  Reported by billk@tech.beacon-it.co.jp (Bill Keese)
  
  Revision  Changes    Path
  1.1                  jakarta-commons/jelly/src/test/org/apache/commons/jelly/TestJellyContext.java
  
  Index: TestJellyContext.java
  ===================================================================
  package org.apache.commons.jelly;
  
  import java.util.HashMap;
  
  import junit.framework.TestCase;
  
  /**
   *
   * @author <a href="proyal@pace2020.com">peter royal</a>
   */
  public class TestJellyContext extends TestCase
  {
      public TestJellyContext( String s )
      {
          super( s );
      }
  
      public void testSetVariablesAndRetainContextEntry()
      {
          final JellyContext jc = new JellyContext();
  
          assertNotNull( "Initial variable of context", jc.getVariable( "context" ) );
  
          jc.setVariables( new HashMap() );
  
          assertNotNull( "Value after setVariables()", jc.getVariable( "context" ) );
      }
  }
  
  
  
  1.43      +1 -1      jakarta-commons/jelly/src/java/org/apache/commons/jelly/JellyContext.java
  
  Index: JellyContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/JellyContext.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- JellyContext.java	7 Mar 2003 13:17:54 -0000	1.42
  +++ JellyContext.java	23 Jun 2003 00:16:26 -0000	1.43
  @@ -323,7 +323,7 @@
        */
   
       public void setVariables(Map variables) {
  -        this.variables = variables;
  +        this.variables.putAll( variables );
       }
   
       /**
  
  
  

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