craigmcc    02/03/15 21:04:34

  Modified:    src/share/org/apache/struts/taglib/bean DefineTag.java
                        LocalStrings.properties
  Log:
  Make <bean:define> throw an exception if it is requested to define
  a null value, since null attribute values are not allowed.
  
  PR: Bugzilla #6098
  Submitted by: Bill Wallace <wayfarer3134 at yahoo.com>
  
  Revision  Changes    Path
  1.16      +17 -6     
jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java
  
  Index: DefineTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefineTag.java    25 Feb 2002 21:02:04 -0000      1.15
  +++ DefineTag.java    16 Mar 2002 05:04:33 -0000      1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v 1.15 
2002/02/25 21:02:04 oalexeev Exp $
  - * $Revision: 1.15 $
  - * $Date: 2002/02/25 21:02:04 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v 1.16 
2002/03/16 05:04:33 craigmcc Exp $
  + * $Revision: 1.16 $
  + * $Date: 2002/03/16 05:04:33 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * bean property.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.15 $ $Date: 2002/02/25 21:02:04 $
  + * @version $Revision: 1.16 $ $Date: 2002/03/16 05:04:33 $
    */
   
   public class DefineTag extends BodyTagSupport {
  @@ -223,10 +223,21 @@
   
           // Retrieve the required property value
           Object value = this.value;
  -        if (value == null && name!=null) 
  +        if ((value == null) && (name!=null)) {
               value = RequestUtils.lookup(pageContext, name, property, scope);
  -        if (value == null) 
  +        }
  +        if (value == null) {
               value = bodyContent.getString();
  +            if (value != null) {
  +                value = ((String) value).trim();
  +            }
  +        }
  +        if (value == null) {
  +            JspException e =
  +                new JspException(messages.getMessage("define.null"));
  +            RequestUtils.saveException(pageContext, e);
  +            throw e;
  +        }
   
           // Expose this value as a scripting variable
           int inScope = PageContext.PAGE_SCOPE;
  
  
  
  1.17      +2 -1      
jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- LocalStrings.properties   25 Feb 2002 20:56:53 -0000      1.16
  +++ LocalStrings.properties   16 Mar 2002 05:04:33 -0000      1.17
  @@ -1,4 +1,6 @@
   cookie.get=No cookie {0} was included in this request
  +define.null=Define tag cannot set a null value
  +define.value=Define tag can contain value/name attributes or body.
   header.get=No header {0} was included in this request
   include.destination=You must specify exactly one of forward, href, or page
   include.forward=Missing ActionForward entry {0}
  @@ -17,4 +19,3 @@
   struts.missing=No Struts internal object named {0} is available
   struts.selector=You must specify exactly one of formBean, forward, or mapping
   write.format=Wrong format string: '{0}'
  -define.value=Define tag can contain value/name attributes or body.
  \ No newline at end of file
  
  
  

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

Reply via email to