diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-09-15 20:16:42 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-09-15 20:16:42 +0200 |
| commit | 46b5dd9f3a7e482e451744ff9ea71919b83f5801 (patch) | |
| tree | b9572a348745714e2744e9de5a3521a108cd5fff /main | |
| parent | b45726aaab73836b1c69e14ff0f053975e427bb4 (diff) | |
| download | cgeo-46b5dd9f3a7e482e451744ff9ea71919b83f5801.zip cgeo-46b5dd9f3a7e482e451744ff9ea71919b83f5801.tar.gz cgeo-46b5dd9f3a7e482e451744ff9ea71919b83f5801.tar.bz2 | |
assertion badly triggered in tests of UTFGridPosition
* convert assertion to exception, as nobody noticed this before
* move tests to where they belong
Diffstat (limited to 'main')
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java b/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java index 5965fff..eff193a 100644 --- a/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java +++ b/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java @@ -15,9 +15,12 @@ public final class UTFGridPosition { private final static Pattern PATTERN_JSON_KEY = Pattern.compile("[^\\d]*" + "(\\d+),\\s*(\\d+)" + "[^\\d]*"); // (12, 34) public UTFGridPosition(final int x, final int y) { - assert x >= 0 && x <= UTFGrid.GRID_MAXX : "x outside bounds"; - assert y >= 0 && y <= UTFGrid.GRID_MAXY : "y outside bounds"; - + if (x < 0 || x > UTFGrid.GRID_MAXX) { + throw new IllegalArgumentException("x outside bounds"); + } + if (y < 0 || y > UTFGrid.GRID_MAXY) { + throw new IllegalArgumentException("y outside bounds"); + } this.x = x; this.y = y; } |
