dev@javaserverfaces.java.net

Re: [REVIEW] Minor fix to Util.getScope()

From: Roger Kitain <Roger.Kitain_at_Sun.COM>
Date: Mon, 09 Aug 2004 16:44:48 -0400

Assuming all tests [ri / api/ demos] run...

r=rogerk

Ryan Lubke wrote:

> The recent scope change by Roger allowed the TCK to expose a
> problem in Util.getScope(). The test previously passed, but for
> the wrong reason.
>
> SECTION: Modified Files
> -------------------------------------
> M src/com/sun/faces/util/Util.java
> - Removed logic, that after validating a particular scope, would
> check for a non-null value when evaluating the expression.
> Null is a valid return. We're only concerned with the scope
> in this case.
>
> M test/com/sun/faces/el/TestValueBindingImpl.java
> - Test modification to reflect changes above.
>
>
> SECTION: Diffs
> -------------------------------------
> Index: src/com/sun/faces/util/Util.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/Util.java,v
> retrieving revision 1.142
> diff -u -r1.142 Util.java
> --- src/com/sun/faces/util/Util.java 26 Jul 2004 21:12:44 -0000
> 1.142
> +++ src/com/sun/faces/util/Util.java 9 Aug 2004 20:07:42 -0000
> @@ -1374,28 +1374,13 @@
> outString[0] = identifier;
> }
> if (identifier.equalsIgnoreCase(RIConstants.REQUEST_SCOPE)) {
> - if ((expression != null) &&
> - (ec.getRequestMap().get(expression) != null)) {
> - return RIConstants.REQUEST;
> - } else {
> - return null;
> - }
> + return RIConstants.REQUEST;
> }
> if (identifier.equalsIgnoreCase(RIConstants.SESSION_SCOPE)) {
> - if ((expression != null) &&
> - (Util.getSessionMap(context).get(expression) != null)) {
> - return RIConstants.SESSION;
> - } else {
> - return null;
> - }
> + return RIConstants.SESSION;
> }
> if (identifier.equalsIgnoreCase(RIConstants.APPLICATION_SCOPE)) {
> - if ((expression != null) &&
> - (ec.getApplicationMap().get(expression) != null)) {
> - return RIConstants.APPLICATION;
> - } else {
> - return null;
> - }
> + return RIConstants.APPLICATION;
> }
>
> // handle implicit objects
> Index: test/com/sun/faces/el/TestValueBindingImpl.java
> ===================================================================
> RCS file:
> /cvs/javaserverfaces-sources/jsf-ri/test/com/sun/faces/el/TestValueBindingImpl.java,v
>
> retrieving revision 1.32
> diff -u -r1.32 TestValueBindingImpl.java
> --- test/com/sun/faces/el/TestValueBindingImpl.java 7 May 2004
> 13:53:25 -0000 1.32
> +++ test/com/sun/faces/el/TestValueBindingImpl.java 9 Aug 2004
> 20:07:45 -0000
> @@ -682,11 +682,7 @@
> property = null;
> assertNull(Util.getScope(property, null));
> property = "foo.sessionScope";
> - assertNull(Util.getScope(property, null));
> - property = "sessionScope";
> - assertNull(Util.getScope(property, null));
> - property = "sessionScope[";
> - assertNull(Util.getScope(property, null));
> + assertNull(Util.getScope(property, null));
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net