You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/13 18:12:03 UTC

DO NOT REPLY [Bug 17050] New: - Invalid ActionMessage key causes a NullPointerException in MessagesTag

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17050>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17050

Invalid ActionMessage key causes a NullPointerException in MessagesTag

           Summary: Invalid ActionMessage key causes a NullPointerException
                    in MessagesTag
           Product: Struts
           Version: 1.1 Beta 3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: jpl@remotejava.com


Try something like

messages.add("somePropertyName", new ActionMessage("thisKeyNotDefinedInBundle"));
saveMessages(request, messages);

in your Action, and then iterate over the messages with

<html:messages id="msg" message="true"><bean:write name="msg"/></html:messages>

You will get a NullPointerException in MessagesTag due in line 250 (as of 1.1b3), which is (comment mine):

pageContext.setAttribute(id, msg);  // <-- msg can be null here!

The exception bubbles up to whatever handler is responsible for catching it, leaving a Struts newbie deeply confused and bug hunting for at least the next 30 minutes.

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