You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Ryan Lubke <Ry...@Sun.COM> on 2002/10/01 02:04:13 UTC
Re: cvs commit:
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime
PageContextImpl.java
Jan,
Think it would make more sense if the message was soemthing like
"Name or attribute value was null"?
On Mon, 2002-09-30 at 19:58, luehe@apache.org wrote:
> luehe 2002/09/30 16:58:58
>
> Modified: jasper2/src/share/org/apache/jasper/runtime
> PageContextImpl.java
> Log:
> Fixed 13140: Compliance issue - PageContext.setAttribute, under
> certain circumstances, fails to throw an NPE when the value provided
> is null
>
> Revision Changes Path
> 1.23 +16 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java
>
> Index: PageContextImpl.java
> ===================================================================
> RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
> retrieving revision 1.22
> retrieving revision 1.23
> diff -u -r1.22 -r1.23
> --- PageContextImpl.java 30 Sep 2002 23:45:03 -0000 1.22
> +++ PageContextImpl.java 30 Sep 2002 23:58:58 -0000 1.23
> @@ -232,11 +232,16 @@
> }
>
> public Object getAttribute(String name) {
> +
> + if (name == null) throw new NullPointerException("Null name");
> return attributes.get(name);
> }
>
>
> public Object getAttribute(String name, int scope) {
> +
> + if (name == null) throw new NullPointerException("Null name");
> +
> switch (scope) {
> case PAGE_SCOPE:
> return attributes.get(name);
> @@ -261,11 +266,19 @@
>
>
> public void setAttribute(String name, Object attribute) {
> +
> + if (name == null || attribute == null)
> + throw new NullPointerException("Null name or attribute value");
> +
> attributes.put(name, attribute);
> }
>
>
> public void setAttribute(String name, Object o, int scope) {
> +
> + if (name == null || o == null)
> + throw new NullPointerException("Null name or attribute value");
> +
> switch (scope) {
> case PAGE_SCOPE:
> attributes.put(name, o);
>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>