DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=30202>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30202 No exception handling when exposing all request params using ImportAttribute Summary: No exception handling when exposing all request params using ImportAttribute Product: Struts Version: 1.1 Final Platform: All OS/Version: All Status: NEW Severity: Minor Priority: Other Component: Tiles framework AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] <tiles:importAttribute /> adds all request parameters from the component context to the page context, however, when a 'null' value is encountered, a NullPointer is thrown from page.Context.setAttribute. This is handled for the named parameter case, like <tile:importAttribute id="id"/> but for some reason this exception handling is not present for the generic case. This results in very nondescriptive error messages. The code below from ImportAttributeTag fixes this problem. public int doStartTag() throws JspException { // retrieve component context ComponentContext compContext = (ComponentContext)pageContext.getAttribute( ComponentConstants.COMPONENT_CONTEXT, PageContext.REQUEST_SCOPE); if( compContext == null ) throw new JspException ( "Error - tag importAttribute : no tiles context found." ); // set scope scope = TagUtils.getScope( scopeName, PageContext.PAGE_SCOPE ); // push attribute in requested context. if( name != null ) { 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 + "' not found in context. Check tag syntax" ); else return SKIP_BODY; pageContext.setAttribute(name, value, scope); } else { // set all attributes Iterator names = compContext.getAttributeNames(); while(names.hasNext()) { String name = (String)names.next(); 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 // Continue processing this page return SKIP_BODY; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]