You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2009/11/29 00:04:37 UTC

svn commit: r885163 - in /wicket/branches/wicket-1.4.x/wicket/src: main/java/org/apache/wicket/ test/java/org/apache/wicket/markup/html/form/validation/

Author: jdonnerstag
Date: Sat Nov 28 23:04:37 2009
New Revision: 885163

URL: http://svn.apache.org/viewvc?rev=885163&view=rev
Log:
fixed FeedbackPanel in FormComponentFeedbackBorder throws ConcurrentModificationException
Issue: WICKET-2589

Added:
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.html
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.java
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.html
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.java
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1_ExpectedResult.html
Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java
    wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePageTest.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java?rev=885163&r1=885162&r2=885163&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/Component.java Sat Nov 28 23:04:37 2009
@@ -2233,9 +2233,9 @@
 			List<Component> feedbacks = getRequestCycle().getMetaData(FEEDBACK_LIST);
 			if (feedbacks != null)
 			{
-				for (Component feedback : feedbacks)
+				for (int i = 0; i < feedbacks.size(); i++)
 				{
-					feedback.internalBeforeRender();
+					feedbacks.get(i).internalBeforeRender();
 				}
 			}
 			getRequestCycle().setMetaData(FEEDBACK_LIST, null);

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.html?rev=885163&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.html Sat Nov 28 23:04:37 2009
@@ -0,0 +1,8 @@
+<wicket:panel>
+	<form wicket:id="form">
+	  <div wicket:id="border">
+	    <input wicket:id="name"/>
+	    <div wicket:id="feedback"></div>
+	  </div>
+	</form>
+</wicket:panel>
\ No newline at end of file

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.java?rev=885163&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.java (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HereIsTheBug.java Sat Nov 28 23:04:37 2009
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.html.form.validation;
+
+import java.io.Serializable;
+
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.CompoundPropertyModel;
+
+/**
+ * 
+ */
+public class HereIsTheBug extends Panel
+{
+	private static final long serialVersionUID = 1L;
+
+	public HereIsTheBug(String id)
+	{
+		super(id);
+
+		Form<FormData> form = new Form<FormData>("form", new CompoundPropertyModel<FormData>(
+			new FormData()));
+		FormComponentFeedbackBorder border = new FormComponentFeedbackBorder("border");
+		TextField<String> textField = new TextField<String>("name");
+		textField.setRequired(true);
+		border.add(textField);
+		border.add(new FeedbackPanel("feedback"));
+		form.add(border);
+		add(form);
+	}
+
+	static class FormData implements Serializable
+	{
+		String _name;
+
+		public String getName()
+		{
+			return _name;
+		}
+
+		public void setName(String name)
+		{
+			_name = name;
+		}
+	}
+}

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.html?rev=885163&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.html Sat Nov 28 23:04:37 2009
@@ -0,0 +1,13 @@
+<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" >
+    <head>  
+        <title>Wicket Quickstart Archetype Homepage</title>
+    </head>
+    <body>
+        <strong>Wicket Quickstart Archetype Homepage</strong>
+        <br/><br/>
+        <span wicket:id="message">message will be here</span>
+        
+        <div wicket:id="bug"></div>
+    </body>
+</html>
+

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.java?rev=885163&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.java (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1.java Sat Nov 28 23:04:37 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.html.form.validation;
+
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+
+/**
+ * Homepage
+ */
+public class HomePage1 extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Constructor that is invoked when page is invoked without a session.
+	 * 
+	 * @param parameters
+	 *            Page parameters
+	 */
+	public HomePage1(final PageParameters parameters)
+	{
+		// Add the simplest type of label
+		add(new Label("message",
+			"If you see this message wicket is properly configured and running"));
+
+		add(new HereIsTheBug("bug"));
+	}
+}

Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1_ExpectedResult.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1_ExpectedResult.html?rev=885163&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1_ExpectedResult.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePage1_ExpectedResult.html Sat Nov 28 23:04:37 2009
@@ -0,0 +1,25 @@
+<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" >
+    <head>  
+        <title>Wicket Quickstart Archetype Homepage</title>
+    </head>
+    <body>
+        <strong>Wicket Quickstart Archetype Homepage</strong>
+        <br/><br/>
+        <span wicket:id="message">If you see this message wicket is properly configured and running</span>
+        
+        <div wicket:id="bug"><wicket:panel>
+	<form wicket:id="form" id="form1" method="post" action="?wicket:interface=:0:bug:form::IFormSubmitListener::"><div style="display:none"><input type="hidden" name="form1_hf_0" id="form1_hf_0" /></div>
+	  <div wicket:id="border"><wicket:border>
+		<wicket:body>
+	    <input wicket:id="name" value="" name="border:name"/>
+	    <div wicket:id="feedback"><wicket:panel>
+  
+</wicket:panel></div>
+	  </wicket:body>
+	    
+	</wicket:border></div>
+	</form>
+</wicket:panel></div>
+    </body>
+</html>
+

Modified: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePageTest.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePageTest.java?rev=885163&r1=885162&r2=885163&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePageTest.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/markup/html/form/validation/HomePageTest.java Sat Nov 28 23:04:37 2009
@@ -108,4 +108,12 @@
 		HomePage page = (HomePage)tester.getLastRenderedPage();
 		assertFalse((page.getFormSubmitted() & HomePage.NORMAL) == HomePage.NORMAL);
 	}
+
+	public void test_2589() throws Exception
+	{
+		tester = new WicketTester();
+		tester.startPage(HomePage1.class);
+		tester.assertRenderedPage(HomePage1.class);
+		tester.assertResultPage(getClass(), "HomePage1_ExpectedResult.html");
+	}
 }