Ignore:
Timestamp:
2010-01-13T20:22:11+01:00 (14 years ago)
Author:
mjulius
Message:

fix messages for the rest

File:
1 edited

Legend:

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

    r2801 r2853  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.openstreetmap.josm.tools.I18n.tr;
     4import java.text.MessageFormat;
    55
    66import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    1717
    1818    public static void ensureValidPrimitiveId(PrimitiveId id, String parameterName) throws IllegalArgumentException {
    19         if (id == null)
    20             throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", parameterName));
     19        ensureParameterNotNull(id, parameterName);
    2120        if (id.getUniqueId() <= 0)
    22             throw new IllegalArgumentException(tr("Expected unique id > 0 for primitive id, got {0}", id.getUniqueId()));
     21            throw new IllegalArgumentException(MessageFormat.format("Expected unique id > 0 for primitive ''{1}'', got {0}", id.getUniqueId(), parameterName));
    2322    }
    2423
    2524    public static void ensureValidVersion(long version, String parameterName) throws IllegalArgumentException {
    2625        if (version < 0)
    27             throw new IllegalArgumentException(tr("Expected value of type long > 0 for parameter ''{0}'', got {1}", parameterName, version));
     26            throw new IllegalArgumentException(MessageFormat.format("Expected value of type long > 0 for parameter ''{0}'', got {1}", parameterName, version));
    2827    }
    2928
    3029    public static void ensureParameterNotNull(Object value, String parameterName) {
    3130        if (value == null)
    32             throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", parameterName));
     31            throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' must not be null", parameterName));
    3332    }
    3433
     
    4241     */
    4342    public static void ensureValidNodeId(PrimitiveId id, String parameterName) throws IllegalArgumentException {
    44         if (id == null)
    45             throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null", parameterName));
     43        ensureParameterNotNull(id, parameterName);
    4644        if (! id.getType().equals(OsmPrimitiveType.NODE))
    47             throw new IllegalArgumentException(tr("Parameter ''{0}'' of type node expected, got ''{1}''", parameterName, id.getType().getAPIName()));
     45            throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' of type node expected, got ''{1}''", parameterName, id.getType().getAPIName()));
    4846    }
    4947}
Note: See TracChangeset for help on using the changeset viewer.