File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
main/java/ru/bozaro/gitlfs/common
test/java/ru/bozaro/gitlfs/common/data Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,14 @@ See https://github.com/bozaro/git-lfs-java/blob/master/gitlfs-server/src/test/ja
56
56
57
57
Version 0.14.0 (Unreleased)
58
58
59
+ Version 0.13.2
60
+
61
+ * Fix ISO 8601 date formatting again
62
+
59
63
Version 0.13.1
60
64
61
65
* LFS locking API fixes
66
+ * Drop dependency on Guava
62
67
63
68
Version 0.13.0
64
69
Original file line number Diff line number Diff line change 6
6
import com .fasterxml .jackson .databind .DeserializationFeature ;
7
7
import com .fasterxml .jackson .databind .ObjectMapper ;
8
8
import com .fasterxml .jackson .databind .SerializationFeature ;
9
- import com .fasterxml .jackson .databind .util .StdDateFormat ;
9
+ import com .fasterxml .jackson .databind .util .ISO8601DateFormat ;
10
10
import org .jetbrains .annotations .NotNull ;
11
11
12
+ import java .text .DateFormat ;
13
+
12
14
import static com .fasterxml .jackson .core .util .DefaultPrettyPrinter .DEFAULT_ROOT_VALUE_SEPARATOR ;
13
15
14
16
/**
15
17
* Json utility class.
16
18
*
17
19
* @author Artem V. Navrotskiy
20
+ * @author Marat Radchenko <[email protected] >
18
21
*/
19
22
public final class JsonHelper {
20
23
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
+
21
32
@ NotNull
22
33
public static final ObjectMapper mapper = new ObjectMapper ();
23
34
24
35
static {
25
36
mapper .disable (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS );
26
37
mapper .disable (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES );
27
38
mapper .enable (SerializationFeature .INDENT_OUTPUT );
28
- mapper .setDateFormat (new StdDateFormat () );
39
+ mapper .setDateFormat (dateFormat );
29
40
30
41
// By default, pretty printer uses system newline. Explicitly configure it to use \n
31
42
mapper .setDefaultPrettyPrinter (
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments