Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE if the name attribute for form element is not set #151

Closed
mmatecki opened this issue Nov 29, 2017 · 1 comment
Closed

NPE if the name attribute for form element is not set #151

mmatecki opened this issue Nov 29, 2017 · 1 comment

Comments

@mmatecki
Copy link

Hello,
There's NPE if HTML form element doesn't have name attribute set.

Example HTML:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">    
  </head>
  <body>
  <form>
    <input type="text"/>
  </form>
  </body>
</html>

Exception:

java.lang.NullPointerException
	at com.openhtmltopdf.pdfboxout.PdfBoxForm$Field.access$602(PdfBoxForm.java:78)
	at com.openhtmltopdf.pdfboxout.PdfBoxForm.processTextControl(PdfBoxForm.java:435)
	at com.openhtmltopdf.pdfboxout.PdfBoxForm.process(PdfBoxForm.java:803)
	at com.openhtmltopdf.pdfboxout.PdfBoxOutputDevice.processControls(PdfBoxOutputDevice.java:379)
	at com.openhtmltopdf.pdfboxout.PdfBoxOutputDevice.finish(PdfBoxOutputDevice.java:1001)
	at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.writePDF(PdfBoxRenderer.java:607)
	at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.createPDF(PdfBoxRenderer.java:546)
	at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.createPDF(PdfBoxRenderer.java:485)
	at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.createPDF(PdfBoxRenderer.java:481)
	at com.openhtmltopdf.pdfboxout.PdfRendererBuilder.run(PdfRendererBuilder.java:86)

Regards,
Maciek.

@iristic
Copy link

iristic commented Sep 16, 2019

two years too late... but your input element needs to have name attribute set in order not to get NPE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants