Ed Burns wrote:
>While working on another issue, I discovered that we weren't
>implementing containsKey properly in our Maps that we use in
>ExternalContext.
>
>
Ed,
The containsKey() method is already implemented as these maps
inherit from AbstractMap.
Additionally, TestExternalContextImpl and the TCK both validate
that the Maps behave as expected.
>Please review. Testcase forthcoming.
>
>Ed
>
>Index: jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java
>===================================================================
>RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java,v
>retrieving revision 1.28
>diff -u -r1.28 ExternalContextImpl.java
>--- jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java 21 Apr 2005 18:55:35 -0000 1.28
>+++ jsf-ri/src/com/sun/faces/context/ExternalContextImpl.java 27 Apr 2005 17:11:48 -0000
>@@ -504,6 +504,12 @@
> return servletContext.getAttribute(key.toString());
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != servletContext.getAttribute(key.toString()));
>+ }
>
> public Object put(Object key, Object value) {
> if (key == null) {
>@@ -563,6 +569,12 @@
> return getSession().getAttribute(key.toString());
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != getSession().getAttribute(key.toString()));
>+ }
>
> public Object put(Object key, Object value) {
> if (key == null) {
>@@ -629,6 +641,14 @@
> }
> return request.getAttribute(key.toString());
> }
>+
>+
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != request.getAttribute(key.toString()));
>+ }
>
>
> public Object put(Object key, Object value) {
>@@ -691,6 +711,12 @@
> return request.getParameter(key.toString());
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != request.getParameter(key.toString()));
>+ }
>
> public Set entrySet() {
> Set entries = new HashSet();
>@@ -732,6 +758,12 @@
> return request.getParameterValues(key.toString());
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != request.getParameterValues(key.toString()));
>+ }
>
> public Set entrySet() {
> Set entries = new HashSet();
>@@ -774,6 +806,12 @@
> return (request.getHeader(key.toString()));
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != request.getHeader(key.toString()));
>+ }
>
> public Set entrySet() {
> Set entries = new HashSet();
>@@ -815,6 +853,12 @@
> return (request).getHeaders(key.toString());
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != (request).getHeaders(key.toString()));
>+ }
>
> public Set entrySet() {
> Set entries = new HashSet();
>@@ -928,6 +972,12 @@
> return result;
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != this.get(key.toString()));
>+ }
>
> public Set entrySet() {
> Set entries = new HashSet();
>@@ -972,6 +1022,12 @@
> return servletContext.getInitParameter(keyString);
> }
>
>+ public boolean containsKey(Object key) {
>+ if (key == null) {
>+ throw new NullPointerException();
>+ }
>+ return (null != servletContext.getInitParameter(key.toString()));
>+ }
>
> public Set entrySet() {
> Set entries = new HashSet();
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
>For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>
>
>