Revision: 496
          http://svn.sourceforge.net/stripes/?rev=496&view=rev
Author:   tfenne
Date:     2007-03-27 04:57:32 -0700 (Tue, 27 Mar 2007)

Log Message:
-----------
Merge of fix for STS-333: InputTagSupport doesn't sufficiently clean up state 
if an error renderer throws an exception

Modified Paths:
--------------
    branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java

Modified: 
branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java
===================================================================
--- branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java 
2007-03-27 11:56:08 UTC (rev 495)
+++ branches/1.4.x/stripes/src/net/sourceforge/stripes/tag/InputTagSupport.java 
2007-03-27 11:57:32 UTC (rev 496)
@@ -340,22 +340,28 @@
      * @return int the value returned by the child class from doStartInputTag()
      */
     public final int doEndTag() throws JspException {
-        int result = doEndInputTag();
+        // Wrap in a try/finally because a custom error renderer could throw an
+        // exception, and some containers in their infinite wisdom continue to
+        // cache/pool the tag even after a JSPException is thrown!
+        try {
+            int result = doEndInputTag();
 
-        if (getFieldErrors() != null) {
-            this.errorRenderer.doAfterEndTag();
-        }
+            if (getFieldErrors() != null) {
+                this.errorRenderer.doAfterEndTag();
+            }
 
-        if (this.focus) {
-            makeFocused();
+            if (this.focus) {
+                makeFocused();
+            }
+
+            return result;
         }
-
-        this.errorRenderer = null;
-        this.fieldErrors = null;
-        this.fieldErrorsLoaded = false;
-        this.focus = false;
-
-        return result;
+        finally {
+            this.errorRenderer = null;
+            this.fieldErrors = null;
+            this.fieldErrorsLoaded = false;
+            this.focus = false;
+        }
     }
 
     /** Rethrows the passed in throwable in all cases. */


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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to