You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2012/01/18 23:50:12 UTC

svn commit: r1233103 - in /myfaces/trinidad/trunk/trinidad-api/src/main: java/org/apache/myfaces/trinidad/component/UIXComponent.java xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts

Author: arobinson74
Date: Wed Jan 18 22:50:11 2012
New Revision: 1233103

URL: http://svn.apache.org/viewvc?rev=1233103&view=rev
Log:
TRINIDAD-2203 add logging to setup/tearDown methods to help debug contextual issues

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
    myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=1233103&r1=1233102&r2=1233103&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java Wed Jan 18 22:50:11 2012
@@ -930,7 +930,16 @@ abstract public class UIXComponent exten
    */
   protected void setupVisitingContext(@SuppressWarnings("unused") FacesContext context)
   {
-    // do nothing
+    if (_inVisitingContext)
+    {
+      _LOG.warning("COMPONENT_ALREADY_IN_VISITING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+
+    _inVisitingContext = true;
   }
 
   /**
@@ -948,7 +957,16 @@ abstract public class UIXComponent exten
    */
   protected void setupChildrenVisitingContext(@SuppressWarnings("unused") FacesContext context)
   {
-    // do nothing
+    if (_inChildrenVisitingContext)
+    {
+      _LOG.warning("COMPONENT_ALREADY_IN_CHILDREN_VISITING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+
+    _inChildrenVisitingContext = true;
   }
 
   /**
@@ -966,7 +984,15 @@ abstract public class UIXComponent exten
    */
   protected void tearDownVisitingContext(@SuppressWarnings("unused") FacesContext context)
   {
-    // do nothing
+    if (!_inVisitingContext)
+    {
+      _LOG.warning("COMPONENT_NOT_IN_VISITING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+    _inVisitingContext = false;
   }
 
   /**
@@ -983,7 +1009,15 @@ abstract public class UIXComponent exten
    */
   protected void tearDownChildrenVisitingContext(@SuppressWarnings("unused") FacesContext context)
   {
-    // do nothing
+    if (!_inChildrenVisitingContext)
+    {
+      _LOG.warning("COMPONENT_NOT_IN_CHILDREN_VISITING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+    _inChildrenVisitingContext = false;
   }
 
   @Deprecated
@@ -1020,6 +1054,15 @@ abstract public class UIXComponent exten
    */
   protected void setupEncodingContext(FacesContext context, RenderingContext rc)
   {
+    if (_inEncodingContext)
+    {
+      _LOG.warning("COMPONENT_ALREADY_IN_ENCODING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+
     setupVisitingContext(context);
 
     Renderer renderer = getRenderer(context);
@@ -1030,6 +1073,8 @@ abstract public class UIXComponent exten
 
       coreRenderer.setupEncodingContext(context, rc, (UIComponent)this);
     }
+
+    _inEncodingContext = true;
   }
 
   /**
@@ -1043,6 +1088,15 @@ abstract public class UIXComponent exten
    */
   public void setupChildrenEncodingContext(FacesContext context, RenderingContext rc)
   {
+    if (_inChildrenEncodingContext)
+    {
+      _LOG.warning("COMPONENT_ALREADY_IN_CHILDREN_ENCODING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+
     setupChildrenVisitingContext(context);
 
     Renderer renderer = getRenderer(context);
@@ -1053,6 +1107,7 @@ abstract public class UIXComponent exten
 
       coreRenderer.setupChildrenEncodingContext(context, rc, this);
     }
+    _inChildrenEncodingContext = true;
   }
 
   /**
@@ -1076,6 +1131,15 @@ abstract public class UIXComponent exten
     FacesContext context,
     RenderingContext rc)
   {
+    if (!_inEncodingContext)
+    {
+      _LOG.warning("COMPONENT_NOT_IN_ENCODING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+
     Renderer renderer = getRenderer(context);
 
     try
@@ -1090,6 +1154,7 @@ abstract public class UIXComponent exten
     finally
     {
       tearDownVisitingContext(context);
+      _inEncodingContext = false;
     }
   }
 
@@ -1106,6 +1171,15 @@ abstract public class UIXComponent exten
     FacesContext context,
     RenderingContext rc)
   {
+    if (!_inChildrenEncodingContext)
+    {
+      _LOG.warning("COMPONENT_NOT_IN_CHILDREN_ENCODING_CONTEXT", getClientId(context));
+      if (_LOG.isFine())
+      {
+        Thread.currentThread().dumpStack();
+      }
+    }
+
     Renderer renderer = getRenderer(context);
 
     try
@@ -1120,6 +1194,7 @@ abstract public class UIXComponent exten
     finally
     {
       tearDownChildrenVisitingContext(context);
+      _inChildrenEncodingContext = false;
     }
   }
 
@@ -1258,6 +1333,11 @@ abstract public class UIXComponent exten
     return UIPanel.class == componentClass;
   }
 
+  private boolean _inVisitingContext;
+  private boolean _inChildrenVisitingContext;
+  private boolean _inEncodingContext;
+  private boolean _inChildrenEncodingContext;
+
   private static final TrinidadLogger _LOG =
     TrinidadLogger.createTrinidadLogger(UIXComponent.class);
-}
+}
\ No newline at end of file

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts?rev=1233103&r1=1233102&r2=1233103&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts Wed Jan 18 22:50:11 2012
@@ -483,4 +483,28 @@
 <!-- COLLECTION_NOT_IN_CONTEXT  -->
 <resource key="COLLECTION_NOT_IN_CONTEXT">The row key or row index of a UIXCollection component is being changed outside of the component's context. Changing the key or index of a collection when the collection is not currently being visited, invoked on, broadcasting an event or processing a lifecycle method, is not valid. Data corruption and errors may result from this call. Component ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
 
+<!-- COMPONENT_ALREADY_IN_CHILDREN_ENCODING_CONTEXT -->
+<resource key="COMPONENT_ALREADY_IN_CHILDREN_ENCODING_CONTEXT">setupChildrenEncodingContext called on a component that is already in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
+<!-- COMPONENT_ALREADY_IN_CHILDREN_VISITING_CONTEXT -->
+<resource key="COMPONENT_ALREADY_IN_CHILDREN_VISITING_CONTEXT">setupChildrenVisitingContext called on a component that is already in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
+<!-- COMPONENT_NOT_IN_CHILDREN_ENCODING_CONTEXT -->
+<resource key="COMPONENT_NOT_IN_CHILDREN_ENCODING_CONTEXT">tearDownChildrenEncodingContext called on a component that is not in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
+<!-- COMPONENT_NOT_IN_CHILDREN_VISITING_CONTEXT -->
+<resource key="COMPONENT_NOT_IN_CHILDREN_VISITING_CONTEXT">tearDownChildrenVisitingContext called on a component that is not in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
+<!-- COMPONENT_ALREADY_IN_ENCODING_CONTEXT -->
+<resource key="COMPONENT_ALREADY_IN_ENCODING_CONTEXT">setupEncodingContext called on a component that is already in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
+<!-- COMPONENT_ALREADY_IN_VISITING_CONTEXT -->
+<resource key="COMPONENT_ALREADY_IN_VISITING_CONTEXT">setupVisitingContext called on a component that is already in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
+<!-- COMPONENT_NOT_IN_ENCODING_CONTEXT -->
+<resource key="COMPONENT_NOT_IN_ENCODING_CONTEXT">tearDownEncodingContext called on a component that is not in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
+<!-- COMPONENT_NOT_IN_VISITING_CONTEXT -->
+<resource key="COMPONENT_NOT_IN_VISITING_CONTEXT">tearDownVisitingContext called on a component that is not in context. Client ID: {0}. Turn on fine level logging for a stack trace of this call.</resource>
+
 </resources>