dev@javaserverfaces.java.net

[REVIEW:Fix - Issue 12]

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

Background
-----------------
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=12

The bug only surfaces in "client side" state saving.

M src/javax/faces/component/UIComponentBase.java
    - ony store a child's state if state is not null

M systest/src/com/sun/faces/systest/NavigationTestCase.java
    - new test case with verbatim tag

A systest/web/jsp/verbatim-one-test.jsp

Testing Status:
ri cactus/systest - check (note - not all tests run in client state
saving mode yet)
api test - check
cardemo - check (client/server)
characterCombat - check (client/server)
components - check (client/server)
guessNumber - check (client/server)
nonJsp - check (client/server)




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


Index: NavigationTestCase.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/systest/src/com/sun/faces/systest/NavigationTestCase.java,v
retrieving revision 1.5
diff -u -r1.5 NavigationTestCase.java
--- NavigationTestCase.java 1 May 2004 00:48:43 -0000 1.5
+++ NavigationTestCase.java 19 Jul 2004 16:06:19 -0000
@@ -120,4 +120,28 @@
             assertTrue(false);
         }
     }
+
+ public void testNavigateWithVerbatim_One() throws Exception {
+ HtmlForm form;
+ HtmlSubmitInput submit;
+ HtmlPage page, page1;
+
+ page = getPage("/faces/jsp/verbatim-one-test.jsp");
+ form = getFormById(page, "form");
+ assertNotNull("form exists", form);
+ submit = (HtmlSubmitInput)
+ form.getInputByName("form" + NamingContainer.SEPARATOR_CHAR +
+ "submit");
+
+ // press the link, return to the same page, and check that
+ // output text (header) is still present...
+
+ try {
+ page1 = (HtmlPage) submit.click();
+ assertTrue(-1 != page1.asText().indexOf("this is the header"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertTrue(false);
+ }
+ }
 }

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <h:outputText id="title" value="title"/>
verbatim text here

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