From 7d74479ccaceb5a2eaa82b89016a9a45a5f3e181 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Mon, 10 Mar 2014 10:59:44 +0000 Subject: Revert "Fixes a memory leak on IE8 in LayoutManagerIE8 (#12688)" This reverts commit 024692835d1e2af1a4053821959f03f8d5eb4fcb. Change-Id: I19cf6ee66a21f7eb07d0f1fd8b9698ae88454700 --- client/src/com/vaadin/client/LayoutManager.java | 9 -- client/src/com/vaadin/client/LayoutManagerIE8.java | 18 +--- .../extensions/LayoutMemoryUsageIE8Extension.java | 36 ------- .../tests/layouts/IE8MeasuredSizeMemoryLeak.java | 111 --------------------- .../layouts/IE8MeasuredSizeMemoryLeakTest.java | 54 ---------- .../LayoutMemoryUsageIE8ExtensionConnector.java | 45 --------- 6 files changed, 3 insertions(+), 270 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java delete mode 100644 uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java delete mode 100644 uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java delete mode 100644 uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index 5b27031a29..1ced003146 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -74,15 +74,6 @@ public class LayoutManager { this.connection = connection; } - /** - * Returns the application connection for this layout manager. - * - * @return connection - */ - protected ApplicationConnection getConnection() { - return connection; - } - /** * Gets the layout manager associated with the given * {@link ApplicationConnection}. diff --git a/client/src/com/vaadin/client/LayoutManagerIE8.java b/client/src/com/vaadin/client/LayoutManagerIE8.java index b7973310db..a692f126a2 100644 --- a/client/src/com/vaadin/client/LayoutManagerIE8.java +++ b/client/src/com/vaadin/client/LayoutManagerIE8.java @@ -19,8 +19,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.Node; import com.google.gwt.user.client.ui.RootPanel; /** @@ -39,12 +39,6 @@ public class LayoutManagerIE8 extends LayoutManager { private Map measuredSizes = new HashMap(); - // this method is needed to test for memory leaks (see - // LayoutMemoryUsageIE8ExtensionConnector) but can be private - private int getMeasuredSizesMapSize() { - return measuredSizes.size(); - } - @Override protected void setMeasuredSize(Element element, MeasuredSize measuredSize) { if (measuredSize != null) { @@ -68,18 +62,12 @@ public class LayoutManagerIE8 extends LayoutManager { @Override protected void cleanMeasuredSizes() { Profiler.enter("LayoutManager.cleanMeasuredSizes"); - - // #12688: IE8 was leaking memory when adding&removing components. - // Uses IE specific logic to figure if an element has been removed from - // DOM or not. For this the parent element of the current UI is needed. - // For removed elements the measured size is discarded. - Node rootNode = getConnection().getUIConnector().getWidget() - .getElement().getParentNode(); + Document document = RootPanel.get().getElement().getOwnerDocument(); Iterator i = measuredSizes.keySet().iterator(); while (i.hasNext()) { Element e = i.next(); - if (!rootNode.isOrHasChild(e)) { + if (e.getOwnerDocument() != document) { i.remove(); } } diff --git a/uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java b/uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java deleted file mode 100644 index c69c2b4d30..0000000000 --- a/uitest/src/com/vaadin/tests/extensions/LayoutMemoryUsageIE8Extension.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.extensions; - -import com.vaadin.server.AbstractExtension; -import com.vaadin.ui.UI; - -/** - * Test extension for finding out the size of the measuredSizes map of - * LayoutManagerIE8. - * - * This UI extension uses JSNI to register a JavaScript method - * window.vaadin.getMeasuredSizesCount() that can be used to query the size of - * the internal map of the layout manager. It should only be used on IE8. - * - * @since 7.1.13 - * @author Vaadin Ltd - */ -public class LayoutMemoryUsageIE8Extension extends AbstractExtension { - public void extend(UI target) { - super.extend(target); - } -} diff --git a/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java b/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java deleted file mode 100644 index 7da9e46653..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeak.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.layouts; - -import com.vaadin.annotations.Widgetset; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.tests.extensions.LayoutMemoryUsageIE8Extension; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.HasComponents; -import com.vaadin.ui.Label; -import com.vaadin.ui.VerticalLayout; - -@Widgetset("com.vaadin.tests.widgetset.TestingWidgetSet") -public class IE8MeasuredSizeMemoryLeak extends AbstractTestUI { - - private boolean state = false; - - private HasComponents component1 = new VerticalLayout() { - { - for (int i = 1; i <= 200; i++) { - String idText = "ID:" + i; - Label c = new Label(idText); - c.setId(idText); - addComponent(c); - } - } - }; - - private HasComponents component2 = new VerticalLayout() { - { - for (int i = 201; i <= 400; i++) { - String idText = "ID:" + i; - Label c = new Label(idText); - c.setId(idText); - addComponent(c); - } - } - }; - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. - * VaadinRequest) - */ - @Override - protected void setup(VaadinRequest request) { - new LayoutMemoryUsageIE8Extension().extend(this); - - VerticalLayout layout = new VerticalLayout(); - setContent(layout); - - final VerticalLayout contentLayout = new VerticalLayout(); - - Button button = new Button("Toggle"); - button.setId("toggle"); - button.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - contentLayout.removeAllComponents(); - if (state) { - contentLayout.addComponent(component1); - } else { - contentLayout.addComponent(component2); - } - state = !state; - } - - }); - - layout.addComponent(button); - layout.addComponent(contentLayout); - - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() - */ - @Override - protected String getTestDescription() { - return "IE8 leaks memory when components are added and removed"; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() - */ - @Override - protected Integer getTicketNumber() { - return 12688; - } -} diff --git a/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java b/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java deleted file mode 100644 index c9bd64c881..0000000000 --- a/uitest/src/com/vaadin/tests/layouts/IE8MeasuredSizeMemoryLeakTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.layouts; - -import java.util.Collections; -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.remote.DesiredCapabilities; - -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class IE8MeasuredSizeMemoryLeakTest extends MultiBrowserTest { - - @Test - public void testMeasuredSizesMapCleaned() { - openTestURL(); - Assert.assertEquals("No extra measured sizes in the beginning", 3, - getMeasuredSizesMapSize()); - vaadinElementById("toggle").click(); - Assert.assertEquals("Measured sizes after single toggle", 204, - getMeasuredSizesMapSize()); - vaadinElementById("toggle").click(); - Assert.assertEquals("Measured sizes cleaned on toggle", 204, - getMeasuredSizesMapSize()); - } - - private int getMeasuredSizesMapSize() { - JavascriptExecutor jsExec = (JavascriptExecutor) getDriver(); - Number result = (Number) jsExec - .executeScript("return window.vaadin.getMeasuredSizesCount();"); - return result.intValue(); - } - - @Override - public List getBrowsersToTest() { - return Collections.singletonList(Browser.IE8.getDesiredCapabilities()); - } -} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java deleted file mode 100644 index c92e688520..0000000000 --- a/uitest/src/com/vaadin/tests/widgetset/client/LayoutMemoryUsageIE8ExtensionConnector.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed 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 com.vaadin.tests.widgetset.client; - -import com.vaadin.client.BrowserInfo; -import com.vaadin.client.LayoutManager; -import com.vaadin.client.LayoutManagerIE8; -import com.vaadin.client.ServerConnector; -import com.vaadin.client.extensions.AbstractExtensionConnector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.tests.extensions.LayoutMemoryUsageIE8Extension; - -@Connect(LayoutMemoryUsageIE8Extension.class) -public class LayoutMemoryUsageIE8ExtensionConnector extends - AbstractExtensionConnector { - - @Override - protected void extend(ServerConnector target) { - if (BrowserInfo.get().isIE8()) { - LayoutManagerIE8 manager = (LayoutManagerIE8) LayoutManager - .get(getConnection()); - configureGetMapSizeJS(manager); - } - } - - private native void configureGetMapSizeJS(LayoutManagerIE8 manager) - /*-{ - $wnd.vaadin.getMeasuredSizesCount = function() { - return manager.@com.vaadin.client.LayoutManagerIE8::getMeasuredSizesMapSize()(); - }; - }-*/; -} -- cgit v1.2.3 From c121c4e5ad72ab0705552ad8c614f179fc214a41 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 10 Mar 2014 13:55:39 +0200 Subject: Do not fail assertion if re-setting the same lock (#13440) Change-Id: I2e7e9dcf8739a04583d8e42a86a1fede36011813 --- server/src/com/vaadin/server/VaadinService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index 216adce3c8..eda794438f 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -521,8 +521,13 @@ public abstract class VaadinService implements Serializable { * The lock object */ private void setSessionLock(WrappedSession wrappedSession, Lock lock) { - assert wrappedSession != null : "Can't set a lock for a null session"; - assert wrappedSession.getAttribute(getLockAttributeName()) == null : "Changing the lock for a session is not allowed"; + if (wrappedSession == null) { + throw new IllegalArgumentException( + "Can't set a lock for a null session"); + } + Object currentSessionLock = wrappedSession + .getAttribute(getLockAttributeName()); + assert (currentSessionLock == null || currentSessionLock == lock) : "Changing the lock for a session is not allowed"; wrappedSession.setAttribute(getLockAttributeName(), lock); } -- cgit v1.2.3 From c0e408c325a8b5465bfad4526a16a473928c17f4 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 10 Mar 2014 13:42:17 +0200 Subject: Added nojavadoc parameter to "all" build script. Change-Id: Id83983e7fd81612354c6b15037a6749ba3dda55a --- all/build.xml | 64 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/all/build.xml b/all/build.xml index 36a9499dea..0d6f48fc32 100644 --- a/all/build.xml +++ b/all/build.xml @@ -35,35 +35,41 @@ - - - - - - - - - - - - - - <h1>${title}</h1> - - ${javadoc.bottom} - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + <h1>${title}</h1> + + ${javadoc.bottom} + + + + + + + + + + + -- cgit v1.2.3 From 0417c063514eccb34075bc41268398f5cab05947 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Mon, 10 Mar 2014 18:07:35 +0200 Subject: Fixed nojavadoc parameter on "all" build. Change-Id: I336cbee8bf33591552034c1cdf29d34fc49e3c43 --- all/build.xml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/all/build.xml b/all/build.xml index 0d6f48fc32..65980e9b05 100644 --- a/all/build.xml +++ b/all/build.xml @@ -37,12 +37,14 @@ - - - + + + + + @@ -63,14 +65,14 @@ + + + + + + - - - - - - -- cgit v1.2.3 From 71e8c7efa9cef900b3307aab0d0fd4d9470810a2 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 11 Mar 2014 18:15:47 +0200 Subject: Make ExcludeFromSuite annotation Runtime and Inherited Change-Id: I35169d1560ae5e1b9a057d6350de14947f6155ae --- uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java | 9 +++++++++ uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java | 6 +----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java b/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java index 722b643f78..5208838028 100644 --- a/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java +++ b/uitest/src/com/vaadin/tests/tb3/ExcludeFromSuite.java @@ -15,6 +15,12 @@ */ package com.vaadin.tests.tb3; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + /** * Marker interface for a TB3+ test class which will exclude the test from any * test suite which automatically scans for test classes. Mostly useful for long @@ -23,6 +29,9 @@ package com.vaadin.tests.tb3; * @since 7.1.10 * @author Vaadin Ltd */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Inherited public @interface ExcludeFromSuite { } diff --git a/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java b/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java index f1576a9393..5878e8ab15 100644 --- a/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java +++ b/uitest/src/com/vaadin/tests/tb3/TB3TestSuite.java @@ -246,11 +246,7 @@ public class TB3TestSuite extends Suite { if (c.getAnnotation(ExcludeFromSuite.class) != null) { return false; } - if (c == Object.class) { - return true; - } - - return includeInSuite(c.getSuperclass()); + return true; } } \ No newline at end of file -- cgit v1.2.3