Altinn / altinn-pdf

Altinn platform microservice for generating PDFs
0 stars 1 forks source link

Codelist options based on repeating groups in redux crashes during pdf generation #22

Closed acn-dgopa closed 1 year ago

acn-dgopa commented 2 years ago

Description of the bug

We have a requirement in our app where we need to list values of an object added by a repeating group as code list in another page. F.ex, page 1 has repeating groups for adding persons. Page 2 has a dropdown that will list the persons in a dropdown. For this, we followed the documentation in altinn studio code lists

It works as expected in the app but when i send inn and try to generate pdf, it fails. If i exclude that dropdown from the pdf, it works.

Steps To Reproduce

  1. Create an app with 2 pages
  2. In first page add a repeating group component for list of people
  3. In second page add a dropdown component
  4. Configure the dropdown options such that the values are from the repeating group object in first page
  5. deploy the app
  6. Add 1 or more people in the 1st page
  7. Check values in the dropdown list the people that were added in 1st page
  8. Select 1 value
  9. send the form
  10. Gives "ukjent feil"

Exception from pdf container logs `2022-06-13 09:35:27.627 ERROR 1 --- [nio-5070-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.util.NoSuchElementException: No value present] with root cause

java.util.NoSuchElementException: No value present at java.base/java.util.Optional.orElseThrow(Optional.java:377) ~[na:na] at altinn.platform.pdf.services.PDFGenerator.getDisplayValueFromOptions(PDFGenerator.java:541) ~[classes!/:1.0] at altinn.platform.pdf.services.PDFGenerator.renderLayoutElementContent(PDFGenerator.java:500) ~[classes!/:1.0] at altinn.platform.pdf.services.PDFGenerator.renderLayoutElement(PDFGenerator.java:382) ~[classes!/:1.0] at altinn.platform.pdf.services.PDFGenerator.renderRepeatingGroup(PDFGenerator.java:326) ~[classes!/:1.0] at altinn.platform.pdf.services.PDFGenerator.renderFormLayout(PDFGenerator.java:230) ~[classes!/:1.0] at altinn.platform.pdf.services.PDFGenerator.checkLayoutAndRenderPage(PDFGenerator.java:216) ~[classes!/:1.0] at altinn.platform.pdf.services.PDFGenerator.generatePDF(PDFGenerator.java:187) ~[classes!/:1.0] at altinn.platform.pdf.controllers.PDFController.generate(PDFController.java:27) ~[classes!/:1.0] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.20.jar!/:5.3.20] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.20.jar!/:5.3.20]`

Additional Information

No response

SandGrainOne commented 1 year ago

All PDF content related features are now outside the scope of the PDF-generator. The PDF-generator will be built to generate PDF from HTML produced by the Apps.

Extremely important bug fixes might be considered. This issue is old and stale.