You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2014/01/07 22:34:42 UTC

svn commit: r1556362 - /myfaces/portlet-bridge/core/branches/PS5_Debug/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java

Author: mfreedman
Date: Tue Jan  7 21:34:42 2014
New Revision: 1556362

URL: http://svn.apache.org/r1556362
Log:
Added ability to dump the BridgeRequest scope for easier debugging/analysis of problems related to Attrs managed in the bridge's request scope but shouldn't be.

Modified:
    myfaces/portlet-bridge/core/branches/PS5_Debug/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java

Modified: myfaces/portlet-bridge/core/branches/PS5_Debug/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/branches/PS5_Debug/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java?rev=1556362&r1=1556361&r2=1556362&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/branches/PS5_Debug/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java (original)
+++ myfaces/portlet-bridge/core/branches/PS5_Debug/impl/src/main/java/org/apache/myfaces/portlet/faces/bridge/BridgeImpl.java Tue Jan  7 21:34:42 2014
@@ -2108,7 +2108,7 @@ public class BridgeImpl
         portletContext.setAttribute(REQUEST_SCOPE_MAP, requestScopeMap);
       }
     
-      Map<String, Object> existing = requestScopeMap.get(scopeId);;
+      Map<String, Object> existing = requestScopeMap.get(scopeId);
       if (mergeExisting)
       {
         // Because we didn't restore them at the beginning of the request
@@ -2141,20 +2141,21 @@ public class BridgeImpl
       // during the (render) request.  This is essentially any attribute In the RENDER_PHASE Log the diff between
       // the Map we are about to write as the new request scope (o) compared to to the old one.  I.e. if an attribute
       // is in (o) and not in the (existing) map then it was added during the render.
-      if (FacesContext.getCurrentInstance() != null && BridgeUtil.getPortletRequestPhase() == Bridge.PortletPhase.RENDER_PHASE)
+      if (FacesContext.getCurrentInstance() != null)
       {
-        dumpRenderRequestScopeDiff(o, existing);
+        dumpRenderRequestScopeDiff(o, existing, BridgeUtil.getPortletRequestPhase());
       }
       
       requestScopeMap.put(scopeId, o);
     }
   }
 
-  private void dumpRenderRequestScopeDiff(Map<String, Object> newScopeMap, Map<String, Object> currentScopeMap)
+  private void dumpRenderRequestScopeDiff(Map<String, Object> newScopeMap, Map<String, Object> currentScopeMap, Bridge.PortletPhase phase)
   {
     final String title = "Render Request --  new request attributes:";
+    final String title2 = "Resource Request -- new attributes:";
     final String eol = System.getProperty("line.separator");
-    StringBuffer sbMessage = new StringBuffer(64).append(title).append(eol);
+    StringBuffer sbMessage = new StringBuffer(64).append((phase == Bridge.PortletPhase.RENDER_PHASE) ? title : title2).append(eol);
     PortletContext pContext = mPortletConfig.getPortletContext();
     boolean hasNew = false;
 
@@ -2170,8 +2171,16 @@ public class BridgeImpl
     }
     
     if (!hasNew)
-      sbMessage.append("  No new request attrs added in this Render!");
-    
+    {
+      if (phase == Bridge.PortletPhase.RENDER_PHASE)
+      {
+        sbMessage.append("  No new request attrs added in this Render!");
+      }
+      else
+      {
+        sbMessage.append("  No new request attrs added in this Resource!");
+      }
+    }
     // Log the information
     String logMessage = sbMessage.toString();
     pContext.log(logMessage);