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 Tue, 11 Sep 2018 12:32:00 GMT


Richard Zowalla commented on TOMEE-2233:

Thanks for the link to the documentation.


We came up with using this:


{{otherProperties ='T'HH:mm:ss.SSSZ}}


to configure the date-format pattern. This is working. However, it seems, that the default
timezone for formatting is UTC.

However, for our use-case the localized date-format is necessary. From the documentation,
we found, that there is a property "jsonb.locale", which allows for localization of the given

We then adapted the snippet for otherProperties as follows:

otherProperties ='T'HH:mm:ss.SSSZ\njsonb.locale:de{code}

This seems fine. However, the endpoint will fail with:

<ns1:XMLFault xmlns:ns1=""><ns1:faultstring
xmlns:ns1="">java.lang.ClassCastException: Cannot
cast java.lang.String to java.util.Locale</ns1:faultstring></ns1:XMLFault>{code}

As "de" cannot be casted to a java.util.Locale. This seems to be a problem of the following
snippet from JsonbJaxrsProvider


public void setOtherProperties(final String others) {
    final Properties properties = new Properties() {{
        try {
            load(new StringReader(others));
        } catch (final IOException e) {
            throw new IllegalArgumentException(e);
    properties.stringPropertyNames().forEach(k -> config.setProperty(k, properties.getProperty(k)));
    customized = true;

As the configuration value is set as a "plain" String value in the JsonbConfig object via

public final JsonbConfig setProperty(String name, Object value) {
    this.configuration.put(name, value);
    return this;

With this configuration, 
private void addDateFormatConfigConverters(final Map<AdapterKey, Adapter<?, ?>>
converters, final ZoneId zoneIDUTC)
in JohnzonBuilder will fail with the aforementioned ClassCastException 

Caused by: java.lang.ClassCastException: Cannot cast java.lang.String to java.util.Locale


How can we specify a Locale in addition to the data-format 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