Revision: 1466
          http://stripes.svn.sourceforge.net/stripes/?rev=1466&view=rev
Author:   bengunter
Date:     2012-02-08 14:33:24 +0000 (Wed, 08 Feb 2012)
Log Message:
-----------
Opted for a much simpler solution to STS-817 that shifts the burden to 
LayoutComponentRenderer from LayoutRenderTag and fixes the NPE reported when 
testing the previous fix.

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentRenderer.java
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentRenderer.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentRenderer.java
  2012-02-07 15:10:54 UTC (rev 1465)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentRenderer.java
  2012-02-08 14:33:24 UTC (rev 1466)
@@ -119,12 +119,14 @@
             this.context = context;
 
             // Take a snapshot of the context state
+            final LayoutContext savedNext = context.getNext();
             final String savedComponent = context.getComponent();
             final boolean savedComponentRenderPhase = 
context.isComponentRenderPhase();
             final boolean savedSilent = context.getOut().isSilent();
 
             try {
                 // Set up the context to render the component
+                context.setNext(null);
                 context.setComponentRenderPhase(true);
                 context.setComponent(this.component);
                 context.getOut().setSilent(true, pageContext);
@@ -143,6 +145,7 @@
             }
             finally {
                 // Restore the context state
+                context.setNext(savedNext);
                 context.setComponent(savedComponent);
                 context.setComponentRenderPhase(savedComponentRenderPhase);
                 context.getOut().setSilent(savedSilent, pageContext);

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java
  2012-02-07 15:10:54 UTC (rev 1465)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java
  2012-02-08 14:33:24 UTC (rev 1466)
@@ -38,7 +38,7 @@
     private static final Log log = Log.getInstance(LayoutRenderTag.class);
 
     private String name;
-    private LayoutContext context, forkedContext;
+    private LayoutContext context;
     private boolean contextIsNew, silent;
     private BodyContent bodyContent;
 
@@ -53,24 +53,9 @@
         if (context == null) {
             LayoutContext context = LayoutContext.lookup(pageContext);
 
-            boolean create = context == null;
-            if (!create) {
-                boolean rendering = context.isComponentRenderPhase();
-                LayoutContext next = context.getNext();
+            boolean create = context == null || 
!context.isComponentRenderPhase()
+                    || isChildOfCurrentComponent();
 
-                if (next == null) {
-                    create = !rendering || rendering && 
isChildOfCurrentComponent();
-                }
-                else {
-                    create = rendering && isChildOfCurrentComponent();
-                    if (create) {
-                        log.debug("Encountered a fork in the rendering path");
-                        forkedContext = next;
-                        context.setNext(null);
-                    }
-                }
-            }
-
             if (create)
                 context = LayoutContext.push(this);
 
@@ -214,11 +199,6 @@
             throw new JspException(e);
         }
         finally {
-            if (this.forkedContext != null) {
-                this.context.setNext(this.forkedContext);
-                this.forkedContext = null;
-            }
-
             this.context = null;
             this.contextIsNew = false;
             this.silent = false;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to