Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2996

ImportAttributeTag throws a NullPointerException when ignore=true and the attribute value is not available

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.5
    • 1.3.7
    • Tiles 1 Plugin
    • None
    • All

    Description

      This bug is from regression caused by the fix for STR-2809.

      Given the JSP with:

      <tiles:importAttribute name="doesntExist" ignore="true"/>

      The following exception occurs:

      java.lang.NullPointerException
      at java.util.Hashtable.put(Hashtable.java:393)
      at org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.java:238)
      at org.apache.struts.tiles.taglib.ImportAttributeTag.doStartTag(ImportAttributeTag.java:167)

      This is due to the ImportAttributeTag class incorrectly calling pageContext.setAttribute with a null value. This call was previously unreachable prior to the fix for STR-2809 which eliminated the SKIP_BODY returns when ignore=true.

      The behavior of the PageContext implementation is consistent with the Servlet 2.2 Specification:

      http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/jsp/PageContext.html#setAttribute(java.lang.String,%20java.lang.Object,%20int)

      Attachments

        1. STR-2996-fix.patch
          1.0 kB
          Jira Report User

        Activity

          People

            jirareport Jira Report User
            jlandin Josh Landin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: