dev@javaserverfaces.java.net

Review: Fix for bug 6229938

From: Jayashri Visvanathan <Jayashri.Visvanathan_at_Sun.COM>
Date: Thu, 21 Jul 2005 15:52:20 -0700

Fix for bug 6299638
The ResponseStateManagerImpl.java file attempts to deserialize the
UIComponent t
ree when in client state saving using the system classloader (when this
jar file
 is not in the application's WEB-INF/lib directory). This is OK as long
as all
classes can be found via the system classloader. However, this does not
work wh
en application-defined classes are part of the UIComponent tree.

Fix already verified by Ken Paulsen

M com/sun/faces/application/ViewHandlerImpl.java
  remove logging the snapshot of the tree because this could result
  in Null Ptr if ResponseWriter is not set.

A com/sun/faces/renderkit/ApplicationObjectInputStream.java
  InputStream that resolves using WebApp class loader
  instead of the system classloader.

M com/sun/faces/renderkit/ResponseStateManagerImpl.java
  Use the new ApplicationObjectInputStream that knows how to resolve
  application objects.

M com/sun/faces/util/Util.java
  log JSF messages under webcontainer logger.


Index: com/sun/faces/application/ViewHandlerImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/application/ViewHandlerImpl.java,v
retrieving revision 1.54
diff -u -r1.54 ViewHandlerImpl.java
--- com/sun/faces/application/ViewHandlerImpl.java 9 Jun 2005 22:37:45 -0000 1.54
+++ com/sun/faces/application/ViewHandlerImpl.java 21 Jul 2005 22:45:32 -0000
@@ -105,10 +105,8 @@
         }
 
         if (logger.isLoggable(Level.FINE)) {
- String treePrintout =
- com.sun.faces.util.DebugUtil.printTree(viewToRender);
- logger.log(Level.FINE, "View after executing page: \n" +
- treePrintout);
+ logger.log(Level.FINE, "Completed building view for : \n" +
+ viewToRender.getViewId());
         }
 
         // set up the ResponseWriter
Index: com/sun/faces/renderkit/ResponseStateManagerImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/ResponseStateManagerImpl.java,v
retrieving revision 1.23
diff -u -r1.23 ResponseStateManagerImpl.java
--- com/sun/faces/renderkit/ResponseStateManagerImpl.java 18 Jul 2005 22:49:03 -0000 1.23
+++ com/sun/faces/renderkit/ResponseStateManagerImpl.java 21 Jul 2005 22:45:32 -0000
@@ -126,7 +126,7 @@
             GZIPInputStream gis = null;
             ObjectInputStream ois = null;
             boolean compress = isCompressStateSet(context);
-
+
             try {
                  byte[] bytes = byteArrayGuard.decrypt(context,
                     (Base64.decode(viewString.getBytes())));
@@ -136,9 +136,9 @@
                         logger.fine("Deflating state before restoring..");
                     }
                     gis = new GZIPInputStream(bis);
- ois = new ObjectInputStream(gis);
+ ois = new ApplicationObjectInputStream(gis);
                 } else {
- ois = new ObjectInputStream(bis);
+ ois = new ApplicationObjectInputStream(bis);
                 }
                 structure = ois.readObject();
                 state = ois.readObject();
Index: com/sun/faces/util/Util.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/util/Util.java,v
retrieving revision 1.166
diff -u -r1.166 Util.java
--- com/sun/faces/util/Util.java 20 Jul 2005 17:03:54 -0000 1.166
+++ com/sun/faces/util/Util.java 21 Jul 2005 22:45:32 -0000
@@ -74,7 +74,7 @@
     //
     // Private/Protected Constants
     //
- public static final String FACES_LOGGER = "javax.enterprise.resource.jsf";
+ public static final String FACES_LOGGER = "javax.enterprise.resource.webcontainer.jsf";
     
     public static final String FACES_LOG_STRINGS =
             "com.sun.faces.LogStrings";