Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 11720)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 11721)
@@ -1507,8 +1507,11 @@
      * @param max maximum value
      * @return the value
+     * @throws IllegalArgumentException if min > max
      * @since 10805
      */
     public static double clamp(double val, double min, double max) {
-        if (val < min) {
+        if (min > max) {
+            throw new IllegalArgumentException(MessageFormat.format("Parameter min ({0}) cannot be greather than max ({1})", min, max));
+        } else if (val < min) {
             return min;
         } else if (val > max) {
@@ -1525,8 +1528,11 @@
      * @param max maximum value
      * @return the value
+     * @throws IllegalArgumentException if min > max
      * @since 11055
      */
     public static int clamp(int val, int min, int max) {
-        if (val < min) {
+        if (min > max) {
+            throw new IllegalArgumentException(MessageFormat.format("Parameter min ({0}) cannot be greather than max ({1})", min, max));
+        } else if (val < min) {
             return min;
         } else if (val > max) {
