Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java (revision 11878)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java (revision 11879)
@@ -10,5 +10,5 @@
/**
* Enumeration of the possible comparison pairs
- *
+ * @since 1650
*/
public enum ComparePairType {
@@ -48,10 +48,8 @@
/**
- * replies true, if role
is participating in this comparison
- * pair
+ * replies true, if role
is participating in this comparison pair
*
* @param role the list role
- * @return true, if role
is participating in this comparison
- * pair; false, otherwise
+ * @return true, if role
is participating in this comparison pair; false, otherwise
*/
public boolean isParticipatingIn(ListRole role) {
@@ -63,16 +61,14 @@
/**
- * replies the pair of {@link ListRole}s participating in this comparison
- * pair
+ * replies the pair of {@link ListRole}s participating in this comparison pair
*
* @return the pair of list roles
*/
public ListRole[] getParticipatingRoles() {
- return participatingRoles;
+ return Utils.copyArray(participatingRoles);
}
/**
- * replies the opposite role of role
participating in this comparison
- * pair
+ * replies the opposite role of role
participating in this comparison pair
*
* @param role one of the two roles in this pair
Index: trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java (revision 11878)
+++ trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java (revision 11879)
@@ -12,4 +12,5 @@
import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.Utils;
/**
@@ -136,5 +137,5 @@
* @throws T if an error occurs
*/
- public byte[] updateForce() throws T {
+ private byte[] updateForce() throws T {
this.data = updateData();
saveToDisk();
@@ -162,5 +163,5 @@
loadFromDisk();
}
- return data;
+ return Utils.copyArray(data);
}
Index: trunk/src/org/openstreetmap/josm/io/auth/CredentialsAgentResponse.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/auth/CredentialsAgentResponse.java (revision 11878)
+++ trunk/src/org/openstreetmap/josm/io/auth/CredentialsAgentResponse.java (revision 11879)
@@ -40,5 +40,5 @@
*/
public char[] getPassword() {
- return password;
+ return Utils.copyArray(password);
}
Index: trunk/src/org/openstreetmap/josm/tools/HttpClient.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/HttpClient.java (revision 11878)
+++ trunk/src/org/openstreetmap/josm/tools/HttpClient.java (revision 11879)
@@ -14,5 +14,4 @@
import java.net.HttpURLConnection;
import java.net.URL;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -559,5 +558,5 @@
*/
public HttpClient setRequestBody(byte[] requestBody) {
- this.requestBody = Arrays.copyOf(requestBody, requestBody.length);
+ this.requestBody = Utils.copyArray(requestBody);
return this;
}
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java (revision 11878)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java (revision 11879)
@@ -357,4 +357,17 @@
/**
+ * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe.
+ * @param array The array to copy
+ * @return A copy of the original array, or {@code null} if {@code array} is null
+ * @since 11879
+ */
+ public static byte[] copyArray(byte... array) {
+ if (array != null) {
+ return Arrays.copyOf(array, array.length);
+ }
+ return array;
+ }
+
+ /**
* Simple file copy function that will overwrite the target file.
* @param in The source file