summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-01-16 09:29:33 +0200
committerDenis <denis@vaadin.com>2017-01-16 09:29:33 +0200
commit90f75534c36cf2932c58f97fadfe18582fd2a791 (patch)
tree5746b8fbb4c3fab56f23c0cab034b52037bdb59e /server
parenta00429697b8340a56568465694cac6549954a51f (diff)
downloadvaadin-framework-90f75534c36cf2932c58f97fadfe18582fd2a791.tar.gz
vaadin-framework-90f75534c36cf2932c58f97fadfe18582fd2a791.zip
Properly report invalid arguments to StaticRow.join() (#8243)
* Properly report invalid arguments to StaticRow.join() Closes #8234
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 7dd4c00609..9bd0c299ee 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -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)));
}