tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Zowalla (JIRA)" <>
Subject [jira] [Commented] (TOMEE-2233) DateTimeParseException Regression when upgrading to TomEE 7.1.0
Date Wed, 12 Sep 2018 09:19:00 GMT


Richard Zowalla commented on TOMEE-2233:

To summarize the current migration effort/status:

(1) Injecting a custom date-format pattern works via "otherProperties".

However, adding the "locale" for the date-format does not work via "otherProperties" notation
as the xBean definition of a locale is not injected in the java.util.Properties list key:value
notation due to the simple load(...) call in the provider class.

<?xml version="1.0" encoding="utf-8"?>
 <Service id="johnzon" class-name="">
 otherProperties ='T'HH:mm:ss.SSSZ\njsonb.locale:$germanLocale
<Resource id="germanLocale" class-name="java.util.Locale" constructor="language,country">
 language = de
 country = DE
What is wrong here? Maybe you have a hint.

(2) Thanks for pointing out, that the hard-coded default is UTC and cannot be changed. I can
live with that but that should be documented somewhere (or in an changelog of the release)

(3) It would be beneficial if you could provide an official migration guide to migrate from
a custom configuration to the TomEEJsonBProvider:
<Service id="johnzon" class-name="">
 accessModeName = field
 supportHiddenAccess = true
 doCloseOnStreams = false
 version = 2
 skipNull = true
 datePattern = yyyy-MM-dd'T'HH:mm:ss.SSSZ
In the source I found the config key "johnzon.accessMode". I guess, that this property can
be used to specify the access mode for the JohnzonBuilder. However, there seems to be *no*
documentation available on how to specify this property via "otherProperties" (see (1)). The
values from the "AccessMode" section on will not work:
skipNull -> nullValues = false (in TomEEJsonbProvider)
datePattern -> otherProperties ='T'HH:mm:ss.SSSZnjsonb.locale:$germanLocale
(in TomEEJsonbProvider, but see (1))
accessMode -> ? (could not find any documentation for "johnzon.accessMode" on possible
string-based value, see (1)){code}
Programmatically, I can extend TomEEJsonbProvider and then specify this class via <Service>-tags
in my resources.xml and then configure it via openejb-jar.xml (or directly point to the class
without <Service> definition)
public CustomTomEEJsonbProvider() {
 config.withDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.GERMANY);
 config.setProperty("johnzon.accessMode", new FieldAccessMode(true, true));
This is working. However, I think that it should be possible to configure the default TomEEJsonbProvider
in the same way via "otherProperties" or an other way to avoid building a custom Provider
*Question:* How can we achieve the same behavior without implementing our custom TomEEJsonbProvider
and just leveraging the default TomEEJsonbProvider with customization via "otherProperties"? 

> DateTimeParseException Regression when upgrading to TomEE 7.1.0
> ---------------------------------------------------------------
>                 Key: TOMEE-2233
>                 URL:
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Core Server
>    Affects Versions: 7.1
>         Environment: TomEE 7.1.0 (embedded, plus...), OpenJDK 8, 10, Windows 10 &
MacOs 10.13
>            Reporter: Martin Wiesner
>            Priority: Major
> When upgrading to TomEE 7.1.0 from 7.0.5, we encounter a regression. We observe an unexpected behaviour
with _JSON date format parsing_ which was working correctly (as configured) in TomEE 7.0.5.
> It can be reproduced in several of our projects, see stack trace below.
> {code:java}
> Caused by: javax.json.bind.JsonbException: Text '20180910121456+0200' could not be parsed
at index 0
> at org.apache.johnzon.jsonb.JohnzonJsonb.fromJson(
> at org.apache.johnzon.jaxrs.jsonb.jaxrs.JsonbJaxrsProvider.readFrom(
> at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(
> at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(
> ... 57 more
> Caused by: org.apache.johnzon.mapper.MapperException: Text '20180910121456+0200' could
not be parsed at index 0
> at org.apache.johnzon.mapper.MappingParserImpl.toValue(
> at org.apache.johnzon.mapper.MappingParserImpl.buildObject(
> at org.apache.johnzon.mapper.MappingParserImpl.readObject(
> at org.apache.johnzon.mapper.MappingParserImpl.readObject(
> at org.apache.johnzon.mapper.MappingParserImpl.readObject(
> at org.apache.johnzon.mapper.Mapper.mapObject(
> at org.apache.johnzon.mapper.Mapper.readObject(
> at org.apache.johnzon.jsonb.JohnzonJsonb.fromJson(
> ... 60 more
> Caused by: java.time.format.DateTimeParseException: Text '20180910121456+0200' could
not be parsed at index 0
> at java.time.format.DateTimeFormatter.parseResolved0(
> at java.time.format.DateTimeFormatter.parse(
> at java.time.LocalDateTime.parse(
> at java.time.LocalDateTime.parse(
> at org.apache.johnzon.jsonb.JohnzonBuilder$7.fromString(
> at org.apache.johnzon.jsonb.JohnzonBuilder$7.fromString(
> at
> at
> at org.apache.johnzon.mapper.MappingParserImpl.toValue(
> ... 67 more{code}
> MWE on GitHub will follow shortly via comment.

This message was sent by Atlassian JIRA

View raw message