struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/logic CompareTagBase.java ForwardTag.java IterateTag.java MatchTag.java PresentTag.java RedirectTag.java
Date Thu, 12 Oct 2000 23:00:33 GMT
craigmcc    00/10/12 16:00:33

  Modified:    src/share/org/apache/struts/taglib/logic CompareTagBase.java
                        ForwardTag.java IterateTag.java MatchTag.java
                        PresentTag.java RedirectTag.java
  Log:
  When getting ready to throw a JspException, store an instance of the
  "real" underlying exception as a request attribute, where relevant.  When
  the underlying exception is an InvocationTargetException, also look up the
  target exception that was actually thrown.
  
  Revision  Changes    Path
  1.2       +18 -4     jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java
  
  Index: CompareTagBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CompareTagBase.java	2000/09/07 01:35:35	1.1
  +++ CompareTagBase.java	2000/10/12 23:00:31	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java,v
1.1 2000/09/07 01:35:35 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/07 01:35:35 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/CompareTagBase.java,v
1.2 2000/10/12 23:00:31 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/12 23:00:31 $
    *
    * ====================================================================
    *
  @@ -63,9 +63,12 @@
   package org.apache.struts.taglib.logic;
   
   
  +import java.lang.reflect.InvocationTargetException;
   import javax.servlet.http.Cookie;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.jsp.JspException;
  +import javax.servlet.jsp.PageContext;
  +import org.apache.struts.action.Action;
   import org.apache.struts.util.BeanUtils;
   import org.apache.struts.util.PropertyUtils;
   
  @@ -75,7 +78,7 @@
    * define values for desired1 and desired2.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/09/07 01:35:35 $
  + * @version $Revision: 1.2 $ $Date: 2000/10/12 23:00:31 $
    */
   
   public abstract class CompareTagBase extends ConditionalTagBase {
  @@ -212,7 +215,18 @@
                           (messages.getMessage("logic.bean", name));
                   try {
                       variable = PropertyUtils.getProperty(bean, property);
  +                } catch (InvocationTargetException e) {
  +                    Throwable t = e.getTargetException();
  +                    if (t == null)
  +                        t = e;
  +                    pageContext.setAttribute(Action.EXCEPTION_KEY, t,
  +                                             PageContext.REQUEST_SCOPE);
  +                    throw new JspException
  +                        (messages.getMessage("logic.property", name, property,
  +                                             t.toString()));
                   } catch (Throwable t) {
  +                    pageContext.setAttribute(Action.EXCEPTION_KEY, t,
  +                                             PageContext.REQUEST_SCOPE);
                       throw new JspException
                           (messages.getMessage("logic.property", name, property,
                                                t.toString()));
  
  
  
  1.2       +8 -4      jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java
  
  Index: ForwardTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ForwardTag.java	2000/09/07 01:35:35	1.1
  +++ ForwardTag.java	2000/10/12 23:00:32	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
1.1 2000/09/07 01:35:35 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/07 01:35:35 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/ForwardTag.java,v
1.2 2000/10/12 23:00:32 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/12 23:00:32 $
    *
    * ====================================================================
    *
  @@ -80,7 +80,7 @@
    * ActionForwards collection associated with our application.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/09/07 01:35:35 $
  + * @version $Revision: 1.2 $ $Date: 2000/10/12 23:00:32 $
    */
   
   public final class ForwardTag extends TagSupport {
  @@ -154,6 +154,8 @@
   	    try {
   		response.sendRedirect(response.encodeRedirectURL(path));
   	    } catch (Exception e) {
  +                pageContext.setAttribute(Action.EXCEPTION_KEY, e,
  +                                         PageContext.REQUEST_SCOPE);
   		throw new JspException
   		    (messages.getMessage("forward.redirect",
   					 name, e.toString()));
  @@ -162,6 +164,8 @@
   	    try {
   		pageContext.forward(path);
   	    } catch (Exception e) {
  +                pageContext.setAttribute(Action.EXCEPTION_KEY, e,
  +                                         PageContext.REQUEST_SCOPE);
   		throw new JspException
   		    (messages.getMessage("forward.forward",
   					 name, e.toString()));
  
  
  
  1.2       +15 -4     jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java
  
  Index: IterateTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IterateTag.java	2000/09/07 01:35:35	1.1
  +++ IterateTag.java	2000/10/12 23:00:32	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java,v
1.1 2000/09/07 01:35:35 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/07 01:35:35 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java,v
1.2 2000/10/12 23:00:32 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/12 23:00:32 $
    *
    * ====================================================================
    *
  @@ -73,6 +73,7 @@
   import javax.servlet.jsp.JspWriter;
   import javax.servlet.jsp.PageContext;
   import javax.servlet.jsp.tagext.BodyTagSupport;
  +import org.apache.struts.action.Action;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.PropertyUtils;
   
  @@ -87,7 +88,7 @@
    * <b>NOTE</b> - This tag requires a Java2 (JDK 1.2 or later) platform.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/09/07 01:35:35 $
  + * @version $Revision: 1.2 $ $Date: 2000/10/12 23:00:32 $
    */
   
   public final class IterateTag extends BodyTagSupport {
  @@ -260,14 +261,22 @@
   			(messages.getMessage("iterate.property",
                                                name, property));
   	    } catch (IllegalAccessException e) {
  +                pageContext.setAttribute(Action.EXCEPTION_KEY, e,
  +                                         PageContext.REQUEST_SCOPE);
   		throw new JspException
   		    (messages.getMessage("iterate.access", name, property));
   	    } catch (InvocationTargetException e) {
   		Throwable t = e.getTargetException();
  +                if (t == null)
  +                    t = e;
  +                pageContext.setAttribute(Action.EXCEPTION_KEY, t,
  +                                         PageContext.REQUEST_SCOPE);
   		throw new JspException
   		    (messages.getMessage("iterate.target",
   					 name, property, t.toString()));
   	    } catch (NoSuchMethodException e) {
  +                pageContext.setAttribute(Action.EXCEPTION_KEY, e,
  +                                         PageContext.REQUEST_SCOPE);
   		throw new JspException
   		    (messages.getMessage("iterate.method", name, property));
   	    }
  @@ -357,6 +366,8 @@
   		out.print(bodyContent.getString());
                   bodyContent.clearBody();
   	    } catch (IOException e) {
  +                pageContext.setAttribute(Action.EXCEPTION_KEY, e,
  +                                         PageContext.REQUEST_SCOPE);
   		throw new JspException
   		    (messages.getMessage("iterate.io", e.toString()));
   	    }
  
  
  
  1.2       +18 -4     jakarta-struts/src/share/org/apache/struts/taglib/logic/MatchTag.java
  
  Index: MatchTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/MatchTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MatchTag.java	2000/09/07 01:35:36	1.1
  +++ MatchTag.java	2000/10/12 23:00:32	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/MatchTag.java,v
1.1 2000/09/07 01:35:36 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/07 01:35:36 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/MatchTag.java,v
1.2 2000/10/12 23:00:32 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/12 23:00:32 $
    *
    * ====================================================================
    *
  @@ -63,9 +63,12 @@
   package org.apache.struts.taglib.logic;
   
   
  +import java.lang.reflect.InvocationTargetException;
   import javax.servlet.http.Cookie;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.jsp.JspException;
  +import javax.servlet.jsp.PageContext;
  +import org.apache.struts.action.Action;
   import org.apache.struts.util.BeanUtils;
   import org.apache.struts.util.PropertyUtils;
   
  @@ -75,7 +78,7 @@
    * is a substring of the specified variable.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/09/07 01:35:36 $
  + * @version $Revision: 1.2 $ $Date: 2000/10/12 23:00:32 $
    */
   
   public class MatchTag extends ConditionalTagBase {
  @@ -186,7 +189,18 @@
                   Object propertyValue = null;
                   try {
                       propertyValue = PropertyUtils.getProperty(bean, property);
  +                } catch (InvocationTargetException e) {
  +                    Throwable t = e.getTargetException();
  +                    if (t == null)
  +                        t = e;
  +                    pageContext.setAttribute(Action.EXCEPTION_KEY, t,
  +                                             PageContext.REQUEST_SCOPE);
  +                    throw new JspException
  +                        (messages.getMessage("logic.property", name, property,
  +                                             t.toString()));
                   } catch (Throwable t) {
  +                    pageContext.setAttribute(Action.EXCEPTION_KEY, t,
  +                                             PageContext.REQUEST_SCOPE);
                       throw new JspException
                           (messages.getMessage("logic.property", name, property,
                                                t.toString()));
  
  
  
  1.2       +18 -4     jakarta-struts/src/share/org/apache/struts/taglib/logic/PresentTag.java
  
  Index: PresentTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/PresentTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PresentTag.java	2000/09/07 01:35:36	1.1
  +++ PresentTag.java	2000/10/12 23:00:32	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/PresentTag.java,v
1.1 2000/09/07 01:35:36 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/07 01:35:36 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/PresentTag.java,v
1.2 2000/10/12 23:00:32 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/12 23:00:32 $
    *
    * ====================================================================
    *
  @@ -63,9 +63,12 @@
   package org.apache.struts.taglib.logic;
   
   
  +import java.lang.reflect.InvocationTargetException;
   import javax.servlet.http.Cookie;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.jsp.JspException;
  +import javax.servlet.jsp.PageContext;
  +import org.apache.struts.action.Action;
   import org.apache.struts.util.BeanUtils;
   import org.apache.struts.util.PropertyUtils;
   
  @@ -75,7 +78,7 @@
    * is present for this request.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/09/07 01:35:36 $
  + * @version $Revision: 1.2 $ $Date: 2000/10/12 23:00:32 $
    */
   
   public class PresentTag extends ConditionalTagBase {
  @@ -139,7 +142,18 @@
                   Object value = null;
                   try {
                       value = PropertyUtils.getProperty(bean, property);
  +                } catch (InvocationTargetException e) {
  +                    Throwable t = e.getTargetException();
  +                    if (t == null)
  +                        t = e;
  +                    pageContext.setAttribute(Action.EXCEPTION_KEY, t,
  +                                             PageContext.REQUEST_SCOPE);
  +                    throw new JspException
  +                        (messages.getMessage("logic.property", name, property,
  +                                             t.toString()));
                   } catch (Throwable t) {
  +                    pageContext.setAttribute(Action.EXCEPTION_KEY, t,
  +                                             PageContext.REQUEST_SCOPE);
                       throw new JspException
                           (messages.getMessage("logic.property", name, property,
                                                t.toString()));
  
  
  
  1.2       +7 -4      jakarta-struts/src/share/org/apache/struts/taglib/logic/RedirectTag.java
  
  Index: RedirectTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/RedirectTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RedirectTag.java	2000/09/07 01:35:36	1.1
  +++ RedirectTag.java	2000/10/12 23:00:32	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/RedirectTag.java,v
1.1 2000/09/07 01:35:36 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/09/07 01:35:36 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/RedirectTag.java,v
1.2 2000/10/12 23:00:32 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/12 23:00:32 $
    *
    * ====================================================================
    *
  @@ -69,6 +69,7 @@
   import javax.servlet.jsp.JspWriter;
   import javax.servlet.jsp.PageContext;
   import javax.servlet.jsp.tagext.TagSupport;
  +import org.apache.struts.action.Action;
   import org.apache.struts.util.BeanUtils;
   import org.apache.struts.util.MessageResources;
   
  @@ -78,7 +79,7 @@
    * the remainder of the current page.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/09/07 01:35:36 $
  + * @version $Revision: 1.2 $ $Date: 2000/10/12 23:00:32 $
    */
   
   public final class RedirectTag extends TagSupport {
  @@ -138,6 +139,8 @@
   	try {
   	    response.sendRedirect(response.encodeRedirectURL(href));
   	} catch (IOException e) {
  +            pageContext.setAttribute(Action.EXCEPTION_KEY, e,
  +                                     PageContext.REQUEST_SCOPE);
   	    throw new JspException
   		(messages.getMessage("redirect.redirect", href, e.toString()));
   	}
  
  
  

Mime
View raw message