----- Original Message -----
> From: "Edward Burns" <edward.burns_at_oracle.com>
> To: jsr369-experts_at_servlet-spec.java.net
> Sent: Thursday, 13 August, 2015 8:54:24 AM
> Subject: [jsr369-experts] Re: [servlet-spec users] [SERVLET_SPEC-83] ServletContext getInitParameter(),
> getAttribute() and null values
>
> >>>>> On Wed, 12 Aug 2015 15:06:22 -0700, Shing Wai Chan
> >>>>> <shing.wai.chan_at_oracle.com> said:
>
> SW> Using String("null") in this case may not be a good idea as it
> SW> introduces some special meaning of the String("null").
> SW> I notice that different implementations seems to behave differently for
> SW> ServletContext.getInitParameter(null).
> SW> In GlassFish, it is NPE.
> SW> In WebLogic, it is null.
>
> Ahh, I misunderstood you. I thought the issue was asking about what to
> return if the someone had done
>
> <init-param>
> <param-name>SomeValue</param-name>
> <param-value></param-value>
> </init-param>
>
> What do you think we should do in that case?
I think we should return the empty string, this way there is no possibility of ambiguity, otherwise
<init-param>
<param-name>SomeValue</param-name>
<param-value></param-value>
</init-param>
and
<init-param>
<param-name>SomeValue</param-name>
<param-value>null</param-value>
</init-param>
Return the same thing. I really don't think any of our users will appreciate having to manually check if a string is "null" to know that it is supposed to represent an empty value.
In terms of ServletContext.getInitParameter(null) I think we should throw a NPE (which is what Undertow does at the moment).
Stuart
>
> I agree that we should throw NPE if the argument is null.
>
> Ed
>
> --
> | edward.burns_at_oracle.com | office: +1 407 458 0017
> | 59 Business days til JavaOne 2015
> | 74 Business days til DOAG 2015
>