jstrachan    2002/11/19 05:28:43

  Modified:    jelly/src/java/org/apache/commons/jelly/impl TagScript.java
               jelly/src/java/org/apache/commons/jelly/tags/jsl
                        TemplateTag.java
               jelly/src/test/org/apache/commons/jelly/jsl suite.jelly
  Log:
  Patch to fix dIon's bug with JSL. The fix was for TagScript to properly set the 
parent tag each time its used; there was a danger of the Tag being cached and its old 
parent being used when inside loops. This should now fix any similar related bugs.
  
  Moving forward, it might be worth optimizing the TagScript code so that the 
Script.run() method takes the parent Tag to use. Then the thread local tag hierarchy 
can be maintained on the stack, rather than using ThreadLocal variables that we 
currently use. This would be faster and simpler I suspect.
  
  Revision  Changes    Path
  1.28      +6 -6      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java
  
  Index: TagScript.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/TagScript.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- TagScript.java    10 Nov 2002 11:09:05 -0000      1.27
  +++ TagScript.java    19 Nov 2002 13:28:42 -0000      1.28
  @@ -296,10 +296,10 @@
           if ( tag == null ) {
               tag = createTag();
               if ( tag != null ) {
  -                configureTag(tag);
                   tagHolder.set(tag);
               }
           }
  +             configureTag(tag);
           return tag;
       }
   
  
  
  
  1.7       +4 -3      
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jsl/TemplateTag.java
  
  Index: TemplateTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jsl/TemplateTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TemplateTag.java  23 Oct 2002 16:27:44 -0000      1.6
  +++ TemplateTag.java  19 Nov 2002 13:28:43 -0000      1.7
  @@ -62,6 +62,7 @@
   import org.apache.commons.jelly.JellyException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  +import org.apache.commons.jelly.tags.xml.XPathSource;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -77,7 +78,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision$
    */
  -public class TemplateTag extends TagSupport {
  +public class TemplateTag extends TagSupport implements XPathSource {
   
       /** The Log to which logging calls will be made. */
       private Log log = LogFactory.getLog(TemplateTag.class);
  @@ -102,6 +103,7 @@
       public TemplateTag() {
       }
   
  +    
       // Tag interface
       //------------------------------------------------------------------------- 
       public void doTag(XMLOutput output) throws Exception {
  @@ -125,8 +127,7 @@
       //-------------------------------------------------------------------------     
               
   
       /**
  -     * @return the current XPath iteration value
  -     *  so that any other XPath aware child tags to use
  +     * @return the current XPath value on which relative paths are evaluated
        */
       public Object getXPathSource() {
           return xpathSource;
  
  
  
  1.5       +0 -2      
jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/jsl/suite.jelly
  
  Index: suite.jelly
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/jsl/suite.jelly,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- suite.jelly       19 Nov 2002 13:14:00 -0000      1.4
  +++ suite.jelly       19 Nov 2002 13:28:43 -0000      1.5
  @@ -29,9 +29,7 @@
               <j:set var="full"><x:expr 
select="$doc/document/properties/title"/></j:set>
               <j:set var="short"><x:expr select="./properties/title" /></j:set>
               <m:echo>full=${full},short=${short}</m:echo>
  -<!--            
               <test:assert test="${full == short}">All iterations should 
succeed</test:assert>
  --->            
               <!-- comment this out to fix the bug -->
             </h>
           </jsl:template>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to