Changeset 17720 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/ChangesetDiscussionComment.java
r11878 r17720 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import java.util.Date; 5 6 import org.openstreetmap.josm.tools.date.DateUtils; 4 import java.time.Instant; 7 5 8 6 /** … … 13 11 14 12 /** date this comment was posted at */ 15 private final Datedate;13 private final Instant date; 16 14 /** the user who posted the comment */ 17 15 private final User user; … … 24 22 * @param user the user who posted the comment 25 23 */ 26 public ChangesetDiscussionComment( Datedate, User user) {27 this.date = DateUtils.cloneDate(date);24 public ChangesetDiscussionComment(Instant date, User user) { 25 this.date = date; 28 26 this.user = user; 29 27 } … … 49 47 * @return date this comment was posted at 50 48 */ 51 public final DategetDate() {52 return DateUtils.cloneDate(date);49 public final Instant getDate() { 50 return date; 53 51 } 54 52 -
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r17717 r17720 9 9 import java.nio.charset.StandardCharsets; 10 10 import java.text.MessageFormat; 11 import java. util.Date;11 import java.time.Instant; 12 12 import java.util.LinkedList; 13 13 import java.util.List; … … 172 172 // -- date 173 173 String value = atts.getValue("date"); 174 Date date = null; 175 if (value != null) { 176 date = DateUtils.fromString(value); 177 } 178 174 Instant date = value != null ? DateUtils.parseInstant(value) : null; 179 175 comment = new ChangesetDiscussionComment(date, createUser(atts)); 180 176 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java
r17275 r17720 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import java. util.Date;6 import java.time.Instant; 7 7 8 8 import org.junit.jupiter.api.extension.RegisterExtension; … … 29 29 @Test 30 30 void testChangesetDiscussionComment() { 31 Date d = new Date(1000);31 Instant d = Instant.ofEpochMilli(1000); 32 32 User foo = User.createOsmUser(1, "foo"); 33 33 ChangesetDiscussionComment cdc = new ChangesetDiscussionComment(d, foo); 34 34 assertEquals(d, cdc.getDate()); 35 35 assertEquals(foo, cdc.getUser()); 36 assertEquals("ChangesetDiscussionComment [date= Thu Jan 01 00:00:01 UTC 1970, user=id:1 name:foo, text='null']", cdc.toString());36 assertEquals("ChangesetDiscussionComment [date=1970-01-01T00:00:01Z, user=id:1 name:foo, text='null']", cdc.toString()); 37 37 } 38 38 … … 42 42 @Test 43 43 void testText() { 44 ChangesetDiscussionComment cdc = new ChangesetDiscussionComment( new Date(), null);44 ChangesetDiscussionComment cdc = new ChangesetDiscussionComment(Instant.now(), null); 45 45 cdc.setText("foo"); 46 46 assertEquals("foo", cdc.getText());
Note:
See TracChangeset
for help on using the changeset viewer.