cmlenz      02/01/27 13:13:11

  Modified:    src/taglib/common/org/apache/slide/taglib/tag
                        ContentTagSupport.java
               src/taglib/jstl/org/apache/slide/taglib/tag/jstl
                        JstlTagUtils.java
  Log:
  Bugfixes:
  - Check for null expressions in JstlTagUtils
  - Don't implement TryCatchFinally, as that doesn't exist in JSP 1.1
  
  Revision  Changes    Path
  1.4       +23 -53    
jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/ContentTagSupport.java
  
  Index: ContentTagSupport.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/ContentTagSupport.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContentTagSupport.java    27 Jan 2002 17:16:22 -0000      1.3
  +++ ContentTagSupport.java    27 Jan 2002 21:13:11 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/ContentTagSupport.java,v
 1.3 2002/01/27 17:16:22 cmlenz Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/01/27 17:16:22 $
  + * $Header: 
/home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/ContentTagSupport.java,v
 1.4 2002/01/27 21:13:11 cmlenz Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/01/27 21:13:11 $
    *
    * ====================================================================
    *
  @@ -73,7 +73,6 @@
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.PageContext;
   import javax.servlet.jsp.tagext.TagSupport;
  -import javax.servlet.jsp.tagext.TryCatchFinally;
   
   import org.apache.slide.common.SlideException;
   import org.apache.slide.taglib.bean.NodeBean;
  @@ -89,11 +88,10 @@
    * nested in.</p>
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christopher Lenz</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public abstract class ContentTagSupport
  -    extends TagSupport
  -    implements TryCatchFinally {
  +    extends TagSupport {
       
       
       // ----------------------------------------------------- Instance Variables
  @@ -154,35 +152,13 @@
           }
           
           try {
  +            reader = revision.getReader();
               if (attrNameReader != null) {
  -                reader = revision.getReader();
                   pageContext.setAttribute(attrNameReader, reader);
  -            }
  -        } catch (IOException e) {
  -            throw new JspException(e.getMessage());
  -        } catch (SlideException e) {
  -            throw new JspException(e.getMessage());
  -        }
  -        
  -        return SKIP_BODY;
  -    }
  -    
  -    
  -    /**
  -     * Called by the JSP Engine when closing this tag.
  -     *
  -     * @throws JspException 
  -     */
  -    public int doEndTag()
  -        throws JspException {
  -        
  -        try {
  -            if (attrNameReader == null) {
  -                BufferedReader br = new BufferedReader(revision.getReader());
  +            } else {
  +                BufferedReader br = new BufferedReader(reader);
                   StringBuffer sb = new StringBuffer();
                   int i;
  -                // under JIT, testing seems to show this simple loop is as fast
  -                // as any of the alternatives
                   while ((i = reader.read()) != -1) {
                       sb.append((char)i);
                   }
  @@ -198,38 +174,32 @@
               throw new JspException(e.getMessage());
           }
           
  -        return EVAL_PAGE;
  -    }
  -    
  -    
  -    /**
  -     * Simply rethrows its exception.
  -     * @throws Throwable 
  -     */
  -    public void doCatch(Throwable t)
  -        throws Throwable {
  -        
  -        throw t;
  +        return SKIP_BODY;
       }
       
       
       /**
  -     * Cleans up if appropriate.
  +     * Called by the JSP Engine when closing this tag.
  +     *
  +     * @throws JspException 
        */
  -    public void doFinally() {
  +    public int doEndTag()
  +        throws JspException {
           
           try {
  -            // If we exposed a Reader in doStartTag(), close it.
  +            // If we exposed a Reader in doStartTag(), remove it.
               if (attrNameReader != null) {
  -                // 'reader' can be null if an exception was thrown...
  -                if (reader != null) {
  -                    reader.close();
  -                }
                   pageContext.removeAttribute(attrNameReader);
               }
  -        } catch (IOException ex) {
  -            // ignore - close() failed, but there's nothing more we can do
  +            // reader can be null if an exception was thrown...
  +            if (reader != null) {
  +                reader.close();
  +            }
  +        } catch (IOException e) {
  +            throw new JspException(e.getMessage());
           }
  +        
  +        return EVAL_PAGE;
       }
       
       
  
  
  
  1.2       +10 -4     
jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/JstlTagUtils.java
  
  Index: JstlTagUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/JstlTagUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JstlTagUtils.java 27 Jan 2002 15:46:37 -0000      1.1
  +++ JstlTagUtils.java 27 Jan 2002 21:13:11 -0000      1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/JstlTagUtils.java,v
 1.1 2002/01/27 15:46:37 cmlenz Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/27 15:46:37 $
  + * $Header: 
/home/cvs/jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/JstlTagUtils.java,v
 1.2 2002/01/27 21:13:11 cmlenz Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/27 21:13:11 $
    *
    * ====================================================================
    *
  @@ -90,7 +90,7 @@
    * tag.
    * 
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christopher Lenz</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class JstlTagUtils {
       
  @@ -110,6 +110,9 @@
                                                      PageContext pageContext)
           throws JspException {
           
  +        if (expression == null) {
  +            return null;
  +        }
           Object result = null;
           try {
               result =
  @@ -136,6 +139,9 @@
                                                      PageContext pageContext)
           throws JspException {
           
  +        if (expression == null) {
  +            throw new NullAttributeException(tagName, attributeName);
  +        }
           Object result = 
               ExpressionEvaluatorManager.evaluate(attributeName, expression,
                                                   expectedType, tag,
  
  
  

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

Reply via email to