Changeset 11879 in josm


Ignore:
Timestamp:
2017-04-10T03:28:15+02:00 (8 months ago)
Author:
Don-vip
Message:

findbugs - EI_EXPOSE_REP

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java

    r11747 r11879  
    1010/**
    1111 * Enumeration of the possible comparison pairs
    12  *
     12 * @since 1650
    1313 */
    1414public enum ComparePairType {
     
    4848
    4949    /**
    50      * replies true, if <code>role</code> is participating in this comparison
    51      * pair
     50     * replies true, if <code>role</code> is participating in this comparison pair
    5251     *
    5352     * @param role  the list role
    54      * @return true, if <code>role</code> is participating in this comparison
    55      * pair; false, otherwise
     53     * @return true, if <code>role</code> is participating in this comparison pair; false, otherwise
    5654     */
    5755    public boolean isParticipatingIn(ListRole role) {
     
    6361
    6462    /**
    65      * replies the pair of {@link ListRole}s participating in this comparison
    66      * pair
     63     * replies the pair of {@link ListRole}s participating in this comparison pair
    6764     *
    6865     * @return  the pair of list roles
    6966     */
    7067    public ListRole[] getParticipatingRoles() {
    71         return participatingRoles;
     68        return Utils.copyArray(participatingRoles);
    7269    }
    7370
    7471    /**
    75      * replies the opposite role of <code>role</code> participating in this comparison
    76      * pair
     72     * replies the opposite role of <code>role</code> participating in this comparison pair
    7773     *
    7874     * @param role one of the two roles in this pair
  • trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java

    r11510 r11879  
    1212
    1313import org.openstreetmap.josm.Main;
     14import org.openstreetmap.josm.tools.Utils;
    1415
    1516/**
     
    136137     * @throws T if an error occurs
    137138     */
    138     public byte[] updateForce() throws T {
     139    private byte[] updateForce() throws T {
    139140        this.data = updateData();
    140141        saveToDisk();
     
    162163            loadFromDisk();
    163164        }
    164         return data;
     165        return Utils.copyArray(data);
    165166    }
    166167
  • trunk/src/org/openstreetmap/josm/io/auth/CredentialsAgentResponse.java

    r9059 r11879  
    4040     */
    4141    public char[] getPassword() {
    42         return password;
     42        return Utils.copyArray(password);
    4343    }
    4444
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r11878 r11879  
    1414import java.net.HttpURLConnection;
    1515import java.net.URL;
    16 import java.util.Arrays;
    1716import java.util.Collections;
    1817import java.util.List;
     
    559558     */
    560559    public HttpClient setRequestBody(byte[] requestBody) {
    561         this.requestBody = Arrays.copyOf(requestBody, requestBody.length);
     560        this.requestBody = Utils.copyArray(requestBody);
    562561        return this;
    563562    }
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r11747 r11879  
    357357
    358358    /**
     359     * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe.
     360     * @param array The array to copy
     361     * @return A copy of the original array, or {@code null} if {@code array} is null
     362     * @since 11879
     363     */
     364    public static byte[] copyArray(byte... array) {
     365        if (array != null) {
     366            return Arrays.copyOf(array, array.length);
     367        }
     368        return array;
     369    }
     370
     371    /**
    359372     * Simple file copy function that will overwrite the target file.
    360373     * @param in The source file
Note: See TracChangeset for help on using the changeset viewer.