Random PDF Processing Errors in Aspose PDF for Java (v24.1)

We are experiencing random NullPointerException errors when processing PDFs using Aspose PDF for Java (v24.1). The issue occurs intermittently in our performance environment and is not tied to any specific PDF file. Interestingly, if we retry processing the same file, it usually succeeds, making the issue unpredictable and difficult to debug.

We are currently using Aspose Total for Java, version 24.1, and the API method being used is:

document.save(outputStream);

Below is the stack trace for reference:

c.a.p.i.l10h.lu: null  
	at c.a.p.i.l7v.l0n$lI.lI(Unknown Source)  
	at c.a.p.i.l7v.l0n$lI.serialize(Unknown Source)  
	at c.a.p.i.l10h.le.lI(Unknown Source)  
	at c.a.p.i.l10h.le.serialize(Unknown Source)  
	at c.a.p.i.l7v.l1l$lI.lI(Unknown Source)  
	at c.a.p.i.l7v.l1l$lI.serialize(Unknown Source)  
	at c.a.p.i.l10h.le.lI(Unknown Source)  
	at c.a.p.i.l10h.le.serialize(Unknown Source)  
	at c.a.p.i.l7v.l1l$lI.lI(Unknown Source)  
	at c.a.p.i.l7v.l1l$lI.serialize(Unknown Source)  
	at c.a.p.i.l10h.le.lI(Unknown Source)  
	at c.a.p.i.l10h.le.serialize(Unknown Source)  
	at c.a.p.i.l7v.l1j$lI.lI(Unknown Source)  
	at c.a.p.i.l7v.l1j$lI.serialize(Unknown Source)  
	at c.a.p.i.l10h.le.lI(Unknown Source)  
	at c.a.p.i.l10h.le.serialize(Unknown Source)  
	at c.a.p.i.l10u.lb.lI(Unknown Source)  
	at c.a.p.i.l10if.l0j.lI(Unknown Source)  
	at c.a.p.i.l10if.l0p.lI(Unknown Source)  
	at c.a.p.i.l2p.l0u.lI(Unknown Source)  
	at c.a.pdf.ADocument.lf(Unknown Source)  
	at c.a.pdf.ADocument.save(Unknown Source)  
	at c.a.pdf.Document.save(Unknown Source)  
	at c.a.pdf.ADocument$4.lI(Unknown Source)  
	at c.a.p.i.l89y.lf.lI(Unknown Source)  
	at c.a.p.i.l89y.lj.lI(Unknown Source)  
	at c.a.pdf.ADocument.save(Unknown Source)  
	at c.a.pdf.Document.save(Unknown Source)  
	at c.w.r.p.p.PdfConverterImpl.saveDocument(PdfConverterImpl.java:116)  
	at c.w.r.p.p.PdfConverterImpl.saveDocument(PdfConverterImpl.java:33)  
	... 8 frames truncated  

We noticed that Aspose PDF for Java v25.1 includes a fix for PDFJAVA-44656, which addresses a NullPointerException when saving a PDF file.

Could you confirm whether our issue is related to PDFJAVA-44656? Would upgrading to v25.1 resolve this, or is there a known workaround for v24.1?

Any guidance would be greatly appreciated. Let us know if you need additional details.

Thanks!

@kperry1

The issue was related to specific PDF document where an incomplete and hidden HighlightAnnotation was present on a page. This was resolved in 25.1 version. In case you are facing issue due to similar reasons, upgrading to 25.1 will resolve it. On the other hand, we also recommend using the latest version always as it contains maximum fixes and improvements. You can try it and let us know if you still face this issue. We will further proceed accordingly.