Skip to content

Commit 88a71ca

Browse files
committed
Replace joda-time with Standard Java 8+ Time API
1 parent 49001f8 commit 88a71ca

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,6 @@
239239
<artifactId>org.eclipse.jgit.ssh.jsch</artifactId>
240240
<version>${jgit.version}</version>
241241
</dependency>
242-
<!-- Joda Time -->
243-
<dependency>
244-
<groupId>joda-time</groupId>
245-
<artifactId>joda-time</artifactId>
246-
<version>2.14.1</version>
247-
</dependency>
248242
<dependency>
249243
<groupId>com.google.code.findbugs</groupId>
250244
<artifactId>jsr305</artifactId>

src/main/java/pl/project13/core/jgit/dummy/DatedRevTag.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,23 @@
1919

2020
import org.eclipse.jgit.lib.AnyObjectId;
2121
import org.eclipse.jgit.revwalk.RevTag;
22-
import org.joda.time.DateTime;
23-
import org.joda.time.format.DateTimeFormat;
22+
import java.time.Instant;
2423

2524
public class DatedRevTag {
2625

2726
public final AnyObjectId id;
2827
public final String tagName;
29-
public final DateTime date;
28+
public final Instant date;
3029

3130
public DatedRevTag(RevTag tag) {
32-
this(tag.getId(), tag.getTagName(), (tag.getTaggerIdent() != null) ? new DateTime(tag.getTaggerIdent().getWhen()) : DateTime.now().minusYears(1900));
31+
this(tag.getId(), tag.getTagName(), (tag.getTaggerIdent() != null) ? tag.getTaggerIdent().getWhen().toInstant() : Instant.now());
3332
}
3433

3534
public DatedRevTag(AnyObjectId id, String tagName) {
36-
this(id, tagName, DateTime.now().minusYears(2000));
35+
this(id, tagName, Instant.now());
3736
}
3837

39-
public DatedRevTag(AnyObjectId id, String tagName, DateTime date) {
38+
public DatedRevTag(AnyObjectId id, String tagName, Instant date) {
4039
this.id = id;
4140
this.tagName = tagName;
4241
this.date = date;
@@ -47,7 +46,7 @@ public String toString() {
4746
return "DatedRevTag{" +
4847
"id=" + id.name() +
4948
", tagName='" + tagName + '\'' +
50-
", date=" + DateTimeFormat.longDateTime().print(date) +
49+
", date=" + date +
5150
'}';
5251
}
5352
}

0 commit comments

Comments
 (0)