You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2004/07/23 11:25:06 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/tiles ImportAttributeTag.java

husted      2004/07/23 02:25:06

  Modified:    src/share/org/apache/struts/taglib/tiles
                        ImportAttributeTag.java
  Log:
  Apply #30202 "No exception handling when exposing all request params using ImportAttribute." submitted by Peter Reitsma.
  
  Revision  Changes    Path
  1.11      +23 -11    jakarta-struts/src/share/org/apache/struts/taglib/tiles/ImportAttributeTag.java
  
  Index: ImportAttributeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/tiles/ImportAttributeTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ImportAttributeTag.java	14 Mar 2004 06:23:49 -0000	1.10
  +++ ImportAttributeTag.java	23 Jul 2004 09:25:06 -0000	1.11
  @@ -139,10 +139,10 @@
        *
        * @exception JspException On errors processing tag.
        */
  -  public int doStartTag() throws JspException
  +public int doStartTag() throws JspException
       {
         // retrieve component context
  -    ComponentContext compContext = (ComponentContext)pageContext.getAttribute( ComponentConstants.COMPONENT_CONTEXT, PageContext.REQUEST_SCOPE);
  +    ComponentContext compContext = (ComponentContext)pageContext.getAttribute(ComponentConstants.COMPONENT_CONTEXT, PageContext.REQUEST_SCOPE);
       if( compContext == null )
           throw new JspException ( "Error - tag importAttribute : no tiles context found." );
   
  @@ -156,7 +156,7 @@
           // Check if value exist and if we must send a runtime exception
         if( value == null )
           if(!isErrorIgnored)
  -          throw new JspException ( "Error - tag importAttribute : property '"+ name + "' not found in context. Check tag syntax" );
  +          throw new JspException ( "Error - tag importAttribute : property '"+  name + "' not found in context. Check tag syntax" );
            else
             return SKIP_BODY;
   
  @@ -168,16 +168,28 @@
         while(names.hasNext())
           {
           String name = (String)names.next();
  -        pageContext.setAttribute(name, compContext.getAttribute(name), scope);
  +        if(name == null ) {
  +          if(!isErrorIgnored)
  +            throw new JspException ( "Error - tag importAttribute : encountered an attribute with key 'null'" );
  +          else
  +            return SKIP_BODY;
  +        }
  +
  +        Object value = compContext.getAttribute(name);
  +        // Check if value exist and if we must send a runtime exception
  +        if( value == null ) {
  +          if(!isErrorIgnored)
  +            throw new JspException ( "Error - tag importAttribute : property '"+ name + "' has a value of 'null'" );
  +          else
  +            return SKIP_BODY;
  +        }
  +        pageContext.setAttribute(name, value, scope);
           } // end loop
  -      } // end if
  +      } // end else
   
         // Continue processing this page
       return SKIP_BODY;
       }
  -
  -
  -
   
       /**
        * Clean up after processing this enumeration.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org