tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2" <>
Subject RE: getAttribute(null)?
Date Thu, 12 Jun 2008 15:36:09 GMT
It's not the "why is formName null?" that I'm worried about.  In this
case, it's supposed to be null.

What I want to know is this: Is a NullPointerException supposed to be
thrown if the argument "name" in session.getAttribute(name) is NULL?  If
such an exception IS supposed to be thrown, was this a change put into
Tomcat 5.5.x that wasn't in 5.0.x?

-----Original Message-----
From: Martin Gainty [] 
Sent: Thursday, June 12, 2008 11:24 AM
To: Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2
Subject: RE: getAttribute(null)?

At that point you're talking to the Struts 1.x Base class ActionConfig
getParameter method..
where JavaDoc for this parameter is defined as

public java.lang.String getParameter()

	Return general purpose configuration parameter that can be used
to pass extra information to the Action instance selected by this
Action. Struts does not itself use this value in any way.

As of Struts 2.0.11

the getParameter() method has been refined e.g.

    /** @return The extra parameters */
    public java.util.Map getParams() {
        return params;

relevant doc on java.util.Map

//code look something like
//assume the key for the form attribute will be called Form1 String
formKey=new String("Form1");

//And now to acquire the value for the Form1 key String value

Let me know if does'nt conform to your understanding..
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and
Sender does not endorse distribution to any party other than intended
recipient. Sender does not necessarily endorse content contained within
this transmission. 

> Subject: getAttribute(null)?
> Date: Thu, 12 Jun 2008 10:44:06 -0400
> From:
> To:
> I have the following code that worked in Tomcat 5.0, but doesn't work 
> in Tomcat 5.5.26:
> String formName = mapping.getAttribute(); // mapping is a variable of 
> type ActionMapping. In this scenario, formName is null.
> if (null != session.getAttribute(formName)) { 
> session.removeAttribute(formName);
> }
> formName is null. In Tomcat 5.0.x, no exception was thrown and 
> processing continued (as if passing a null argument to getAttribute 
> simply returned NULL). In Tomcat 5.5.26, a ServletException is thrown 
> (with a NullPointerException).
> I know how to code a work-around (and have done so), but is this 
> considered a bug in Tomcat?


Enjoy 5 GB of free, password-protected online storage. Get Windows Live

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message