{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse-ee4j/yasson/issues/149","repository_url":"https://api.github.com/repos/eclipse-ee4j/yasson","labels_url":"https://api.github.com/repos/eclipse-ee4j/yasson/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/eclipse-ee4j/yasson/issues/149/comments","events_url":"https://api.github.com/repos/eclipse-ee4j/yasson/issues/149/events","html_url":"https://github.com/eclipse-ee4j/yasson/issues/149","id":343254536,"node_id":"MDU6SXNzdWUzNDMyNTQ1MzY=","number":149,"title":"Attribute java.util.Date without time in format throws exception related to Date-Time API","user":{"login":"Tibor17","id":1045063,"node_id":"MDQ6VXNlcjEwNDUwNjM=","avatar_url":"https://avatars2.githubusercontent.com/u/1045063?v=4","gravatar_id":"","url":"https://api.github.com/users/Tibor17","html_url":"https://github.com/Tibor17","followers_url":"https://api.github.com/users/Tibor17/followers","following_url":"https://api.github.com/users/Tibor17/following{/other_user}","gists_url":"https://api.github.com/users/Tibor17/gists{/gist_id}","starred_url":"https://api.github.com/users/Tibor17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tibor17/subscriptions","organizations_url":"https://api.github.com/users/Tibor17/orgs","repos_url":"https://api.github.com/users/Tibor17/repos","events_url":"https://api.github.com/users/Tibor17/events{/privacy}","received_events_url":"https://api.github.com/users/Tibor17/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-20T21:36:11Z","updated_at":"2018-10-12T12:37:27Z","closed_at":null,"author_association":"NONE","body":"I have observed exception while serializing DTO with `java.util.Date` (yyyy-MM-dd):\r\n`java.time.DateTimeException: Unable to obtain Instant from TemporalAccessor: {},ISO,UTC resolved to 2000-12-31 of type java.time.format.Parsed`\r\n`Caused by: java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: InstantSeconds`\r\n\r\nI am using `org.eclipse:yasson:1.0.1` and `org.glassfish:javax.json:1.1.2`.\r\nI have this code:\r\n```\r\nperson.birth = new SimpleDateFormat(\"yyyy-MM-dd\").parse(\"2001-01-01\");\r\nJsonb jsonb = JsonbBuilder.create();\r\nString personJson = jsonb.toJson(person);\r\n```\r\nand the annotation bindings on `java.util.Date`:\r\n```\r\n@JsonbDateFormat(\"yyyy-MM-dd\")\r\npublic Date birth;\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/eclipse-ee4j/yasson/issues/comments/429311015","html_url":"https://github.com/eclipse-ee4j/yasson/issues/149#issuecomment-429311015","issue_url":"https://api.github.com/repos/eclipse-ee4j/yasson/issues/149","id":429311015,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTMxMTAxNQ==","user":{"login":"bravehorsie","id":9378230,"node_id":"MDQ6VXNlcjkzNzgyMzA=","avatar_url":"https://avatars2.githubusercontent.com/u/9378230?v=4","gravatar_id":"","url":"https://api.github.com/users/bravehorsie","html_url":"https://github.com/bravehorsie","followers_url":"https://api.github.com/users/bravehorsie/followers","following_url":"https://api.github.com/users/bravehorsie/following{/other_user}","gists_url":"https://api.github.com/users/bravehorsie/gists{/gist_id}","starred_url":"https://api.github.com/users/bravehorsie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bravehorsie/subscriptions","organizations_url":"https://api.github.com/users/bravehorsie/orgs","repos_url":"https://api.github.com/users/bravehorsie/repos","events_url":"https://api.github.com/users/bravehorsie/events{/privacy}","received_events_url":"https://api.github.com/users/bravehorsie/received_events","type":"User","site_admin":false},"created_at":"2018-10-12T12:37:27Z","updated_at":"2018-10-12T12:37:27Z","author_association":"CONTRIBUTOR","body":"@Tibor17 even java.util.Date is an time instant which by definition needs a time zone and time part to be parsed. In order to create instant from \"2001-01-01\" string you need to say what time zone you like to parse it into. When you parse this with `java.util.SimpleDateFormat` you will get an instant in a default timezone on the host where you are running. If we do the same in Yasson than for example the same REST request would be parsed differently depending on the host settings. Throwing exception by default in this case may seem user unfriendly but is preventing from shooting yourself into leg accidentally and is the same what java 8 Date/Time API does.\r\n\r\nTo your question _why `java.util.Date` is parsed by Java Date Time API._\r\nThis is required by jsonb specification. See [@JsonbDateFormat javadoc](https://github.com/eclipse-ee4j/jsonb-api/blob/851e55c5ca70a235560fc48aca057459e9edff15/api/src/main/java/javax/json/bind/annotation/JsonbDateFormat.java#L27).\r\n\r\n\r\n"}}
{"actor":{"display_login":"bravehorsie"}}