Avoid Java NullPointerException by Handling Comment Range in Vertically Merged Cells during DOCX to PDF Conversion

I would like to report a new issue found on Aspose.Words 19.7, I will include all files related
Aspose.zip (35.5 KB)

And this is the stack trace:

Exception in thread "main" java.lang.NullPointerException
	at com.aspose.words.zzZMU.zzZ(Unknown Source)
	at com.aspose.words.zzZMU.zzV(Unknown Source)
	at com.aspose.words.zzXI.zzX(Unknown Source)
	at com.aspose.words.zzZMZ.zzX(Unknown Source)
	at com.aspose.words.zzZML.zzZ(Unknown Source)
	at com.aspose.words.zzZMZ.zzZ(Unknown Source)
	at com.aspose.words.zzZMZ.zzZ(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.zz0H.zzZ(Unknown Source)
	at com.aspose.words.zzZHA.zzZ(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.save(Unknown Source)
	at com.aspose.words.Document.save(Unknown Source)
	at com.sciquest.selectsite.AsposeComparator.main(AsposeComparator.java:9)

@Dwits,

After an initial test with the latest version of Aspose.Words for Java i.e. 19.7, we were unable to reproduce this issue on our end (please see awjava-19.7.pdf (94.4 KB)). We tested on Windows 10 machine (Java 8) by using the following code:

Document document = new Document("E:\\Aspose\\first.docx");
document.save("E:\\Aspose\\awjava-19.7.pdf", SaveFormat.PDF);

@awais.hafeez,

Thank you for your response, unfortunately I have tested it again with a Windows 10 machine and is still failing, I will add some screenshots this time:

AsposeIssue2.zip (212.6 KB)

Regards!

@Dwits,

Please double check if you are sharing the correct “first.docx” file in this thread? Because, we are still unable to reproduce this exception on our end. Please also check the following articles:

https://docs.aspose.com/words/java/installation/
https://docs.aspose.com/words/java/system-requirements/

@awais.hafeez

Thank you for your help I have been reviewed your link and following the steps but at the end of the day I am still getting the issue. I have created another document that has this issue too, I will attach it with the previous document and the program I am using to run the convert

PDF Convert issues.zip (134.7 KB)

Exception:

Exception in thread "main" java.lang.NullPointerException
	at com.aspose.words.zzZLT.zzZ(Unknown Source)
	at com.aspose.words.zzZLT.zzT(Unknown Source)
	at com.aspose.words.zzXE.zzZ(Unknown Source)
	at com.aspose.words.zzXE.zzX(Unknown Source)
	at com.aspose.words.zzZLY.zzV(Unknown Source)
	at com.aspose.words.zzZLL.zzZ(Unknown Source)
	at com.aspose.words.zzZLY.zzX(Unknown Source)
	at com.aspose.words.zzZLY.zzZ(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.zz00.zzY(Unknown Source)
	at com.aspose.words.zz00.zzZ(Unknown Source)
	at com.aspose.words.zzZFM.zzZ(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.save(Unknown Source)
	at com.aspose.words.Document.save(Unknown Source)
	at AsposeComparator.main(AsposeComparator.java:7)

@Dwits,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem (with second.docx) on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-19053. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Hi,

Sorry for bother you again, but could you please tell me if there is an ETA for when you hope this issue will be fixed?

@Dwits,

Regarding WORDSNET-19053, it is to update you that we have completed the analysis of this issue but I am afraid, because of complexity, the implementation of this issue has been postponed till a later date. There are no estimates available at the moment. The analysis details are as follows:

This issue occurs because currently Aspose.Words incorrectly handles start/end comment range inside vertically merged cells in a table. However, MS Word does not show comments for the source document. It seems that MS Word ignores them inside vertically merged cells.
As a workaround, you can delete comments in the document and Aspose.Words’ output will be similar to what MS Word produces. Hope, this helps.

We will inform you via this thread as soon as this issue will be resolved in future. We apologize for any inconvenience.