Skip to content

Commit 137cc9d

Browse files
authored
Merge pull request #52 from slonopotamus/release-0.13.2
Release 0.13.2
2 parents a500ba0 + aa73716 commit 137cc9d

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ See https://github.com/bozaro/git-lfs-java/blob/master/gitlfs-server/src/test/ja
5656

5757
Version 0.14.0 (Unreleased)
5858

59+
Version 0.13.2
60+
61+
* Fix ISO 8601 date formatting again
62+
5963
Version 0.13.1
6064

6165
* LFS locking API fixes
66+
* Drop dependency on Guava
6267

6368
Version 0.13.0
6469

gitlfs-common/src/main/java/ru/bozaro/gitlfs/common/JsonHelper.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,37 @@
66
import com.fasterxml.jackson.databind.DeserializationFeature;
77
import com.fasterxml.jackson.databind.ObjectMapper;
88
import com.fasterxml.jackson.databind.SerializationFeature;
9-
import com.fasterxml.jackson.databind.util.StdDateFormat;
9+
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
1010
import org.jetbrains.annotations.NotNull;
1111

12+
import java.text.DateFormat;
13+
1214
import static com.fasterxml.jackson.core.util.DefaultPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR;
1315

1416
/**
1517
* Json utility class.
1618
*
1719
* @author Artem V. Navrotskiy
20+
* @author Marat Radchenko <[email protected]>
1821
*/
1922
public final class JsonHelper {
2023

24+
/**
25+
* git-lfs is broken and doesn't properly parse output of {@link com.fasterxml.jackson.databind.util.StdDateFormat}.
26+
* <p/>
27+
* See https://github.com/git-lfs/git-lfs/issues/3660
28+
*/
29+
@NotNull
30+
public static final DateFormat dateFormat = new ISO8601DateFormat();
31+
2132
@NotNull
2233
public static final ObjectMapper mapper = new ObjectMapper();
2334

2435
static {
2536
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
2637
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
2738
mapper.enable(SerializationFeature.INDENT_OUTPUT);
28-
mapper.setDateFormat(new StdDateFormat());
39+
mapper.setDateFormat(dateFormat);
2940

3041
// By default, pretty printer uses system newline. Explicitly configure it to use \n
3142
mapper.setDefaultPrettyPrinter(
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package ru.bozaro.gitlfs.common.data;
2+
3+
import org.testng.Assert;
4+
import org.testng.annotations.Test;
5+
import ru.bozaro.gitlfs.common.JsonHelper;
6+
7+
import java.text.ParseException;
8+
9+
public final class DateTest {
10+
11+
@Test
12+
public void format() throws ParseException {
13+
final String str = "2006-01-02T15:04:05Z";
14+
Assert.assertEquals(JsonHelper.dateFormat.format(JsonHelper.dateFormat.parse(str)), str);
15+
}
16+
}

0 commit comments

Comments
 (0)