Uploaded image for project: 'mod-circulation'
  1. mod-circulation
  2. CIRC-1577

Date parsing in mod-circulation does not handle loanDate/dueDate without timezone information but allows saving loans without that information

    XMLWordPrintable

Details

    • EPAM-Veg Sprint 145, EPAM-Veg Sprint 146
    • 2
    • Vega
    • Morning Glory (R2 2022) Bug Fix
    • Update all of the migrated loans to have the expected datetime format. This could take a considerable amount of time for larger libraries, and may also introduce other issues.
    • !!!ALL!!!
    • Implementation coding issue

    Description

      Overview:

      When updating a loan via PUT (eg. changing a due date, updating a loan date, setting renewals as part of a loan migration), the /circulation/loans/<loanId> endpoint allows you to set a loanDate that other parts of the system will consider invalid and cause other processes to fail (eg. renewing loans, recalls, sending notices, generating financial transaction reports, etc.). The business logic APIs should return an error if the datetime string provided does not comply with system expectations OR date parsing in other areas of the system should accept a wider variety of datetime values.

      Steps to Reproduce:

      1. Log into https://folio-lotus.dev.folio.org (or snapshot) and create a loan
      2. Using the circulation/loans/<loanId> PUT api, update the loanDate to remove the time zone offset/indicator ("Z") and set the due date in the past
      3. Attempt to renew the loan via the UI

      Expected Results:

      Loan is renewed.

      Actual Results:

      500 error

      Text '2022-07-01T05:00:00' could not be parsed, unparsed text found at index 10
      java.time.format.DateTimeParseException: Text '2022-07-01T05:00:00' could not be parsed, unparsed text found at index 10
      	at java.base/java.time.format.DateTimeFormatter.parseResolved0(Unknown Source)
      	at java.base/java.time.format.DateTimeFormatter.parse(Unknown Source)
      	at java.base/java.time.ZonedDateTime.parse(Unknown Source)
      	at org.folio.circulation.support.utils.DateFormatUtil.parseDateTimeString(DateFormatUtil.java:513)
      	at org.folio.circulation.support.utils.DateFormatUtil.parseDateTime(DateFormatUtil.java:324)
      	at org.folio.circulation.support.utils.DateFormatUtil.parseDateTime(DateFormatUtil.java:298)
      	at org.folio.circulation.support.json.JsonPropertyFetcher.getDateTimeProperty(JsonPropertyFetcher.java:79)
      	at org.folio.circulation.support.json.JsonPropertyFetcher.getDateTimeProperty(JsonPropertyFetcher.java:72)
      	at org.folio.circulation.domain.Loan.getLoanDate(Loan.java:256)
      	at org.folio.circulation.domain.policy.library.ClosedLibraryStrategyService.applyFixedDueDateLimit(ClosedLibraryStrategyService.java:124)
      	at org.folio.circulation.domain.policy.library.ClosedLibraryStrategyService.lambda$applyStrategy$4(ClosedLibraryStrategyService.java:93)
      	at org.folio.circulation.support.results.Result.next(Result.java:274)
      	at org.folio.circulation.domain.policy.library.ClosedLibraryStrategyService.applyStrategy(ClosedLibraryStrategyService.java:93)
      	at org.folio.circulation.domain.policy.library.ClosedLibraryStrategyService.lambda$applyClosedLibraryDueDateManagement$0(ClosedLibraryStrategyService.java:82)
      	at org.folio.circulation.support.results.Result.next(Result.java:274)
      	at org.folio.circulation.domain.policy.library.ClosedLibraryStrategyService.lambda$applyClosedLibraryDueDateManagement$1(ClosedLibraryStrategyService.java:82)
      	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
      	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
      	at java.base/java.util.concurrent.CompletableFuture.complete(Unknown Source)
      	at io.vertx.ext.web.client.impl.HttpContext.handleDispatchResponse(HttpContext.java:400)
      	at io.vertx.ext.web.client.impl.HttpContext.execute(HttpContext.java:387)
      	at io.vertx.ext.web.client.impl.HttpContext.next(HttpContext.java:365)
      	at io.vertx.ext.web.client.impl.HttpContext.fire(HttpContext.java:332)
      	at io.vertx.ext.web.client.impl.HttpContext.dispatchResponse(HttpContext.java:294)
      	at io.vertx.ext.web.client.impl.HttpContext.lambda$null$8(HttpContext.java:550)
      	at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100)
      	at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63)
      	at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:38)
      	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
      	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
      	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
      	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
      	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      	at java.base/java.lang.Thread.run(Unknown Source)
      

      Additional Information:

      As mentioned in the overview, this affects other circulation-related processes, as well, and appears to have arisen in Lotus; though it may have been causing issues in prior releases, as well. One way that loans could get into this state is if they were migrated with earlier versions of the FOLIO-FSE/folio_migration_tools loans migrator tool. Therefore, this issue affects a number of libraries that are live on Lotus.

      URL:
      Interested parties:

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                OleksandrVidinieiev Oleksandr Vidinieiev
                brookstravis Brooks Travis
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases