Uploaded image for project: 'mod-oai-pmh'
  1. mod-oai-pmh
  2. MODOAIPMH-71

Handle json parsing exceptions gracefully

    XMLWordPrintable

    Details

    • Template:
      Standard Bug Write-Up Format
    • Sprint:
      Concorde - Sprint 103
    • Story Points:
      3
    • Development Team:
      Concorde

      Description

      Overview:
      When problems parsing the MARC Json are encountered, a generic 500 Internal Server Error is returned. There doesn't appear to be any way to skip the problematic record, so harvesting cannot proceed. Ideally we would at least return an appropriate error response, and possibly skip the problematic record (actual mechanism TBD)

      Steps to Reproduce:

      1. Populate SRS with a record which will not parse to XML (is not valid JSON)
      2. Perform a listRecords that includes that record - can probably be reproduced by requesting that record directly as well)

      Expected Results:

      • An appropriate error message - maybe including a resumption token which would skip the problematic record?

      Actual Results:

      • A 500 Internal Server Error w/ no indication of the problem

      Additional Information:
      See attached file for example.

      Log entries:

      03 Apr 2019 14:14:06:884 ERROR AbstractGetRecordsHelper [5502018973eqId] Sorry, we can't process your request. Please contact administrator(s).
      java.util.concurrent.CompletionException: org.marc4j.util.JsonParser$Escape: A string value cannot contain data after its closing quote (this is most likely caused by a missing comma between members); at Input Source: "MarcInput", Line: 1, Column: 235, Member Name: a
      at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292) ~[?:1.8.0_151]
      at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308) ~[?:1.8.0_151]
      at java.util.concurrent.CompletableFuture.uniCompose(CompletableFuture.java:943) ~[?:1.8.0_151]
      at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:926) ~[?:1.8.0_151]
      at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) ~[?:1.8.0_151]
      at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) ~[?:1.8.0_151]
      at me.escoffier.vertx.completablefuture.VertxCompletableFuture.lambda$supplyBlockingAsync$11(VertxCompletableFuture.java:334) ~[ms.jar:?]
      at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:79) ~[ms.jar:?]
      at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:289) ~[ms.jar:?]
      at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339) ~[ms.jar:?]
      at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [ms.jar:?]
      at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) [ms.jar:?]
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463) [ms.jar:?]
      at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886) [ms.jar:?]
      at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [ms.jar:?]
      at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151]
      Caused by: org.marc4j.util.JsonParser$Escape: A string value cannot contain data after its closing quote (this is most likely caused by a missing comma between members); at Input Source: "MarcInput", Line: 1, Column: 235, Member Name: a
      at org.marc4j.util.JsonParser.parserError(JsonParser.java:973) ~[ms.jar:?]
      at org.marc4j.util.JsonParser.parserError(JsonParser.java:968) ~[ms.jar:?]
      at org.marc4j.util.JsonParser.parserError(JsonParser.java:964) ~[ms.jar:?]
      at org.marc4j.util.JsonParser.next(JsonParser.java:747) ~[ms.jar:?]
      at org.marc4j.MarcJsonReader.next(MarcJsonReader.java:208) ~[ms.jar:?]
      at org.folio.oaipmh.mappers.MarcXmlMapper.convert(MarcXmlMapper.java:44) ~[ms.jar:?]
      at org.folio.oaipmh.MetadataPrefix.convert(MetadataPrefix.java:59) ~[ms.jar:?]
      at org.folio.oaipmh.helpers.AbstractGetRecordsHelper.buildOaiMetadata(AbstractGetRecordsHelper.java:203) ~[ms.jar:?]
      at org.folio.oaipmh.helpers.AbstractGetRecordsHelper.buildRecords(AbstractGetRecordsHelper.java:169) ~[ms.jar:?]
      at org.folio.oaipmh.helpers.AbstractGetRecordsHelper.lambda$buildRecordsResponse$5(AbstractGetRecordsHelper.java:132) ~[ms.jar:?]
      at me.escoffier.vertx.completablefuture.VertxCompletableFuture.lambda$supplyBlockingAsync$10(VertxCompletableFuture.java:327) ~[ms.jar:?]
      at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:273) ~[ms.jar:?]
      at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) ~[ms.jar:?]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_151]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_151]
      ... 2 more
      

      Interested parties:
      Theodor Tolstoy Harry Kaplanian Piotr Kalashuk

        TestRail: Results

          Attachments

          1. OAIPMH_500.txt
            723 kB
          2. marc21 withholdings.txt
            10 kB
          3. make_invalid.png
            make_invalid.png
            21 kB

            Issue Links

              Activity

                People

                Assignee:
                TotoroDev Illia Daliek
                Reporter:
                cmcnally Craig McNally
                Tester Assignee:
                Craig McNally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases