Re: getAttribute(null)?

2008-06-17 Thread Mark Thomas

Leon Rosenberg wrote:

may I suggest that you add the same check also to that method :

protected void removeAttributeInternal(String name, boolean notify) {


That would help wouldn't it ;).

Done. Thanks for catching that.

Mark



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getAttribute(null)?

2008-06-16 Thread Leon Rosenberg
may I suggest that you add the same check also to that method :

protected void removeAttributeInternal(String name, boolean notify) {

// Remove this attribute from our collection
Object value = attributes.remove(name);

?
Thanx
Leon.


On Mon, Jun 16, 2008 at 9:25 AM, Mark Thomas <[EMAIL PROTECTED]> wrote:
>
> Leon Rosenberg wrote:
>>
>> P.S. probably it would be good if StandartSession would check for it
>>   return name==null ? null : (attributes.get(name));
>> instead of
>>   return (attributes.get(name));
>>
>> but they probably won't do it anyway:-)
>
> Oh yea of little faith.
>
> http://svn.apache.org/viewvc?rev=667604&view=rev
> and proposed for 5.5.x and 6.0.x
>
> Of course it needs 3 +1s to get in to the release branches...
>
> Mark
>
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getAttribute(null)?

2008-06-16 Thread Mark Thomas


Leon Rosenberg wrote:

P.S. probably it would be good if StandartSession would check for it
   return name==null ? null : (attributes.get(name));
instead of
   return (attributes.get(name));

but they probably won't do it anyway:-)

Oh yea of little faith.

http://svn.apache.org/viewvc?rev=667604&view=rev
and proposed for 5.5.x and 6.0.x

Of course it needs 3 +1s to get in to the release branches...

Mark


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getAttribute(null)?

2008-06-16 Thread Leon Rosenberg
On Thu, Jun 12, 2008 at 5:36 PM, Leffingwell, Jonathan R CTR FRCSE,
JAX 7.2.2 <[EMAIL PROTECTED]> wrote:
> 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?

I assume that it was the Hashtable -> Hashmap -> ConcurrentHashMap change.
Unlike the Hashtable and the ConcurrentHashMap the Hashmap allows
get(null) calls.
So in tomcat  50.19 - 5.0.30 & >5.5.9 is was hashmap and  worked,
changed that to hashtable (5.5.16?) and stoped working, changed to
concurrenthasmap in 6.x and remained not working. My versioning might
be inaccurate, but the timeline should be approx. right

regards
Leon


P.S. probably it would be good if StandartSession would check for it
   return name==null ? null : (attributes.get(name));
instead of
   return (attributes.get(name));

but they probably won't do it anyway:-)

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getAttribute(null)?

2008-06-12 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jonathan,

Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2 wrote:
| 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.

[snip]

| 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?

The servlet specification does not prohibit a NullPointerException from
being thrown, but it does seem like the method should probably return
null rather than throwing an NPE.

Could you post the stack trace of the exception?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhRh2IACgkQ9CaO5/Lv0PAOOgCfUWeV+OsSiqYjmkb24ueCduk4
BkMAn1bwrj3MldbyadbsKIWmPWrE9yVL
=IoqQ
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getAttribute(null)?

2008-06-12 Thread Johnny Kewl


- Original Message - 
From: "Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2" 
<[EMAIL PROTECTED]>

To: 
Sent: Thursday, June 12, 2008 4:44 PM
Subject: getAttribute(null)?


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?

==TEST==
This code
   HttpSession session = request.getSession(true);
   Object obj = session.getAttribute(null);

Raises this exception

java.lang.NullPointerException
java.util.Hashtable.get(Unknown Source)
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1024)
 
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
 NewServlet.processRequest(NewServlet.java:29) 
NewServlet.doGet(NewServlet.java:52) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:690) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)The Hash Table is 
throwing it...I'm too young to remember 5 ;)But you maybe right, its possible 
that the internals used to use a Vector...and when Java introduced new 
collections, it changed.You may have spotted a little regression issue, but 
probably something thathasnt caught too many people.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: getAttribute(null)?

2008-06-12 Thread Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2
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 [mailto:[EMAIL PROTECTED] 
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..

http://struts.apache.org/1.2.7/api/org/apache/struts/config/ActionConfig
.html#getParameter()
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
http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts
2/dispatcher/mapper/ActionMapping.html

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
http://publib.boulder.ibm.com/infocenter/wsadhelp/v5r1m2/index.jsp?topic
=/com.sun.api.doc/java/util/Map.html

//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
=mapping.getParams().get(formKey);

Let me know if does'nt conform to your understanding..
HTH
Martin
__
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: [EMAIL PROTECTED]
> To: users@tomcat.apache.org
> 
> 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
SkyDrive.
<http://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Ref
resh_skydrive_062008> 

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



getAttribute(null)?

2008-06-12 Thread Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2
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?