Ignore:
Timestamp:
2014-12-20T22:43:20+01:00 (9 years ago)
Author:
Don-vip
Message:

global cleanup of IllegalArgumentExceptions thrown by JOSM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/Range.java

    r7069 r7864  
    1313    public static final Range ZERO_TO_INFINITY = new Range(0.0, Double.POSITIVE_INFINITY);
    1414
     15    /**
     16     * Constructs a new {@code Range}.
     17     * @param lower Lower bound. Must be positive or zero
     18     * @param upper Upper bound
     19     * @throws IllegalArgumentException if the range is invalid ({@code lower < 0 || lower >= upper})
     20     */
    1521    public Range(double lower, double upper) {
    1622        if (lower < 0 || lower >= upper)
    17             throw new IllegalArgumentException();
     23            throw new IllegalArgumentException("Invalid range: "+lower+"-"+upper);
    1824        this.lower = lower;
    1925        this.upper = upper;
     
    2935    public static Range cut(Range a, Range b) {
    3036        if (b.lower >= a.upper || b.upper <= a.lower)
    31             throw new IllegalArgumentException();
     37            throw new IllegalArgumentException("Ranges do not overlap: "+a+" - "+b);
    3238        return new Range(Math.max(a.lower, b.lower), Math.min(a.upper, b.upper));
    3339    }
     
    4955    public Range reduceAround(double x, Range other) {
    5056        if (!contains(x))
    51             throw new IllegalArgumentException();
     57            throw new IllegalArgumentException(x+" is not inside "+this);
    5258        if (other.contains(x))
    53             throw new IllegalArgumentException();
     59            throw new IllegalArgumentException(x+" is inside "+other);
    5460
    5561        if (x < other.lower && other.lower < upper)
Note: See TracChangeset for help on using the changeset viewer.