You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/12/20 15:17:05 UTC
svn commit: r1221267 -
/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
Author: noelgrandin
Date: Tue Dec 20 14:17:04 2011
New Revision: 1221267
URL: http://svn.apache.org/viewvc?rev=1221267&view=rev
Log:
improve content of exception messages we generate for dodgy parameters
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java?rev=1221267&r1=1221266&r2=1221267&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java Tue Dec 20 14:17:04 2011
@@ -299,7 +299,7 @@ public class TableView extends Component
*/
public void setWidth(int width, boolean relative) {
if (width < (relative ? 0 : -1)) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("illegal width " + width);
}
int previousWidth = this.width;
@@ -335,11 +335,12 @@ public class TableView extends Component
*/
public void setWidthLimits(int minimumWidth, int maximumWidth) {
if (minimumWidth < 0) {
- throw new IllegalArgumentException("Minimum width is negative.");
+ throw new IllegalArgumentException("Minimum width is negative, " + minimumWidth);
}
if (maximumWidth < minimumWidth) {
- throw new IllegalArgumentException("Maximum width is smaller than minimum width.");
+ throw new IllegalArgumentException("Maximum width is smaller than minimum width, "
+ + maximumWidth + "<" + minimumWidth);
}
int previousMinimumWidth = this.minimumWidth;
@@ -1469,8 +1470,12 @@ public class TableView extends Component
throw new IllegalArgumentException("range is null.");
}
- if (range.start < 0 || range.end >= tableData.getLength()) {
- throw new IndexOutOfBoundsException();
+ if (range.start < 0) {
+ throw new IndexOutOfBoundsException("range.start < 0, " + range.start);
+ }
+ if (range.end >= tableData.getLength()) {
+ throw new IndexOutOfBoundsException("range.end >= tableData length, "
+ + range.end + " >= " + tableData.getLength());
}
listSelection.addRange(range.start, range.end);
@@ -1580,8 +1585,12 @@ public class TableView extends Component
throw new IllegalStateException("Table view is not in multi-select mode.");
}
- if (start < 0 || end >= tableData.getLength()) {
- throw new IndexOutOfBoundsException();
+ if (start < 0) {
+ throw new IndexOutOfBoundsException("start < 0, " + start);
+ }
+ if (end >= tableData.getLength()) {
+ throw new IndexOutOfBoundsException("end >= tableData.getLength(), "
+ + end + " >= " + tableData.getLength());
}
Sequence<Span> addedRanges = rangeSelection.addRange(start, end);
@@ -1648,8 +1657,12 @@ public class TableView extends Component
throw new IllegalStateException("Table view is not in multi-select mode.");
}
- if (start < 0 || end >= tableData.getLength()) {
- throw new IndexOutOfBoundsException();
+ if (start < 0) {
+ throw new IndexOutOfBoundsException("start < 0, " + start);
+ }
+ if (end >= tableData.getLength()) {
+ throw new IndexOutOfBoundsException("end >= tableData.getLength(), "
+ + end + " >= " + tableData.getLength());
}
Sequence<Span> removedRanges = rangeSelection.removeRange(start, end);
@@ -1710,11 +1723,15 @@ public class TableView extends Component
* otherwise.
*/
public boolean isRowSelected(int index) {
- if (index < 0 || index >= tableData.getLength()) {
- throw new IndexOutOfBoundsException();
+ if (index < 0) {
+ throw new IndexOutOfBoundsException("index < 0, " + index);
+ }
+ if (index >= tableData.getLength()) {
+ throw new IndexOutOfBoundsException("index >= tableData.getLength(), "
+ + index + " >= " + tableData.getLength());
}
- return (rangeSelection.containsIndex(index));
+ return rangeSelection.containsIndex(index);
}
public Object getSelectedRow() {
@@ -1751,7 +1768,7 @@ public class TableView extends Component
@SuppressWarnings("unchecked")
public void setSelectedRows(Sequence<Object> rows) {
if (rows == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("rows is null");
}
ArrayList<Span> selectedRanges = new ArrayList<Span>();
@@ -1837,7 +1854,7 @@ public class TableView extends Component
*/
public Dictionary<String, SortDirection> setSort(Sequence<Dictionary.Pair<String, SortDirection>> sort) {
if (sort == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("sort is null");
}
sortMap.clear();
@@ -1867,7 +1884,7 @@ public class TableView extends Component
*/
public final Dictionary<String, SortDirection> setSort(String sort) {
if (sort == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("sort is null");
}
try {
@@ -1976,7 +1993,7 @@ public class TableView extends Component
public void setTableDataBindType(BindType tableDataBindType) {
if (tableDataBindType == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("tableDataBindType is null");
}
BindType previousTableDataBindType = this.tableDataBindType;
@@ -2019,7 +2036,7 @@ public class TableView extends Component
public void setSelectedRowBindType(BindType selectedRowBindType) {
if (selectedRowBindType == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("selectedRowBindType is null");
}
BindType previousSelectedRowBindType = this.selectedRowBindType;
@@ -2061,7 +2078,7 @@ public class TableView extends Component
public void setSelectedRowsBindType(BindType selectedRowsBindType) {
if (selectedRowsBindType == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("selectedRowsBindType is null");
}
BindType previousSelectedRowsBindType = this.selectedRowsBindType;