Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jackson date format doesn't respect system time zone since 1.3.0.M3 #4070

Closed
izeye opened this issue Oct 1, 2015 · 3 comments
Closed

Jackson date format doesn't respect system time zone since 1.3.0.M3 #4070

izeye opened this issue Oct 1, 2015 · 3 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@izeye
Copy link
Contributor

izeye commented Oct 1, 2015

Before 1.3.0.M3, Jackson date format (via spring.jackson.date-format) follows system time zone but after 1.3.0.M3 (including 1.3.0.BUILD-SNAPSHOT), it doesn't follow system time zone.

It could be worked around by downgrading Jackson to 2.5.4 via ext['jackson.version'] = '2.5.4' or setting time zone explicitly via spring.jackson.time-zone=GMT+9.

This is a sample project reproducing the situation:

https://github.com/izeye/spring-boot-throwaway-branches/tree/rest-and-jackson

@wilkinsona
Copy link
Member

This appears to be a bug/change in behaviour in Jackson Databind. It can be reproduced without involving Spring Boot:

ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
System.out.println(objectMapper.writeValueAsString(new Date()));

Dropping back to 2.6.0 also fixes the problem, i.e. the change appears to have been introduced in 2.6.1. I've opened a jackson-databind issue.

I'm going to close this issue. We'll upgrade to new Jackson 2.6.x versions as a matter of course and you seem to have a good workaround for now (setting spring.jackson.time-zone).

@wilkinsona wilkinsona added the status: invalid An issue that we don't feel is valid label Oct 1, 2015
@wilkinsona
Copy link
Member

It looks like this will be fixed in Jackson 2.6.3

@izeye
Copy link
Contributor Author

izeye commented Oct 2, 2015

@wilkinsona Thanks for the comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants