Is time zone printing broken for upcoming JDK 1.8u60? #288

Closed
tkowalcz opened this Issue Jun 10, 2015 · 9 comments

Projects

None yet

5 participants

@tkowalcz

This class https://gist.github.com/tkowalcz/ac660693b852a85c14a0 will normally print:

date = Mon, 04 May 2015 22:00:00 GMT

but on 1.8u60 it will print:

date = Mon, 04 May 2015 22:00:00 +00:00

I am not familiar with intricacies of time zones and loading their definitions from JDK resources, but was able to pinpoint where Joda Time breaks: In DefaultNameProvider::getNameSet when looking up time zone definitions there are checks:

135: if (strings != null && strings.length == 5 && id.equals(strings[0])) {
143: if (strings != null && strings.length == 5 && id.equals(strings[0])) {

But on 1.8u60 call to

DateTimeUtils.getDateFormatSymbols(Locale.ENGLISH).getZoneStrings();

will return array of arrays of seven (7!) elements.

Early release of this JDK version can be found here: https://jdk8.java.net/download.html

This will cause mayhem after the release (e.g. for us it will break all our apps talking to Amazon WebServices through their official client, as it will sen malformed requests).

Please advise.

@johnjaylward

If you are using java 8, why are you not using the new built in date/time classes? JodaTime specifically says it is deprecated in favor of the new java8 classes.

@tkowalcz

That is the question for maintainers of e.g. Amazon Web Services Java SDK and possibly many other libraries out there that still use Joda Time. Allowing their libraries to be run on platforms older than Java 8 is one reason that comes to mind.

@tkowalcz tkowalcz referenced this issue in aws/aws-sdk-java Jun 11, 2015
Closed

SDK not working on upcoming Java 1.8u60 #444

@david-at-aws

Yep, the AWS SDK still targets Java 6, and won't be dropping support for 6/7 any time real soon. I guess we could look into doing some magic to detect what version of Java we end up with at runtime and switch to use the built-in Java classes if we're on 8+? Would be nice to have a fix that anyone else using joda-time in a library could easily pick up though.

@tkowalcz

I will try to come up with a push request this evening. If someone want's to take a stab at this the good folks at core-dev-libs pointed me (http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-June/034100.html) to a change that broke time zone printing in Joda Time: https://bugs.openjdk.java.net/browse/JDK-8076287

Just to be clear: JT uses internal API which is documented as "do not use" so it is not the fault of Java folks.

@jodastephen
Member

Please check that 31ea144 fixes the problem.

@tkowalcz

Yes, it does - thank you. I have run the test suite which previously failed on 1.8u60 and it works fine.

@tkowalcz

Are you planning new release with this fixes?

@jodastephen
Member

Done.

@tkowalcz tkowalcz added a commit to tkowalcz/aws-sdk-java that referenced this issue Jun 15, 2015
@tkowalcz tkowalcz JodaTime version that fixes issue (JodaOrg/joda-time#288) with time z…
…one formatting when running on JDK 1.8u60 and newer.
30b3d16
@shorea
shorea commented Sep 29, 2015

We (the AWS SDK for Java) have still been receiving a number of customer contacts about this issue due to users pulling in older versions of Joda-Time in their Maven dependencies. A customer brought to our attention a potential fix that would eliminate the need for a version later then 2.8.1 thus making it much easier to prevent other customers from being bitten by it. I was wondering if I could get your opinion on the legitimacy of the fix and whether it could cause future problems. Basically the customer has recommended we don't use the 'z' symbol for timezone and just use a static string for GMT since we have fixed our format to that anyways. Link to customer issue below.

aws/aws-sdk-java#514

@phensley phensley added a commit to Squarespace/template-compiler that referenced this issue Oct 12, 2015
@phensley phensley Workaround for Joda shortName bug under JDK 8u60.
Bug description: JodaOrg/joda-time#288
1d6a3e9
@justinstoller justinstoller referenced this issue in haus/puppet-server Feb 23, 2016
@haus haus (SERVER-1007) Fix time formatting
No idea what isn't working. No idea why this fixes it.
32131a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment