You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Petri Tuomola (Jira)" <ji...@apache.org> on 2020/10/26 03:47:00 UTC

[jira] [Commented] (FINERACT-1242) OfficeTest fails with java.time.format.DateTimeParseException: Text '2020-10-25' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {DayOfMonth=25, Year=2020},ISO resolved to 00:10 of type java.time.format.Parsed

    [ https://issues.apache.org/jira/browse/FINERACT-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17220464#comment-17220464 ] 

Petri Tuomola commented on FINERACT-1242:
-----------------------------------------

Hi [~vorburger] - isn't the problem here with the date format used by the client, and actually Java Time is correct at rejecting it? 

i.e. instead of yyyy-mm-dd it should be yyyy-MM-dd, given that mm is minutes regardless of whether we are using Joda time or Java time. And if Joda time accepted mm, then that was probably not a good idea as you'd end up with a date that is missing a month - which was probably not the intention when coding the client...

Or maybe I'm missing something - did you have a different idea on how to fix this? 

> OfficeTest fails with java.time.format.DateTimeParseException: Text '2020-10-25' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {DayOfMonth=25, Year=2020},ISO resolved to 00:10 of type java.time.format.Parsed
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-1242
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1242
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: SDK
>            Reporter: Michael Vorburger
>            Priority: Blocker
>
> The https://github.com/apache/fineract/blob/develop/fineract-client/src/test/java/org/apache/fineract/integrationtests/newstyle/OfficeTest.java currently fails the Fineract build on the {{develop}} branch, so build is currently broken.
> Note that this (new!) OfficeTest in fineract-client is not to be confused with the https://github.com/apache/fineract/blob/develop/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/OfficeIntegrationTest.java
> I've first noticed this on https://github.com/apache/fineract/pull/1464, but it actually has nothing to do with that PR, I can reliably locally reproduce this. It's very likely an impact of https://github.com/apache/fineract/pull/1179 for FINERACT-826.
> IMPORTANT: Note that, until [~aleks] finalizes https://github.com/apache/fineract/pull/1465 for FINERACT-1209, this (new!) {{OfficeTest}}, and the others like it, run against {{demo.fineract.dev}} instead of {{localhost}}, so in order to test the fix locally, you have to run it with {{-Dfineract.it.url=https://localhost:8443/fineract-provider/api/v1/}}, see {{org.apache.fineract.integrationtests.newstyle.IntegrationTest}}. For the same reason, this appears in the log on Error Reporting for fineract.dev (see FINERACT-932):
> {noformat}java.time.format.DateTimeParseException: Text '2020-10-25' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {DayOfMonth=25, Year=2020},ISO resolved to 00:10 of type java.time.format.Parsed
>         at java.time.format.DateTimeFormatter.createError (DateTimeFormatter.java:2017)
>         at java.time.format.DateTimeFormatter.parse (DateTimeFormatter.java:1952)
>         at java.time.LocalDateTime.parse (LocalDateTime.java:492)
>         at org.apache.fineract.infrastructure.core.serialization.JsonParserHelper.convertDateTimeFrom (JsonParserHelper.java:476)
>         at org.apache.fineract.infrastructure.core.serialization.JsonParserHelper.convertFrom (JsonParserHelper.java:462)
>         at org.apache.fineract.infrastructure.core.serialization.JsonParserHelper.extractLocalDateNamed (JsonParserHelper.java:451)
>         at org.apache.fineract.infrastructure.core.serialization.JsonParserHelper.extractLocalDateNamed (JsonParserHelper.java:376)
>         at org.apache.fineract.infrastructure.core.serialization.FromJsonHelper.extractLocalDateNamed (FromJsonHelper.java:203)
>         at org.apache.fineract.organisation.office.serialization.OfficeCommandFromApiJsonDeserializer.validateForCreate (OfficeCommandFromApiJsonDeserializer.java:75)
>         at org.apache.fineract.organisation.office.service.OfficeWritePlatformServiceJpaRepositoryImpl.createOffice (OfficeWritePlatformServiceJpaRepositoryImpl.java:90)
> Caused by: java.time.DateTimeException: Unable to obtain LocalDateTime from TemporalAccessor: {DayOfMonth=25, Year=2020},ISO resolved to 00:10 of type java.time.format.Parsed
>         at java.time.LocalDateTime.from (LocalDateTime.java:461)
>         at java.time.format.Parsed.query (Parsed.java:235)
>         at java.time.format.DateTimeFormatter.parse (DateTimeFormatter.java:1948{noformat}
> So it seems that while {{"yyyy-mm-dd"}} was a valid _date pattern_ while we were still using JODA Time, this pattern doesn't work anymore now after we switched to {{java.time}}.
> [~Percy Ashu] or [~awasum] is this something one of you be willing to fix soon-ish? ([~ptuomola] FYI.)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)