Skip to content

ArgumentOutOfRangeException when Denormalizing Quotation Marks and chapter is missing/invalid #386

@pmachapman

Description

@pmachapman

I was downloading the USFM for a draft for the book of 1 John (see target USFM below), and the following error was thrown. The source was a normal blank 1 John.

  System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
	 at SIL.Machine.PunctuationAnalysis.QuoteConventionChangingUsfmUpdateBlockHandler.StartNewChapter(Int32 newChapterNumber)
	 at SIL.Machine.PunctuationAnalysis.QuoteConventionChangingUsfmUpdateBlockHandler.ProcessBlock(UsfmUpdateBlock block)
	 at SIL.Machine.Corpora.UpdateUsfmParserHandler.EndUpdateBlock(UsfmParserState state, IReadOnlyList`1 scriptureRefs)
	 at SIL.Machine.Corpora.UpdateUsfmParserHandler.Verse(UsfmParserState state, String number, String marker, String altNumber, String pubNumber)
	 at SIL.Machine.Corpora.UsfmParser.ProcessToken()
	 at Serval.Translation.Services.PretranslationService.DenormalizeQuotationMarks(String usfm, String quoteConvention) in /app/src/Serval/src/Serval.Translation/Services/PretranslationService.cs:line 399
	 at Serval.Translation.Services.PretranslationService.GetUsfmAsync(String engineId, Int32 modelRevision, String corpusId, String textId, PretranslationUsfmTextOrigin textOrigin, PretranslationUsfmTemplate template, PretranslationUsfmMarkerBehavior paragraphMarkerBehavior, PretranslationUsfmMarkerBehavior embedBehavior, PretranslationUsfmMarkerBehavior styleMarkerBehavior, PretranslationNormalizationBehavior quoteNormalizationBehavior, CancellationToken cancellationToken) in /app/src/Serval/src/Serval.Translation/Services/PretranslationService.cs:line 292
	 at Serval.Translation.Controllers.TranslationEnginesController.GetPretranslatedUsfmAsync(String id, String parallelCorpusId, String textId, Nullable`1 textOrigin, Nullable`1 template, Nullable`1 paragraphMarkerBehavior, Nullable`1 embedBehavior, Nullable`1 styleMarkerBehavior, Nullable`1 quoteNormalizationBehavior, CancellationToken cancellationToken) in /app/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs:line 1216
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
	 at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
	 at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
	 at Microsoft.AspNetCore.Http.Timeouts.RequestTimeoutsMiddleware.<>c__DisplayClass5_0.<<Invoke>g__SetTimeoutAsync|0>d.MoveNext()
  --- End of stack trace from previous location ---
	 at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
	 at Bugsnag.AspNet.Core.Middleware.Invoke(HttpContext context, IClient client)
	 at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Target USFM:

\id 1JN - The Daughter Translation
\s Title for chapter 1
\c 1
\q
\v 1 Poetry first line
\q Poetry second line
\b
\q Poetry third line
\q Poetry fourth“peter line
\p
\v 2
\p
\v 3
\c 2
\p
\v 1 This is a test.
\p
\v 2 This is a test
\s This is a subheading
\c 3
\v 1
\b
\p
\v 2
\s some heading
\r JHN 6:1-5
\p
\v 3
\c 4.
\v 1.
\v v2
\v 3
\v 4
\b
\p
\c 5
\p
\v 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    🔖 Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions