Author: hlship
Date: Wed Jul 20 02:21:58 2011
New Revision: 1148599

URL: http://svn.apache.org/viewvc?rev=1148599&view=rev
Log:
TAP5-1580: A Form with an event listener for "canceled" event can cause an NPE 
popping off a BeanEditContext from the Environment that wasn't pushed

Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java?rev=1148599&r1=1148598&r2=1148599&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
 Wed Jul 20 02:21:58 2011
@@ -499,12 +499,16 @@ public class Form implements ClientEleme
 
         try
         {
+            environment.push(BeanValidationContext.class, new 
BeanValidationContextImpl(validate));
+
             resources.triggerContextEvent(EventConstants.PREPARE_FOR_SUBMIT, 
context, eventCallback);
 
             if (eventCallback.isAborted())
                 return true;
 
             resources.triggerContextEvent(EventConstants.PREPARE, context, 
eventCallback);
+            if (eventCallback.isAborted())
+                return true;
 
             if (isFormCancelled())
             {
@@ -513,12 +517,6 @@ public class Form implements ClientEleme
                     return true;
             }
 
-
-            environment.push(BeanValidationContext.class, new 
BeanValidationContextImpl(validate));
-
-            if (eventCallback.isAborted())
-                return true;
-
             executeStoredActions();
 
             heartbeat.end();


Reply via email to