From c0cd6cdc901dfd2d06cda45aa846588163e13e43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Wed, 11 Jun 2014 12:45:01 +0300 Subject: [PATCH] Remove invalid assert from FlyweightCell (#13334) If the cells in a row are iterated through more than once, the iterator will invoke FlyweightCell.setElement() on each iteration, firing the assert that was meant to guard against the client code setting the element more than once Change-Id: If498d36854864dd8c2252415e3c3ebbcea7beb0b --- .../src/com/vaadin/client/ui/grid/FlyweightCell.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/client/src/com/vaadin/client/ui/grid/FlyweightCell.java b/client/src/com/vaadin/client/ui/grid/FlyweightCell.java index a7d0ffa989..3364f71bd1 100644 --- a/client/src/com/vaadin/client/ui/grid/FlyweightCell.java +++ b/client/src/com/vaadin/client/ui/grid/FlyweightCell.java @@ -74,23 +74,21 @@ public class FlyweightCell { * or a TH element. */ public Element getElement() { + assertSetup(); return element; } /** * Sets the DOM element for this FlyweightCell, either a TD or - * a TH. This method should only be called when - * {@code getElement() == null}. It is the caller's responsibility to - * actually insert the given element to the document when needed. + * a TH. It is the caller's responsibility to actually insert + * the given element to the document when needed. * * @param element - * the element corresponding to this FlyweightCell + * the element corresponding to this cell, cannot be null */ void setElement(Element element) { assert element != null; - // When asserts are enabled, teardown() resets the element to null - // so this won't fire simply due to cell reuse - assert this.element == null : "Cell element can only be set once"; + assertSetup(); this.element = element; } -- 2.39.5