dev@javaserverfaces.java.net

Re: [REVIEW:Fix - Issue 12]

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Mon, 19 Jul 2004 13:24:21 -0700

>>>>> On Mon, 19 Jul 2004 12:40:51 -0400, Roger Kitain <Roger.Kitain_at_Sun.COM> said:

I appreciate your thorough testing. Something this core has to be
thoroughly tested.

I don't understand how this change fixes the bug however. Can you
please explain it?

RK> Index: UIComponentBase.java
RK> ===================================================================
RK> RCS file: /cvs/javaserverfaces-sources/jsf-api/src/javax/faces/component/UIComponentBase.java,v
RK> retrieving revision 1.101
RK> diff -u -r1.101 UIComponentBase.java
RK> --- UIComponentBase.java 16 Jun 2004 00:06:55 -0000 1.101
RK> +++ UIComponentBase.java 19 Jul 2004 16:05:38 -0000
RK> @@ -943,7 +943,6 @@
RK> * @exception NullPointerException {_at_inheritDoc}
RK> */
RK> public Object processSaveState(FacesContext context) {
RK> -
RK> if (context == null) {
RK> throw new NullPointerException();
RK> }
RK> @@ -964,7 +963,10 @@
RK> Iterator kids = getChildren().iterator();
RK> while (kids.hasNext()) {
RK> UIComponent kid = (UIComponent) kids.next();
RK> - childState[i++] = kid.processSaveState(context);
RK> + Object savedState = kid.processSaveState(context);
RK> + if (savedState != null) {
RK> + childState[i++] = savedState;
RK> + }
RK> }

I would think that you'd want to increment "i" each time around the
while loop, regardless of savedState being null. Otherwise, the
restoreState may not synch up, right? Perhaps I'm missing something.

Also, you're going to have a null in that slot anyway, even if you skip
filling it in with the null return from processSaveState(). We
initialize childState to be new Object[len].

Can you please explain why this works?

Thanks,

Ed

-- 
| ed.burns_at_sun.com  | {home: 407 294 2468, office: 408 884 9519 OR x31640}
| homepage:         | http://javaweb.sfbay.sun.com/~edburns/
| aim: edburns0sunw | iim: ed.burns_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net