Free Support Forum - aspose.com

NullReferenceException is thrown when RevisionOptions.ShowRevisionBalloons is set to true

I am receiving the following exception when using Aspose to save a PDF and revision option to show revision balloons is true.

Note: This does not happen all the time but for some documents with revisions. I have sample .docx files that reproduce this issue and they can be found at:

https://drive.google.com/drive/folders/1xohJe0URJ9JmvaWr4TTi0pVRGJQTBL6b

these can be used with the sample code below to produce the follow exception:

java.lang.NullPointerException
at com.aspose.words.zz9C.zz5g(Unknown Source)
at com.aspose.words.zz9C.zz5q(Unknown Source)
at com.aspose.words.zzZMW.zzZLS(Unknown Source)
at com.aspose.words.zzZMW.zzW1(Unknown Source)
at com.aspose.words.zzZN9.zzY(Unknown Source)
at com.aspose.words.zzZN9.zzX(Unknown Source)
at com.aspose.words.zzZMW.zzZ(Unknown Source)
at com.aspose.words.zzZN9.zzZ(Unknown Source)
at com.aspose.words.zzZN9.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.zz0R.zzZ(Unknown Source)
at com.aspose.words.zzZHS.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)

Sample code:

try {
	Document docA = new Document("C:\\Temp\\TestAspose.docx");
	Document docB = new Document("C:\\Temp\\TestAspose_v2.docx");

	docA.compare(docB, "Tester", new Date());

	PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
	pdfSaveOptions.getOutlineOptions().setDefaultBookmarksOutlineLevel(1);

	RevisionOptions revisionOptions = docA.getLayoutOptions().getRevisionOptions();
	revisionOptions.setShowRevisionBalloons(true); // removing this line, makes it so there is no exception

	docA.save("C:\\Temp\\TestAspose.pdf", pdfSaveOptions);
} catch (Exception e) {
	e.printStackTrace();
}

Thank you for your help.

@Steven_Zukowski,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16137. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Please share the Java version that you are using at your end. Thanks for your cooperation.

I am using Java 7

I have a few follow up questions:

  1. Do I have access to to issue tracking system so I can monitor the progress of WORDSNET-16137?
  2. Can you give any guidance to what in the Word document itself causes this issue as it only occurs for some documents? And/Or do you have a suggested workaround to avoid this issue?

Thank you.

@Steven_Zukowski,

The issue which was logged with WORDSNET prefix, would be auto resolved for Java variant of Aspose.Words. Unfortunately, there is no direct way to track issues by yourself. But, you are welcome to ask the issue status via forum threads. We will verify the status from our internal issue tracking system and reply you back. Secondly, WORDSNET-16137 is currently pending for analysis and is in the queue. There are no analysis details available at the moment. We will inform you via this thread as soon as this issue is resolved. We apologize for your inconvenience.

@Steven_Zukowski,

The issues you have found earlier (filed as WORDSNET-16137) have been fixed in this Aspose.Words for .NET 18.1 update and this Aspose.Words for Java 18.1 update.

Please also check the following articles:

Using the 2 files from above with the setShowRevisionBalloons(true) does now work successfully when using the 18.1 Words library. Unfortunately other comparisons still fail. Below is a link to 2 word files that will fail when compared when setShowRevisionBalloons(true) and succeed when false.

https://drive.google.com/drive/folders/1kYpC3qKJnHz8wCKJJn1Vz2S-KNRgBCj0?usp=sharing

Here is the stack trace that I receive when comparing those files:

java.lang.NullPointerException: null
at com.aspose.words.zzYYV.zzZil(Unknown Source)
at com.aspose.words.zz3G.zzZ(Unknown Source)
at com.aspose.words.zz3G.zzZ(Unknown Source)
at com.aspose.words.zz3G.zzZYc(Unknown Source)
at com.aspose.words.zzYXN.commit(Unknown Source)
at com.aspose.words.zzX6.zzZ(Unknown Source)
at com.aspose.words.zzYZ3.zzZjv(Unknown Source)
at com.aspose.words.zzX.zzZ(Unknown Source)
at com.aspose.words.zzZZ4.zzZ(Unknown Source)
at com.aspose.words.zzZZ3.zzY(Unknown Source)
at com.aspose.words.zzZZ3.zzX(Unknown Source)
at com.aspose.words.zzZ8U.zzT(Unknown Source)
at com.aspose.words.zzZ86.zzt(Unknown Source)
at com.aspose.words.zzYXO.zzRC(Unknown Source)
at com.aspose.words.zz9J.zzXw(Unknown Source)
at com.aspose.words.zz9K.zz4L(Unknown Source)
at com.aspose.words.zzZNK.zzZ(Unknown Source)
at com.aspose.words.Document.updatePageLayout(Unknown Source)
at com.aspose.words.Document.zzXy(Unknown Source)
at com.aspose.words.Document.getPageCount(Unknown Source)
at com.aspose.words.zz10.zzZ(Unknown Source)
at com.aspose.words.zzZI7.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)

@Steven_Zukowski,

Thanks for your inquiry. We have tested the scenario for documents shared in your first post using latest version of Aspose.Words for Java 18.1 and have not found the issue. We have attached the output PDF with this post for your kind reference. TestAspose.pdf (84.7 KB)

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16418. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The output file that you provided is from the first 2 sample files that I provided (in Nov 17), these correctly work for me as well.

This issue can be reproduced with the files found at the new link. https://drive.google.com/drive/folders/1kYpC3qKJnHz8wCKJJn1Vz2S-KNRgBCj0?usp=sharing These 2 files are basically completely different and produce the new exception. I am not sure if its the same root cause or not. Please try again with these 2 new files.

FYI - I have removed the 2 ‘old’ files from Nov 17 to avoid confusion. Thank you.

@Steven_Zukowski,

Thanks for sharing the detail. We will inform you via this forum thread once this issue is resolved. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-16418) have been fixed in this Aspose.Words for .NET 18.4 update and this Aspose.Words for Java 18.4 update.