martinc     2002/10/08 22:09:36

  Modified:    src/exercise-taglib/org/apache/struts/webapp/exercise
                        ApplicationResources.properties TestBean.java
               src/share/org/apache/struts/taglib/html OptionTag.java
               web/exercise-taglib html-select.jsp
  Log:
  Check for null bodyContent before attempting to process it. Add a test case
  to catch this.
  
  PR: 13064
  Submitted by: Juozas Baliuka
  
  Revision  Changes    Path
  1.3       +8 -0      
jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/ApplicationResources.properties
  
  Index: ApplicationResources.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/ApplicationResources.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ApplicationResources.properties   16 Jul 2002 04:56:42 -0000      1.2
  +++ ApplicationResources.properties   9 Oct 2002 05:09:35 -0000       1.3
  @@ -29,3 +29,11 @@
   property3message1=Property 3, Message 1
   property3message2=Property 3, Message 2
   globalMessage=Global Message
  +
  +#
  +# Resources for testing <html:option>.
  +#
  +
  +resources0=Resources 0
  +resources1=Resources 1
  +resources2=Resources 2
  
  
  
  1.7       +18 -4     
jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java
  
  Index: TestBean.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/exercise-taglib/org/apache/struts/webapp/exercise/TestBean.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestBean.java     12 Mar 2002 06:30:56 -0000      1.6
  +++ TestBean.java     9 Oct 2002 05:09:35 -0000       1.7
  @@ -398,6 +398,20 @@
   
   
       /**
  +     * A single-String value for a SELECT element based on resource strings.
  +     */
  +    private String resourcesSelect = "Resources 2";
  +
  +    public String getResourcesSelect() {
  +        return (this.resourcesSelect);
  +    }
  +
  +    public void setResourcesSelect(String resourcesSelect) {
  +        this.resourcesSelect = resourcesSelect;
  +    }
  +
  +
  +    /**
        * A property that allows a null value but is still used in a SELECT.
        */
       private String withNulls = null;
  
  
  
  1.12      +11 -9     
jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java
  
  Index: OptionTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionTag.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- OptionTag.java    4 Oct 2002 05:34:19 -0000       1.11
  +++ OptionTag.java    9 Oct 2002 05:09:35 -0000       1.12
  @@ -262,11 +262,13 @@
        */
       public int doAfterBody() throws JspException {
   
  -        String text = bodyContent.getString();
  -        if (text != null) {
  -            text = text.trim();
  -            if (text.length() > 0)
  -                this.text = text;
  +        if (bodyContent != null) {
  +            String text = bodyContent.getString();
  +            if (text != null) {
  +                text = text.trim();
  +                if (text.length() > 0)
  +                    this.text = text;
  +            }
           }
           return (SKIP_BODY);
   
  
  
  
  1.8       +11 -0     jakarta-struts/web/exercise-taglib/html-select.jsp
  
  Index: html-select.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/exercise-taglib/html-select.jsp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- html-select.jsp   12 Mar 2002 06:30:56 -0000      1.7
  +++ html-select.jsp   9 Oct 2002 05:09:35 -0000       1.8
  @@ -102,6 +102,17 @@
     </tr>
   
     <tr>
  +    <th align="right">Select With Labels From Resources:</th>
  +    <td align="left">
  +      <html:select property="resourcesSelect" size="3">
  +        <html:option value="Resources 0" key="resources0"/>
  +        <html:option value="Resources 1" key="resources1"/>
  +        <html:option value="Resources 2" key="resources2"/>
  +      </html:select>
  +    </td>
  +  </tr>
  +
  +  <tr>
       <th align="right">
         Collection with null labels and values:
       </th>
  
  
  

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

Reply via email to