]> source.dussan.org Git - vaadin-framework.git/commitdiff
Properly report invalid arguments to StaticRow.join() (#8243)
authorArtur <artur@vaadin.com>
Mon, 16 Jan 2017 07:29:33 +0000 (09:29 +0200)
committerDenis <denis@vaadin.com>
Mon, 16 Jan 2017 07:29:33 +0000 (09:29 +0200)
* Properly report invalid arguments to StaticRow.join()

Closes #8234

server/src/main/java/com/vaadin/ui/Grid.java

index 7dd4c006092443b6ec6384873e667f1da404af17..9bd0c299ee96df2d3a276561d50302a38fc03df1 100644 (file)
@@ -2339,14 +2339,17 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
             }
 
             /**
-             * Merges columns cells in a row
+             * Merges columns cells in a row.
              *
              * @param propertyIds
              *            The property ids of columns to merge
              * @return The remaining visible cell after the merge
              */
             public CELLTYPE join(Object... propertyIds) {
-                assert propertyIds.length > 1 : "You need to merge at least 2 properties";
+                if (propertyIds.length < 2) {
+                    throw new IllegalArgumentException(
+                            "You need to merge at least 2 properties");
+                }
 
                 Set<CELLTYPE> cells = new HashSet<CELLTYPE>();
                 for (int i = 0; i < propertyIds.length; ++i) {
@@ -2357,14 +2360,17 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
             }
 
             /**
-             * Merges columns cells in a row
+             * Merges columns cells in a row.
              *
              * @param cells
              *            The cells to merge. Must be from the same row.
              * @return The remaining visible cell after the merge
              */
             public CELLTYPE join(CELLTYPE... cells) {
-                assert cells.length > 1 : "You need to merge at least 2 cells";
+                if (cells.length < 2) {
+                    throw new IllegalArgumentException(
+                            "You need to merge at least 2 cells");
+                }
 
                 return join(new HashSet<CELLTYPE>(Arrays.asList(cells)));
             }