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

Verify UTC zoneid as normalized object #250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aguibert
Copy link
Contributor

@aguibert aguibert commented Jun 30, 2020

Recently it was pointed out by @martijndwars in this Yasson issue that we were not serializing ZoneId.of("UTC") correctly:

JSON-B spec section 3.5.3 states:

Implementations MUST support the deserialization of any time zone ID format specified in java.time.ZoneId into a field or property of type java.time.ZoneId. The serialization format of java.time.ZoneId is the normalized zone ID as specified in java.time.ZoneId.

Martijn pointed out the following in his issue:

The normalized part makes a difference when you have a ZoneId.of("UTC"), for example. The zone ID is "UTC", but the normalized zone ID is "Z", as shown by this jshell session:

jshell> import java.time.*;

jshell> ZoneId.of("UTC").getId()
$2 ==> "UTC"

jshell> ZoneId.of("UTC").normalized().getId()
$3 ==> "Z"

One of the Yasson contributors, @Degubi, fixed this issue in a Yasson PR.

When running the Yasson TCK with this change, I noticed that one test was expecting the incorrect behavior. It was expecting ZoneId.of("UTC") to be serialized as the string "UTC", but it should be normalized to "Z"

@aguibert aguibert added TCK challenge A challenge to the TCK labels Jun 30, 2020
@aguibert aguibert self-assigned this Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge A challenge to the TCK TCK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant