dev@javaserverfaces.java.net

Review: Fix for ISsue 136, 135, 139

From: Jayashri Visvanathan <Jayashri.Visvanathan_at_Sun.COM>
Date: Fri, 01 Jul 2005 16:55:18 -0700

Fix for JSF RI 136, 139, 135
M src/com/sun/faces/lifecycle/LifecycleImpl.java
  Fix for Issue 136. Request serviced should be set even in non JSP 2.1
  environment.
  For Issue 135: Introduce a catch block around phase.execute() and remove
  the finally block.

M src/com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.java
  Fix for Issue 139. Converter.getAsString() should be invoked for null
values

Fix are also posted to the issues.


Index: src/com/sun/faces/lifecycle/LifecycleImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/lifecycle/LifecycleImpl.java,v
retrieving revision 1.50
diff -u -r1.50 LifecycleImpl.java
--- src/com/sun/faces/lifecycle/LifecycleImpl.java 23 Jun 2005 20:29:33 -0000 1.50
+++ src/com/sun/faces/lifecycle/LifecycleImpl.java 1 Jul 2005 23:18:34 -0000
@@ -242,32 +242,36 @@
             if (!skipping(phaseId, context)) {
                 phase.execute(context);
             }
- }
- finally {
- try {
- // Notify the "afterPhase" method of interested listeners
- // (descending)
- if (tempListeners.size() > 0) {
- PhaseEvent event = new PhaseEvent(context, phaseId, this);
- for (i = maxBefore; i >= 0; i--) {
- PhaseListener listener = (PhaseListener)
- tempListeners.get(i);
- if (phaseId.equals(listener.getPhaseId()) ||
- PhaseId.ANY_PHASE.equals(listener.getPhaseId())) {
- listener.afterPhase(event);
- }
+ } catch (Exception e) {
+ // Log the problem, but continue
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("executePhase(" + phaseId.toString() + ","
+ + context + ") threw exception", e);
+ }
+ }
+
+ try {
+ // Notify the "afterPhase" method of interested listeners
+ // (descending)
+ if (tempListeners.size() > 0) {
+ PhaseEvent event = new PhaseEvent(context, phaseId, this);
+ for (i = maxBefore; i >= 0; i--) {
+ PhaseListener listener = (PhaseListener)
+ tempListeners.get(i);
+ if (phaseId.equals(listener.getPhaseId()) ||
+ PhaseId.ANY_PHASE.equals(listener.getPhaseId())) {
+ listener.afterPhase(event);
                     }
                 }
- }
- catch (Throwable e) {
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("phase(" + phaseId.toString() + "," + context +
- ") threw exception: " + e + " " + e.getMessage() +
- "\n" + Util.getStackTraceString(e));
- }
- }
- }
-
+ }
+ }
+ catch (Throwable e) {
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.warning("phase(" + phaseId.toString() + "," + context +
+ ") threw exception: " + e + " " + e.getMessage() +
+ "\n" + Util.getStackTraceString(e));
+ }
+ }
     }
 
 
@@ -327,12 +331,17 @@
             // been populated already.
             return;
         }
- ApplicationAssociate appAssociate =
- ApplicationAssociate.getInstance(context.getExternalContext());
- synchronized(this) {
+
+ synchronized(applicationMap) {
             requestServiced = (String)
                 applicationMap.get(this.FIRST_REQUEST_SERVICED);
             if (requestServiced == null) {
+ // this needs to be set irrespective whether the FacesResolvers
+ // are added to compositeELResolverForJsp or not.
+ applicationMap.put(this.FIRST_REQUEST_SERVICED, "true");
+
+ ApplicationAssociate appAssociate =
+ ApplicationAssociate.getInstance(context.getExternalContext());
                 CompositeELResolver compositeELResolverForJsp =
                         appAssociate.getFacesELResolverForJsp();
                 if (compositeELResolverForJsp == null) {
@@ -381,7 +390,7 @@
                         compositeELResolverForJsp.add((ELResolver) it.next());
                     }
                 }
- applicationMap.put(this.FIRST_REQUEST_SERVICED, "true");
+
             }
         }
     }
Index: src/com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.java,v
retrieving revision 1.95
diff -u -r1.95 HtmlBasicRenderer.java
--- src/com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.java 23 Jun 2005 15:31:33 -0000 1.95
+++ src/com/sun/faces/renderkit/html_basic/HtmlBasicRenderer.java 1 Jul 2005 23:18:34 -0000
@@ -256,9 +256,7 @@
 
         String currentValue = null;
         Object currentObj = getValue(component);
- if (currentObj != null) {
- currentValue = getFormattedValue(context, component, currentObj);
- }
+ currentValue = getFormattedValue(context, component, currentObj);
         return currentValue;
     }