- Timestamp:
- 2013-09-08T05:14:39+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java
r6135 r6222 23 23 import java.io.InputStream; 24 24 import java.io.Serializable; 25 26 import org.openstreetmap.josm.tools.Utils; 25 27 26 28 /** … … 216 218 * @param gs GridShift object containing the coordinate to shift and the shift values 217 219 * @return the GridShift object supplied, with values updated. 218 * @throws IOException219 220 */ 220 221 public NTV2GridShift interpolateGridShift(NTV2GridShift gs) { … … 281 282 */ 282 283 public void setSubGridArray(NTV2SubGrid[] subGrid) { 283 this.subGrid = subGrid;284 this.subGrid = Utils.copyArray(subGrid); 284 285 } 285 286 … … 369 370 return minLon; 370 371 } 371 372 372 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java
r5903 r6222 5 5 import static org.openstreetmap.josm.gui.conflict.pair.ListRole.THEIR_ENTRIES; 6 6 import static org.openstreetmap.josm.tools.I18n.tr; 7 8 import org.openstreetmap.josm.tools.Utils; 7 9 8 10 /** … … 33 35 ComparePairType(String displayName, ListRole[] participatingRoles) { 34 36 this.displayName = displayName; 35 this.participatingRoles = participatingRoles;37 this.participatingRoles = Utils.copyArray(participatingRoles); 36 38 } 37 39 -
trunk/src/org/openstreetmap/josm/gui/history/TwoColumnDiff.java
r5627 r6222 8 8 import org.openstreetmap.josm.gui.history.TwoColumnDiff.Item.DiffItemType; 9 9 import org.openstreetmap.josm.tools.Diff; 10 import org.openstreetmap.josm.tools.Utils; 10 11 11 12 /** … … 54 55 Object[] current; 55 56 56 /**57 * The arguments will _not_ be modified58 */59 57 public TwoColumnDiff(Object[] reference, Object[] current) { 60 this.reference = reference;61 this.current = current;58 this.reference = Utils.copyArray(reference); 59 this.current = Utils.copyArray(current); 62 60 referenceDiff = new ArrayList<Item>(); 63 61 currentDiff = new ArrayList<Item>(); 64 62 diff(); 65 63 } 64 66 65 private void diff() { 67 66 Diff diff = new Diff(reference, current); … … 82 81 int inserted = script.inserted; 83 82 while(ia < script.line0 && ib < script.line1){ 84 // System.out.println(" "+a[ia] + "\t "+b[ib]);85 83 Item cell = new Item(DiffItemType.SAME, a[ia]); 86 84 referenceDiff.add(cell); … … 92 90 while(inserted > 0 || deleted > 0) { 93 91 if(inserted > 0 && deleted > 0) { 94 // System.out.println("="+a[ia] + "\t="+b[ib]);95 92 referenceDiff.add(new Item(DiffItemType.CHANGED, a[ia++])); 96 93 currentDiff.add(new Item(DiffItemType.CHANGED, b[ib++])); 97 94 } else if(inserted > 0) { 98 // System.out.println("\t+" + b[ib]);99 95 referenceDiff.add(new Item(DiffItemType.EMPTY, null)); 100 96 currentDiff.add(new Item(DiffItemType.INSERTED, b[ib++])); 101 97 } else if(deleted > 0) { 102 // System.out.println("-"+a[ia]);103 98 referenceDiff.add(new Item(DiffItemType.DELETED, a[ia++])); 104 99 currentDiff.add(new Item(DiffItemType.EMPTY, null)); … … 110 105 } 111 106 while(ia < a.length && ib < b.length) { 112 // System.out.println((ia < a.length ? " "+a[ia]+"\t" : "\t") + (ib < b.length ? " "+b[ib] : ""));113 107 referenceDiff.add(new Item(DiffItemType.SAME, a[ia++])); 114 108 currentDiff.add(new Item(DiffItemType.SAME, b[ib++])); -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ListProjectionChoice.java
r5548 r6222 12 12 import org.openstreetmap.josm.gui.widgets.JosmComboBox; 13 13 import org.openstreetmap.josm.tools.GBC; 14 import org.openstreetmap.josm.tools.Utils; 14 15 15 16 /** … … 24 25 25 26 /** 26 * Construct or27 * Constructs a new {@code ListProjectionChoice}. 27 28 * 28 29 * @param name the display name … … 34 35 public ListProjectionChoice(String name, String id, Object[] entries, String label, int defaultIndex) { 35 36 super(name, id); 36 this.entries = entries;37 this.entries = Utils.copyArray(entries); 37 38 this.label = label; 38 39 this.defaultIndex = defaultIndex; 39 40 } 40 41 42 /** 43 * Constructs a new {@code ListProjectionChoice}. 44 * @param name the display name 45 * @param id the unique id for this ProjectionChoice 46 * @param entries the list of display entries for the combo-box 47 * @param label a label shown left to the combo-box 48 */ 41 49 public ListProjectionChoice(String name, String id, Object[] entries, String label) { 42 50 this(name, id, entries, label, 0); -
trunk/src/org/openstreetmap/josm/io/auth/CredentialsAgentResponse.java
r5692 r6222 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.io.auth; 3 4 import org.openstreetmap.josm.tools.Utils; 3 5 4 6 /** … … 42 44 */ 43 45 public void setPassword(char[] password) { 44 this.password = password;46 this.password = Utils.copyArray(password); 45 47 } 46 48 /** -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6221 r6222 256 256 257 257 /** 258 * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe. 259 * @param array The array to copy 260 * @return A copy of the original array, or {@code null} if {@code array} is null 261 * @since 6222 262 */ 263 public static char[] copyArray(char[] array) { 264 if (array != null) { 265 return Arrays.copyOf(array, array.length); 266 } 267 return null; 268 } 269 270 /** 258 271 * Simple file copy function that will overwrite the target file.<br/> 259 272 * Taken from <a href="http://www.rgagnon.com/javadetails/java-0064.html">this article</a> (CC-NC-BY-SA) … … 715 728 return all.toString(); 716 729 } 717 718 730 }
Note:
See TracChangeset
for help on using the changeset viewer.