Skip to content

Commit 7794711

Browse files
committed
fix date parsing
1 parent 184e749 commit 7794711

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/SCCSRepository.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public class SCCSRepository extends Repository {
6363
public SCCSRepository() {
6464
type = "SCCS";
6565
datePatterns = new String[]{
66+
"yy/MM/dd HH:mm:ss",
6667
"yy/MM/dd"
6768
};
6869

opengrok-indexer/src/test/java/org/opengrok/indexer/history/SCCSRepositoryTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
import java.io.PrintWriter;
4040
import java.net.URL;
4141
import java.nio.file.Files;
42-
import java.util.Date;
42+
import java.text.DateFormat;
43+
import java.text.SimpleDateFormat;
4344
import java.util.List;
4445
import java.util.Set;
4546

@@ -143,10 +144,11 @@ void testGetHistory() throws Exception {
143144
assertTrue(file.isFile());
144145
History history = sccsRepository.getHistory(file);
145146
assertNotNull(history);
147+
DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
146148
List<HistoryEntry> entries = List.of(
147-
new HistoryEntry("1.2", new Date(1218492000000L),
149+
new HistoryEntry("1.2", dateFormat.parse("Tue Aug 12 22:11:54 2008"),
148150
"trond", "Fixed lint warnings\n", true),
149-
new HistoryEntry("1.1", new Date(1218492000000L),
151+
new HistoryEntry("1.1", dateFormat.parse("Tue Aug 12 22:09:23 2008"),
150152
"trond", "date and time created 08/08/12 22:09:23 by trond\n\n", true));
151153
History expectedHistory = new History(entries);
152154
assertEquals(expectedHistory, history);

0 commit comments

Comments
 (0)