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:
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();
}
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.
Do I have access to to issue tracking system so I can monitor the progress of WORDSNET-16137?
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?
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.
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.
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)
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.
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.