Tested with https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.28-SNAPSHOT/pdfbox-app-2.0.28-20230322.075148-68.jar
That seems to have fixed it. Your code change is exactly the one I would have made. Thank you! Chris -----Original Message----- From: Tilman Hausherr <[email protected]> Sent: Tuesday, March 21, 2023 9:35 PM To: [email protected] Subject: [EXTERNAL] Re: Bug in PDFBox Hi, Thanks, fixed in https://urldefense.com/v3/__https://issues.apache.org/jira/browse/PDFBOX-5577__;!!B5cixuoO7ltTeg!CS0pAuklmnMn3OEGICbaRovLUvZAQfIpfBzNVkG0b4HUhGwryq2vQlGM7mn99oNcGGhQevn_q35mbyCxt8UszvkcRQ$ I wonder if there will be further problems. Please test with a snapshot version in a few hours: https://urldefense.com/v3/__https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.28-SNAPSHOT/__;!!B5cixuoO7ltTeg!CS0pAuklmnMn3OEGICbaRovLUvZAQfIpfBzNVkG0b4HUhGwryq2vQlGM7mn99oNcGGhQevn_q35mbyCxt8UQ7wANMQ$ Tilman On 22.03.2023 01:09, Eykamp, Chris wrote: > Hi, > > Below is a bug I discovered in pdfbox (2.0.27, Windows, JRE 1.8.0_361). I > traced it through the code and saw there is in fact a way that a (probably > malformed) form could generate the NPE. I wish I could share the pdf > document to reproduce, but I cannot. Perhaps looking at the where a null > could come from in acroFormLegacyMode will clarify the situation. It's > pretty clear when you look at the relevant code. > > I think there should be a null check, and then skip the problematic field if > you find one... or at least emit a more helpful message. > > Thanks, > > Chris > >> java -jar pdfbox-app-2.0.27.jar PDFMerger mydoc.pdf mydoc.pdf >> merged.pdf > Exception in thread "main" java.lang.NullPointerException > at > org.apache.pdfbox.multipdf.PDFMergerUtility.acroFormLegacyMode(PDFMergerUtility.java:1451) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.mergeAcroForm(PDFMergerUtility.java:1262) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:576) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.legacyMergeDocuments(PDFMergerUtility.java:461) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:347) > at org.apache.pdfbox.tools.PDFMerger.merge(PDFMerger.java:70) > at org.apache.pdfbox.tools.PDFMerger.main(PDFMerger.java:49) > at org.apache.pdfbox.tools.PDFBox.main(PDFBox.java:81) > > > > ________________________________ > > NOTICE - This communication may contain confidential and privileged > information that is for the sole use of the intended recipient. Any viewing, > copying or distribution of, or reliance on this message by unintended > recipients is strictly prohibited. If you have received this message in > error, please notify us immediately by replying to the message and deleting > it from your computer. > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] ________________________________ NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer.
