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: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>