Changeset 16054 in josm for trunk


Ignore:
Timestamp:
2020-03-07T13:08:06+01:00 (5 years ago)
Author:
simon04
Message:

ImageResource: use CheckParameterUtil

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageResource.java

    r15906 r16054  
    155155     */
    156156    public ImageIcon getImageIcon(Dimension dim, boolean multiResolution) {
    157         if (dim.width < -1 || dim.width == 0 || dim.height < -1 || dim.height == 0)
    158             throw new IllegalArgumentException(dim+" is invalid");
     157        CheckParameterUtil.ensureThat((dim.width > 0 || dim.width == -1) && (dim.height > 0 || dim.height == -1),
     158                () -> dim + " is invalid");
    159159        BufferedImage img = imgCache.get(dim);
    160160        if (img == null) {
     
    243243     */
    244244    public ImageIcon getImageIconBounded(Dimension maxSize, boolean multiResolution) {
    245         if (maxSize.width < -1 || maxSize.width == 0 || maxSize.height < -1 || maxSize.height == 0)
    246             throw new IllegalArgumentException(maxSize+" is invalid");
     245        CheckParameterUtil.ensureThat((maxSize.width > 0 || maxSize.width == -1) && (maxSize.height > 0 || maxSize.height == -1),
     246                () -> maxSize + " is invalid");
    247247        float sourceWidth;
    248248        float sourceHeight;
Note: See TracChangeset for help on using the changeset viewer.