Changeset 8506 in josm


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

fix some Sonar issues

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

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

    r8497 r8506  
    17591759
    17601760    /**
     1761     * Sets the given online resource to online state.
     1762     * @param r the online resource
     1763     * @return {@code true} if {@code r} was offline
     1764     * @since 8506
     1765     */
     1766    public static boolean setOnline(OnlineResource r) {
     1767        return OFFLINE_RESOURCES.remove(r);
     1768    }
     1769
     1770    /**
    17611771     * Replies the set of online resources currently offline.
    17621772     * @return the set of online resources currently offline
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r8393 r8506  
    436436                        }
    437437                    }
    438                     // if we get here, all the Tracks are finished; Continue with
    439                     // Routes
     438                    // if we get here, all the Tracks are finished; Continue with Routes
    440439                    itTracks = null;
    441440                }
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java

    r8468 r8506  
    3838        /**
    3939         * Constructs a new {@code Bookmark} with the given contents.
    40          * @param list Bookmark contents as a list of 5 elements. First item is the name, then come bounds arguments (minlat, minlon, maxlat, maxlon)
     40         * @param list Bookmark contents as a list of 5 elements.
     41         * First item is the name, then come bounds arguments (minlat, minlon, maxlat, maxlon)
    4142         * @throws NumberFormatException if the bounds arguments are not numbers
    4243         * @throws IllegalArgumentException if list contain less than 5 elements
    4344         */
    44         public Bookmark(Collection<String> list) throws NumberFormatException, IllegalArgumentException {
     45        public Bookmark(Collection<String> list) {
    4546            List<String> array = new ArrayList<>(list);
    4647            if(array.size() < 5)
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r8449 r8506  
    2121import java.io.File;
    2222import java.io.FileInputStream;
    23 import java.io.FileNotFoundException;
    2423import java.io.IOException;
    2524import java.io.InputStream;
     
    213212        }
    214213
    215         private InputStream createInputStream(File sel) throws IOException, FileNotFoundException {
     214        private InputStream createInputStream(File sel) throws IOException {
    216215            if (Utils.hasExtension(sel, "gpx.gz")) {
    217216                return new GZIPInputStream(new FileInputStream(sel));
  • trunk/src/org/openstreetmap/josm/plugins/Plugin.java

    r7033 r8506  
    103103    /**
    104104     * Copies the resource 'from' to the file in the plugin directory named 'to'.
     105     * @throws FileNotFoundException if the file exists but is a directory rather than a regular file,
     106     * does not exist but cannot be created, or cannot be opened for any other reason
     107     * @throws IOException if any other I/O error occurs
    105108     */
    106     public void copy(String from, String to) throws FileNotFoundException, IOException {
     109    public void copy(String from, String to) throws IOException {
    107110        String pluginDirName = getPluginDir();
    108111        File pluginDir = new File(pluginDirName);
  • 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.