Author: ivaynberg
Date: Mon Feb  9 17:16:41 2009
New Revision: 742635

URL: http://svn.apache.org/viewvc?rev=742635&view=rev
Log:
fix stack overflow

Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java?rev=742635&r1=742634&r2=742635&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java 
(original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java 
Mon Feb  9 17:16:41 2009
@@ -592,7 +592,15 @@
                                {
                                        // Get submitting component
                                        final IFormSubmittingComponent 
submittingComponent = (IFormSubmittingComponent)component;
-                                       Form<?> form = 
Form.findForm((Component)submittingComponent);
+                                       final Form<?> form;
+                                       if (component instanceof 
IFormSubmittingComponent)
+                                       {
+                                               form = 
((IFormSubmittingComponent)component).getForm();
+                                       }
+                                       else
+                                       {
+                                               form = 
Form.findForm((Component)submittingComponent);
+                                       }
 
                                        // Check for component-name or 
component-name.x request string
                                        if ((form != null) && 
(form.getRootForm() == Form.this))
@@ -2215,10 +2223,6 @@
         */
        public static Form<?> findForm(Component component)
        {
-               if (component instanceof IFormSubmittingComponent)
-               {
-                       return ((IFormSubmittingComponent)component).getForm();
-               }
                class FindFormVisitor implements Component.IVisitor<Form<?>>
                {
                        Form<?> form = null;


Reply via email to