Ignore:
Timestamp:
2015-06-19T23:34:50+02:00 (10 years ago)
Author:
Don-vip
Message:

fix some Sonar issues

File:
1 edited

Legend:

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

    r8443 r8506  
    2626     * @throws IllegalArgumentException if the primitive ID is not valid (negative or zero)
    2727     */
    28     public static void ensureValidPrimitiveId(PrimitiveId id, String parameterName) throws IllegalArgumentException {
     28    public static void ensureValidPrimitiveId(PrimitiveId id, String parameterName) {
    2929        ensureParameterNotNull(id, parameterName);
    3030        if (id.getUniqueId() <= 0)
    31             throw new IllegalArgumentException(MessageFormat.format("Expected unique id > 0 for primitive ''{1}'', got {0}", id.getUniqueId(), parameterName));
     31            throw new IllegalArgumentException(
     32                    MessageFormat.format("Expected unique id > 0 for primitive ''{1}'', got {0}", id.getUniqueId(), parameterName));
    3233    }
    3334
     
    3940     * @since 5980
    4041     */
    41     public static void ensureValidCoordinates(LatLon latlon, String parameterName) throws IllegalArgumentException {
     42    public static void ensureValidCoordinates(LatLon latlon, String parameterName) {
    4243        ensureParameterNotNull(latlon, parameterName);
    4344        if (!latlon.isValid())
    44             throw new IllegalArgumentException(MessageFormat.format("Expected valid lat/lon for parameter ''{0}'', got {1}", parameterName, latlon));
     45            throw new IllegalArgumentException(
     46                    MessageFormat.format("Expected valid lat/lon for parameter ''{0}'', got {1}", parameterName, latlon));
    4547    }
    4648
     
    5254     * @since 5980
    5355     */
    54     public static void ensureValidCoordinates(EastNorth eastnorth, String parameterName) throws IllegalArgumentException {
     56    public static void ensureValidCoordinates(EastNorth eastnorth, String parameterName) {
    5557        ensureParameterNotNull(eastnorth, parameterName);
    5658        if (!eastnorth.isValid())
    57             throw new IllegalArgumentException(MessageFormat.format("Expected valid east/north for parameter ''{0}'', got {1}", parameterName, eastnorth));
     59            throw new IllegalArgumentException(
     60                    MessageFormat.format("Expected valid east/north for parameter ''{0}'', got {1}", parameterName, eastnorth));
    5861    }
    5962
     
    6467     * @throws IllegalArgumentException if the version is not valid (negative)
    6568     */
    66     public static void ensureValidVersion(long version, String parameterName) throws IllegalArgumentException {
     69    public static void ensureValidVersion(long version, String parameterName) {
    6770        if (version < 0)
    68             throw new IllegalArgumentException(MessageFormat.format("Expected value of type long > 0 for parameter ''{0}'', got {1}", parameterName, version));
     71            throw new IllegalArgumentException(
     72                    MessageFormat.format("Expected value of type long > 0 for parameter ''{0}'', got {1}", parameterName, version));
    6973    }
    7074
     
    7579     * @throws IllegalArgumentException if the parameter is {@code null}
    7680     */
    77     public static void ensureParameterNotNull(Object value, String parameterName) throws IllegalArgumentException {
     81    public static void ensureParameterNotNull(Object value, String parameterName) {
    7882        if (value == null)
    7983            throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' must not be null", parameterName));
     
    8690     * @since 3871
    8791     */
    88     public static void ensureParameterNotNull(Object value) throws IllegalArgumentException {
     92    public static void ensureParameterNotNull(Object value) {
    8993        if (value == null)
    9094            throw new IllegalArgumentException("Parameter must not be null");
     
    96100     * @throws IllegalArgumentException if the condition does not hold
    97101     */
    98     public static void ensureThat(boolean condition, String message) throws IllegalArgumentException {
     102    public static void ensureThat(boolean condition, String message) {
    99103        if (!condition)
    100104            throw new IllegalArgumentException(message);
     
    104108     * Ensures that <code>id</code> is non-null primitive id of type {@link OsmPrimitiveType#NODE}
    105109     *
    106      * @param id  the primitive  id
     110     * @param id the primitive  id
    107111     * @param parameterName the name of the parameter to be checked
    108112     * @throws IllegalArgumentException if id is null
    109113     * @throws IllegalArgumentException if id.getType() != NODE
    110114     */
    111     public static void ensureValidNodeId(PrimitiveId id, String parameterName) throws IllegalArgumentException {
     115    public static void ensureValidNodeId(PrimitiveId id, String parameterName) {
    112116        ensureParameterNotNull(id, parameterName);
    113117        if (!id.getType().equals(OsmPrimitiveType.NODE))
    114             throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' of type node expected, got ''{1}''", parameterName, id.getType().getAPIName()));
     118            throw new IllegalArgumentException(
     119                    MessageFormat.format("Parameter ''{0}'' of type node expected, got ''{1}''", parameterName, id.getType().getAPIName()));
    115120    }
    116121}
Note: See TracChangeset for help on using the changeset viewer.