- Timestamp:
- 2017-04-10T00:14:42+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java
r11746 r11878 7 7 import java.util.HashMap; 8 8 import java.util.Iterator; 9 import java.util.List;10 9 import java.util.Map; 11 10 import java.util.Map.Entry; … … 25 24 import org.openstreetmap.josm.data.osm.PrimitiveId; 26 25 import org.openstreetmap.josm.data.osm.RelationData; 27 import org.openstreetmap.josm.data.osm.RelationMemberData;28 26 import org.openstreetmap.josm.data.osm.WayData; 29 27 import org.openstreetmap.josm.data.osm.history.History; … … 80 78 } 81 79 80 /** 81 * OsmChange download task. 82 */ 82 83 protected class DownloadTask extends DownloadOsmTask.DownloadTask { 83 84 84 public DownloadTask(boolean newLayer, OsmServerReader reader, 85 ProgressMonitor progressMonitor) { 85 /** 86 * Constructs a new {@code DownloadTask}. 87 * @param newLayer if {@code true}, force download to a new layer 88 * @param reader OSM data reader 89 * @param progressMonitor progress monitor 90 */ 91 public DownloadTask(boolean newLayer, OsmServerReader reader, ProgressMonitor progressMonitor) { 86 92 super(newLayer, reader, progressMonitor); 87 93 } … … 154 160 switch (p.getType()) { 155 161 case NODE: 156 data = new NodeData(); 157 ((NodeData) data).setCoor(((HistoryNode) hp).getCoords()); 162 data = ((HistoryNode) hp).fillPrimitiveData(new NodeData()); 158 163 break; 159 164 case WAY: 160 data = new WayData(); 161 List<Long> nodeIds = ((HistoryWay) hp).getNodes(); 162 ((WayData) data).setNodes(nodeIds); 165 data = ((HistoryWay) hp).fillPrimitiveData(new WayData()); 163 166 // Find incomplete nodes to load at next run 164 for (Long nodeId : nodeIds) {167 for (Long nodeId : ((HistoryWay) hp).getNodes()) { 165 168 if (p.getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE) == null) { 166 169 Node n = new Node(nodeId); … … 171 174 break; 172 175 case RELATION: 173 data = new RelationData(); 174 List<RelationMemberData> members = ((HistoryRelation) hp).getMembers(); 175 ((RelationData) data).setMembers(members); 176 data = ((HistoryRelation) hp).fillPrimitiveData(new RelationData()); 176 177 break; 177 178 default: throw new AssertionError("Unknown primitive type"); 178 179 } 179 180 data.setUser(hp.getUser());181 try {182 data.setVisible(hp.isVisible());183 } catch (IllegalStateException e) {184 Main.error(e, "Cannot change visibility for "+p+':');185 }186 data.setTimestamp(hp.getTimestamp());187 data.setKeys(hp.getTags());188 data.setOsmId(hp.getId(), (int) hp.getVersion());189 180 190 181 // Load the history data -
trunk/src/org/openstreetmap/josm/data/notes/Note.java
r11821 r11878 11 11 12 12 import org.openstreetmap.josm.data.coor.LatLon; 13 import org.openstreetmap.josm.tools.date.DateUtils; 13 14 14 15 /** … … 98 99 /** @return Date that this note was submitted */ 99 100 public Date getCreatedAt() { 100 return cloneDate(createdAt);101 return DateUtils.cloneDate(createdAt); 101 102 } 102 103 … … 106 107 */ 107 108 public void setCreatedAt(Date createdAt) { 108 this.createdAt = cloneDate(createdAt);109 this.createdAt = DateUtils.cloneDate(createdAt); 109 110 } 110 111 111 112 /** @return Date that this note was closed. Null if it is still open. */ 112 113 public Date getClosedAt() { 113 return cloneDate(closedAt);114 return DateUtils.cloneDate(closedAt); 114 115 } 115 116 … … 119 120 */ 120 121 public void setClosedAt(Date closedAt) { 121 this.closedAt = cloneDate(closedAt);122 this.closedAt = DateUtils.cloneDate(closedAt); 122 123 } 123 124 … … 172 173 public void updateWith(Note note) { 173 174 this.comments = note.comments; 174 this.createdAt = cloneDate(note.createdAt);175 this.createdAt = DateUtils.cloneDate(note.createdAt); 175 176 this.id = note.id; 176 177 this.state = note.state; … … 197 198 return tr("Note") + ' ' + id + ": " + getFirstComment(); 198 199 } 199 200 /**201 * Null-safe date cloning method.202 * @param d date to clone, or null203 * @return cloned date, or null204 */205 static Date cloneDate(Date d) {206 return d != null ? (Date) d.clone() : null;207 }208 200 } -
trunk/src/org/openstreetmap/josm/data/notes/NoteComment.java
r11821 r11878 6 6 7 7 import org.openstreetmap.josm.data.osm.User; 8 import org.openstreetmap.josm.tools.date.DateUtils; 8 9 9 10 /** … … 52 53 this.text = commentText; 53 54 this.user = user; 54 this.commentTimestamp = Note.cloneDate(createDate);55 this.commentTimestamp = DateUtils.cloneDate(createDate); 55 56 this.action = action; 56 57 this.isNew = isNew; … … 69 70 /** @return The time at which this comment was created */ 70 71 public Date getCommentTimestamp() { 71 return Note.cloneDate(commentTimestamp);72 return DateUtils.cloneDate(commentTimestamp); 72 73 } 73 74 -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r11332 r11878 15 15 import org.openstreetmap.josm.data.osm.visitor.Visitor; 16 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 17 import org.openstreetmap.josm.tools.date.DateUtils; 17 18 18 19 /** … … 177 178 */ 178 179 public Date getCreatedAt() { 179 return createdAt;180 return DateUtils.cloneDate(createdAt); 180 181 } 181 182 … … 185 186 */ 186 187 public void setCreatedAt(Date createdAt) { 187 this.createdAt = createdAt;188 this.createdAt = DateUtils.cloneDate(createdAt); 188 189 } 189 190 … … 193 194 */ 194 195 public Date getClosedAt() { 195 return closedAt;196 return DateUtils.cloneDate(closedAt); 196 197 } 197 198 … … 201 202 */ 202 203 public void setClosedAt(Date closedAt) { 203 this.closedAt = closedAt;204 this.closedAt = DateUtils.cloneDate(closedAt); 204 205 } 205 206 … … 426 427 return; 427 428 this.user = other.user; 428 this.createdAt = other.createdAt;429 this.closedAt = other.closedAt;429 this.createdAt = DateUtils.cloneDate(other.createdAt); 430 this.closedAt = DateUtils.cloneDate(other.closedAt); 430 431 this.open = other.open; 431 432 this.min = other.min; -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetDataSet.java
r11115 r11878 17 17 public class ChangesetDataSet { 18 18 19 /** 20 * Type of primitive modification. 21 */ 19 22 public enum ChangesetModificationType { 23 /** The primitive has been created */ 20 24 CREATED, 25 /** The primitive has been updated */ 21 26 UPDATED, 27 /** The primitive has been deleted */ 22 28 DELETED 23 29 } 24 30 31 /** 32 * An entry in the changeset dataset. 33 */ 25 34 public interface ChangesetDataSetEntry { 35 36 /** 37 * Returns the type of modification. 38 * @return the type of modification 39 */ 26 40 ChangesetModificationType getModificationType(); 27 41 42 /** 43 * Returns the affected history primitive. 44 * @return the affected history primitive 45 */ 28 46 HistoryOsmPrimitive getPrimitive(); 29 47 } … … 133 151 134 152 /** 135 * Replies the {@link HistoryOsmPrimitive} with id <code>id</code> from this 136 * dataset. null, if there is no such primitive in the data set. 137 * 138 * @param id the id 139 * @return the {@link HistoryOsmPrimitive} with id <code>id</code> from this 140 * dataset 153 * Replies the {@link HistoryOsmPrimitive} with id <code>id</code> from this dataset. 154 * null, if there is no such primitive in the data set. 155 * 156 * @param id the id 157 * @return the {@link HistoryOsmPrimitive} with id <code>id</code> from this dataset 141 158 */ 142 159 public HistoryOsmPrimitive getPrimitive(PrimitiveId id) { … … 145 162 } 146 163 164 /** 165 * Returns an iterator over dataset entries. 166 * @return an iterator over dataset entries 167 */ 147 168 public Iterator<ChangesetDataSetEntry> iterator() { 148 169 return new DefaultIterator(); … … 184 205 public ChangesetDataSetEntry next() { 185 206 Entry<PrimitiveId, ChangesetModificationType> next = typeIterator.next(); 186 ChangesetModificationType type = next.getValue(); 187 HistoryOsmPrimitive primitive = primitives.get(next.getKey()); 188 return new DefaultChangesetDataSetEntry(type, primitive); 207 return new DefaultChangesetDataSetEntry(next.getValue(), primitives.get(next.getKey())); 189 208 } 190 209 -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetDiscussionComment.java
r7937 r11878 3 3 4 4 import java.util.Date; 5 6 import org.openstreetmap.josm.tools.date.DateUtils; 5 7 6 8 /** … … 23 25 */ 24 26 public ChangesetDiscussionComment(Date date, User user) { 25 this.date = date;27 this.date = DateUtils.cloneDate(date); 26 28 this.user = user; 27 29 } … … 48 50 */ 49 51 public final Date getDate() { 50 return date;52 return DateUtils.cloneDate(date); 51 53 } 52 54 -
trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java
r10946 r11878 75 75 } 76 76 77 /** 78 * Returns a filtered list for a given primitive type. 79 * @param <T> primitive type 80 * @param list list to filter 81 * @param type primitive type 82 * @return a filtered list for given primitive type 83 */ 77 84 @SuppressWarnings("unchecked") 78 85 public static <T extends PrimitiveData> List<T> getFilteredList(Collection<T> list, OsmPrimitiveType type) { -
trunk/src/org/openstreetmap/josm/data/osm/RelationData.java
r9891 r11878 7 7 import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor; 8 8 9 /** 10 * Relation data. 11 * @since 2284 12 */ 9 13 public class RelationData extends PrimitiveData implements IRelation { 10 14 … … 28 32 } 29 33 34 /** 35 * Returns relation members. 36 * @return relation members 37 */ 30 38 public List<RelationMemberData> getMembers() { 31 39 return members; 32 40 } 33 41 42 /** 43 * Sets relation members. 44 * @param memberData relation members 45 */ 34 46 public void setMembers(List<RelationMemberData> memberData) { 35 47 members = new ArrayList<>(memberData); -
trunk/src/org/openstreetmap/josm/data/osm/UserInfo.java
r11349 r11878 6 6 7 7 import org.openstreetmap.josm.data.coor.LatLon; 8 import org.openstreetmap.josm.tools.date.DateUtils; 8 9 9 10 /** … … 73 74 */ 74 75 public Date getAccountCreated() { 75 return accountCreated;76 return DateUtils.cloneDate(accountCreated); 76 77 } 77 78 … … 81 82 */ 82 83 public void setAccountCreated(Date accountCreated) { 83 this.accountCreated = accountCreated;84 this.accountCreated = DateUtils.cloneDate(accountCreated); 84 85 } 85 86 -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNode.java
r11608 r11878 6 6 import org.openstreetmap.josm.data.coor.LatLon; 7 7 import org.openstreetmap.josm.data.osm.Node; 8 import org.openstreetmap.josm.data.osm.NodeData; 8 9 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 9 10 import org.openstreetmap.josm.data.osm.User; … … 89 90 return formatter.format(this); 90 91 } 92 93 /** 94 * Fills the node attributes with values from this history. 95 * @param data node data to fill 96 * @return filled node data 97 * @since 11878 98 */ 99 public NodeData fillPrimitiveData(NodeData data) { 100 super.fillPrimitiveCommonData(data); 101 data.setCoor(coords); 102 return data; 103 } 91 104 } -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
r11608 r11878 13 13 import java.util.Objects; 14 14 15 import org.openstreetmap.josm.Main; 15 16 import org.openstreetmap.josm.data.osm.Changeset; 16 17 import org.openstreetmap.josm.data.osm.Node; 17 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 19 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 20 import org.openstreetmap.josm.data.osm.PrimitiveData; 19 21 import org.openstreetmap.josm.data.osm.PrimitiveId; 20 22 import org.openstreetmap.josm.data.osm.Relation; … … 24 26 import org.openstreetmap.josm.data.osm.Way; 25 27 import org.openstreetmap.josm.tools.CheckParameterUtil; 28 import org.openstreetmap.josm.tools.date.DateUtils; 26 29 27 30 /** … … 85 88 this.user = user; 86 89 this.changesetId = changesetId; 87 this.timestamp = timestamp;88 t ags = new HashMap<>();90 this.timestamp = DateUtils.cloneDate(timestamp); 91 this.tags = new HashMap<>(); 89 92 } 90 93 … … 159 162 */ 160 163 public Date getTimestamp() { 161 return timestamp;164 return DateUtils.cloneDate(timestamp); 162 165 } 163 166 … … 170 173 } 171 174 175 /** 176 * Checks that value is positive. 177 * @param value value to check 178 * @param name parameter name for error message 179 * @throws IllegalArgumentException if {@code value <= 0} 180 */ 172 181 protected final void ensurePositiveLong(long value, String name) { 173 182 if (value <= 0) { … … 176 185 } 177 186 187 /** 188 * Determines if this history matches given id and version. 189 * @param id Primitive identifier 190 * @param version Primitive version 191 * @return {@code true} if this history matches given id and version 192 */ 178 193 public boolean matches(long id, long version) { 179 194 return this.id == id && this.version == version; 180 195 } 181 196 197 /** 198 * Determines if this history matches given id. 199 * @param id Primitive identifier 200 * @return {@code true} if this history matches given id 201 */ 182 202 public boolean matches(long id) { 183 203 return this.id == id; … … 325 345 } 326 346 347 /** 348 * Fills the attributes common to all primitives with values from this history. 349 * @param data primitive data to fill 350 */ 351 protected void fillPrimitiveCommonData(PrimitiveData data) { 352 data.setUser(user); 353 try { 354 data.setVisible(visible); 355 } catch (IllegalStateException e) { 356 Main.error(e, "Cannot change visibility for "+data+':'); 357 } 358 data.setTimestamp(timestamp); 359 data.setKeys(tags); 360 data.setOsmId(id, (int) version); 361 } 362 327 363 @Override 328 364 public int hashCode() { … … 335 371 if (obj == null || getClass() != obj.getClass()) return false; 336 372 HistoryOsmPrimitive that = (HistoryOsmPrimitive) obj; 337 return id == that.id && 338 version == that.version; 373 return id == that.id && version == that.version; 339 374 } 340 375 -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java
r11608 r11878 10 10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 11 11 import org.openstreetmap.josm.data.osm.Relation; 12 import org.openstreetmap.josm.data.osm.RelationData; 12 13 import org.openstreetmap.josm.data.osm.RelationMemberData; 13 14 import org.openstreetmap.josm.data.osm.User; … … 141 142 return formatter.format(this); 142 143 } 144 145 /** 146 * Fills the relation attributes with values from this history. 147 * @param data relation data to fill 148 * @return filled relation data 149 * @since 11878 150 */ 151 public RelationData fillPrimitiveData(RelationData data) { 152 super.fillPrimitiveCommonData(data); 153 data.setMembers(members); 154 return data; 155 } 143 156 } -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java
r11608 r11878 12 12 import org.openstreetmap.josm.data.osm.User; 13 13 import org.openstreetmap.josm.data.osm.Way; 14 import org.openstreetmap.josm.data.osm.WayData; 14 15 import org.openstreetmap.josm.tools.CheckParameterUtil; 15 16 … … 143 144 return formatter.format(this); 144 145 } 146 147 /** 148 * Fills the way attributes with values from this history. 149 * @param data way data to fill 150 * @return filled way data 151 * @since 11878 152 */ 153 public WayData fillPrimitiveData(WayData data) { 154 super.fillPrimitiveCommonData(data); 155 data.setNodes(nodeIds); 156 return data; 157 } 145 158 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableCellRenderer.java
r8510 r11878 17 17 public class ChangesetContentTableCellRenderer extends AbstractCellRenderer { 18 18 19 /** 20 * Renders primitive modification type. 21 * @param type modification type 22 */ 19 23 protected void renderModificationType(ChangesetModificationType type) { 20 24 switch(type) { … … 35 39 switch(column) { 36 40 case 0: 37 ChangesetModificationType type = (ChangesetModificationType) value; 38 renderModificationType(type); 41 renderModificationType((ChangesetModificationType) value); 39 42 break; 40 43 case 1: 41 HistoryOsmPrimitive primitive = (HistoryOsmPrimitive) value; 42 renderId(primitive.getId()); 44 renderId(((HistoryOsmPrimitive) value).getId()); 43 45 break; 44 46 default: -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentTableModel.java
r10619 r11878 18 18 /** 19 19 * This is the table model for the content of a changeset. 20 * 20 * @since 2689 21 21 */ 22 22 public class ChangesetContentTableModel extends AbstractTableModel { … … 25 25 private final DefaultListSelectionModel selectionModel; 26 26 27 /** 28 * Constructs a new {@code ChangesetContentTableModel}. 29 * @param selectionModel selection model 30 */ 27 31 public ChangesetContentTableModel(DefaultListSelectionModel selectionModel) { 28 32 this.selectionModel = selectionModel; … … 38 42 } 39 43 44 /** 45 * Selects a single item by its index. 46 * @param row index 47 */ 40 48 public void setSelectedByIdx(int row) { 41 49 selectionModel.setSelectionInterval(row, row); … … 50 58 } 51 59 60 /** 61 * Returns the selected history primitives. 62 * @return the selected history primitives 63 */ 52 64 public Set<HistoryOsmPrimitive> getSelectedPrimitives() { 53 65 Set<HistoryOsmPrimitive> ret = new HashSet<>(); … … 78 90 } 79 91 92 /** 93 * Sort data. 94 */ 80 95 protected void sort() { 81 96 data.sort((c1, c2) -> { … … 130 145 * The type used internally to keep information about {@link HistoryOsmPrimitive} 131 146 * with their {@link ChangesetModificationType}. 132 *133 147 */ 134 148 private static class ChangesetContentEntry implements ChangesetDataSetEntry { -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java
r11848 r11878 17 17 import java.text.DateFormat; 18 18 import java.util.Collections; 19 import java.util.Date; 19 20 import java.util.HashSet; 20 21 import java.util.Set; … … 238 239 DateFormat sdf = DateUtils.getDateTimeFormat(DateFormat.SHORT, DateFormat.SHORT); 239 240 240 tfCreatedOn.setText(cs.getCreatedAt() == null ? "" : sdf.format(cs.getCreatedAt())); 241 tfClosedOn.setText(cs.getClosedAt() == null ? "" : sdf.format(cs.getClosedAt())); 241 Date createdDate = cs.getCreatedAt(); 242 Date closedDate = cs.getClosedAt(); 243 tfCreatedOn.setText(createdDate == null ? "" : sdf.format(createdDate)); 244 tfClosedOn.setText(closedDate == null ? "" : sdf.format(closedDate)); 242 245 } 243 246 -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r11059 r11878 231 231 protected final Pair<LatLon, LatLon> getCoordinates() { 232 232 HistoryOsmPrimitive p = getPrimitive(); 233 if (!(p instanceof HistoryNode)) return null; 233 234 HistoryOsmPrimitive opposite = getOppositePrimitive(); 234 if (!(p instanceof HistoryNode)) return null;235 235 if (!(opposite instanceof HistoryNode)) return null; 236 236 HistoryNode node = (HistoryNode) p; -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetCellRenderer.java
r11848 r11878 6 6 import java.awt.Component; 7 7 import java.text.DateFormat; 8 import java.util.Date; 8 9 9 10 import javax.swing.ImageIcon; … … 37 38 StringBuilder sb = new StringBuilder(64); 38 39 sb.append("<html><strong>").append(tr("Changeset id:")).append("</strong>").append(cs.getId()).append("<br>"); 39 if (cs.getCreatedAt() != null) { 40 Date createdDate = cs.getCreatedAt(); 41 if (createdDate != null) { 40 42 sb.append("<strong>").append(tr("Created at:")).append("</strong>").append( 41 DateUtils.formatDateTime(c s.getCreatedAt(), DateFormat.SHORT, DateFormat.SHORT)).append("<br>");43 DateUtils.formatDateTime(createdDate, DateFormat.SHORT, DateFormat.SHORT)).append("<br>"); 42 44 } 43 45 String comment = cs.get("comment"); -
trunk/src/org/openstreetmap/josm/gui/widgets/DateEditorWithSlider.java
r10611 r11878 91 91 92 92 public void setRange(Date dateMin, Date dateMax) { 93 this.dateMin = dateMin;94 this.dateMax = dateMax;93 this.dateMin = DateUtils.cloneDate(dateMin); 94 this.dateMax = DateUtils.cloneDate(dateMax); 95 95 } 96 96 97 97 public void setDate(Date date) { 98 spinner.setValue( date);98 spinner.setValue(DateUtils.cloneDate(date)); 99 99 } 100 100 101 101 public Date getDate() { 102 return (Date) spinner.getValue();102 return DateUtils.cloneDate((Date) spinner.getValue()); 103 103 } 104 104 -
trunk/src/org/openstreetmap/josm/io/ChangesetClosedException.java
r8836 r11878 121 121 this.source = source == null ? Source.UNSPECIFIED : source; 122 122 this.changesetId = changesetId; 123 this.closedOn = closedOn;123 this.closedOn = DateUtils.cloneDate(closedOn); 124 124 } 125 125 … … 139 139 */ 140 140 public Date getClosedOn() { 141 return closedOn;141 return DateUtils.cloneDate(closedOn); 142 142 } 143 143 -
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r11381 r11878 184 184 public ChangesetQuery closedAfter(Date d) { 185 185 CheckParameterUtil.ensureParameterNotNull(d, "d"); 186 this.closedAfter = d;186 this.closedAfter = DateUtils.cloneDate(d); 187 187 return this; 188 188 } … … 202 202 CheckParameterUtil.ensureParameterNotNull(closedAfter, "closedAfter"); 203 203 CheckParameterUtil.ensureParameterNotNull(createdBefore, "createdBefore"); 204 this.closedAfter = closedAfter;205 this.createdBefore = createdBefore;204 this.closedAfter = DateUtils.cloneDate(closedAfter); 205 this.createdBefore = DateUtils.cloneDate(createdBefore); 206 206 return this; 207 207 } -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r11709 r11878 8 8 import java.util.Collection; 9 9 import java.util.Comparator; 10 import java.util.Date; 10 11 import java.util.List; 11 12 import java.util.Map.Entry; … … 242 243 out.print(" uid='"+cs.getUser().getId() +'\''); 243 244 } 244 if (cs.getCreatedAt() != null) { 245 out.print(" created_at='"+DateUtils.fromDate(cs.getCreatedAt()) +'\''); 246 } 247 if (cs.getClosedAt() != null) { 248 out.print(" closed_at='"+DateUtils.fromDate(cs.getClosedAt()) +'\''); 245 Date createdDate = cs.getCreatedAt(); 246 if (createdDate != null) { 247 out.print(" created_at='"+DateUtils.fromDate(createdDate) +'\''); 248 } 249 Date closedDate = cs.getClosedAt(); 250 if (closedDate != null) { 251 out.print(" closed_at='"+DateUtils.fromDate(closedDate) +'\''); 249 252 } 250 253 out.print(" open='"+ (cs.isOpen() ? "true" : "false") +'\''); -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r11553 r11878 14 14 import java.net.HttpURLConnection; 15 15 import java.net.URL; 16 import java.util.Arrays; 16 17 import java.util.Collections; 17 18 import java.util.List; … … 558 559 */ 559 560 public HttpClient setRequestBody(byte[] requestBody) { 560 this.requestBody = requestBody;561 this.requestBody = Arrays.copyOf(requestBody, requestBody.length); 561 562 return this; 562 563 } -
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r11620 r11878 163 163 } 164 164 165 /** 166 * Null-safe date cloning method. 167 * @param d date to clone, or null 168 * @return cloned date, or null 169 * @since 11878 170 */ 171 public static Date cloneDate(Date d) { 172 return d != null ? (Date) d.clone() : null; 173 } 174 165 175 private static boolean checkLayout(String text, String pattern) { 166 176 if (text.length() != pattern.length()) -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java
r11121 r11878 53 53 // object with various items and modification types, fetch for CREATED 54 54 // => list containing only the CREATED item 55 History OsmPrimitive prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO);56 History OsmPrimitive prim2 = new HistoryNode(2, 1, true, User.createLocalUser("test"), 1, new Date(), LatLon.NORTH_POLE);57 History OsmPrimitive prim3 = new HistoryNode(3, 1, true, User.getAnonymous(), 1, new Date(), LatLon.SOUTH_POLE);55 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO); 56 HistoryNode prim2 = new HistoryNode(2, 1, true, User.createLocalUser("test"), 1, new Date(), LatLon.NORTH_POLE); 57 HistoryNode prim3 = new HistoryNode(3, 1, true, User.getAnonymous(), 1, new Date(), LatLon.SOUTH_POLE); 58 58 cds.put(prim1, ChangesetModificationType.CREATED); 59 59 cds.put(prim2, ChangesetModificationType.DELETED);
Note:
See TracChangeset
for help on using the changeset viewer.