jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: [servlet-spec users] [SERVLET_SPEC-83] ServletContext getInitParameter(), getAttribute() and null values

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Wed, 12 Aug 2015 15:06:22 -0700

Using String("null") in this case may not be a good idea as it
introduces some special meaning of the String("null").
I notice that different implementations seems to behave differently for
ServletContext.getInitParameter(null).
In GlassFish, it is NPE.
In WebLogic, it is null.

Shing Wai Chan

On 8/12/15, 2:13 PM, Edward Burns wrote:
> Hello Volunteers,
>
> Shing-wai had filed this issue a while ago and I needed to make an API
> change to test out some CSS for the javadoc. This seemed like a good
> way to do two things at once.
>
> From the issue:
>
> 8<--------------------
>
> In the javadoc of ServletContext#getInitParameter, we have
>
> Returns a String containing the value of the named context-wide
> initialization parameter, or null if the parameter does not exist.
>
> What happens when the name parameter is null? Should we throw NPE?
>
> Similar issue for #getAttribute? We would like to have a more
> consistence answer for these?
>
> 8<--------------------
>
> I propose we return the literal string "null" without the quotes in both
> cases.
>
> Comments?
>
> Thanks,
>
> Ed
>