dev@javaserverfaces.java.net

Re: [1108-FlashFacesMessages] Dan Allen: Question

From: Dan Allen <dan.j.allen_at_gmail.com>
Date: Wed, 17 Jun 2009 17:07:38 -0400

Ed,

To be perfectly honest, I can't quite make sense of how the ELFlash
works. But I can tell you with absolute positivity that the ELFlash
implements was hitting a NullPointerException when setKeepMessages()
was called before a redirect. Putting the flag in the request map
rather than the cookie map eliminates the NullPointerException and
successfully saves the messages across a redirect. My guess is that
the flag is interpreted somewhere else before the request ends and the
values are ultimately put in the cookie.

If you want to change the code, just be sure to put a test somewhere
that validates the behavior of setKeepMessages(). There can't be a
test now because everyone I know that has tried to use the
functionality gets the NullPointerException.

-Dan

P.S. You can continue to CC my gmail address because I am not on the
javaserverfaces.dev.java.net list yet.

On Mon, Jun 15, 2009 at 2:30 PM, Ed Burns<Ed.Burns_at_sun.com> wrote:
> Hello Dan,
>
> Are you sure you want to move those to the request map, rather than the
> cookie map?
>
> bash-3.00$ svn log -r 7414
> ------------------------------------------------------------------------
> r7414 | mojavelinux | 2009-06-10 13:14:58 -0700 (Wed, 10 Jun 2009) | 3 lines
>
> fix for issue 1108
> put the FacesMessages in the request map rather than the cookie map
>
> ------------------------------------------------------------------------
> bash-3.00$ svn diff -r 7414 -r 7413
> svn: Multiple revision arguments encountered; can't specify -c twice, or both -c and -r
> bash-3.00$ svn diff -r 7414:7413
> Index: jsf-ri/src/com/sun/faces/context/flash/ELFlash.java
> ===================================================================
> --- jsf-ri/src/com/sun/faces/context/flash/ELFlash.java (revision 7414)
> +++ jsf-ri/src/com/sun/faces/context/flash/ELFlash.java (revision 7413)
> @@ -322,7 +322,7 @@
>         boolean isRedirect = this.isRedirect();
>         if (null != allFacesMessages) {
>             if (isRedirect) {
> -                this.getThisRequestMap(context).put(Constants.FACES_MESSAGES_ATTRIBUTE_NAME,
> +                this.getMapForCookie(context).put(Constants.FACES_MESSAGES_ATTRIBUTE_NAME,
>                         allFacesMessages);
>
>             } else {
>
> They need to be there for the next request, which is why I had them in
> the cookie map.
>
> Please respond and tell me why you think this fixed the problem?
>
> Thanks,
>
> Ed
>
> P.S. Please let me know if I should no longer Cc your gmail address when
> I write a message to dov_at_javaserverfaces intended for you.
> --
> | ed.burns_at_sun.com  | office: 408 884 9519 OR x31640
> | homepage:         | http://ridingthecrest.com/
>



-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan
NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters.  Please don't hesitate to resend a message if
you feel that it did not reach my attention.