Null Pointer Exception while calculating word count for a specific file

Hi,
we are using aspose total for java when we trigger word count for attached doc , aspose library throws Null Pointer Exception as. below

aspose version

<dependency>
   <groupId>com.aspose</groupId>
   <artifactId>aspose-total</artifactId>
   <version>23.2</version>
   <type>pom</type>
</dependency>

Please find the document which is giving error in attachment

com.aspose.words.zzO6.zzYmI(Unknown Source)
at com.aspose.words.zzYqH.zzXT0(Unknown Source)
at com.aspose.words.zzYNZ.zzYNP(Unknown Source)
at com.aspose.words.zzO6.zzYNP(Unknown Source)
at com.aspose.words.zzXon.zzYNP(Unknown Source)
at com.aspose.words.zzQd.zzYNP(Unknown Source)
at com.aspose.words.zzXeV.zzYNP(Unknown Source)
at com.aspose.words.zzZ4w.zzYNP(Unknown Source)
at com.aspose.words.zzZ4w.zzYNP(Unknown Source)
at com.aspose.words.zzZ4w.zzYNP(Unknown Source)
at com.aspose.words.zzRJ.zzYNP(Unknown Source)
at com.aspose.words.zzUB.zzYNP(Unknown Source)
at com.aspose.words.zzYNZ.zzXT0(Unknown Source)
at com.aspose.words.zzYNZ.zzYNP(Unknown Source)
at com.aspose.words.Document.zzYNP(Unknown Source)
at com.aspose.words.zzW8R.zzX6x(Unknown Source)
at com.aspose.words.zzW8R.zzYNP(Unknown Source)
at com.aspose.words.zzWMr.zzYNP(Unknown Source)
at com.aspose.words.Document.zzX6x(Unknown Source)
at com.aspose.words.Document.zzYNP(Unknown Source)
at com.aspose.words.Document.zzYNP(Unknown Source)
at com.aspose.words.Document.updateWordCount(Unknown Source)

I am unable to upload file in ticket as file size is 14 MB

@Nikhil_Kamani Could you please upload the problematic document to google drive or dropbox and share it here. Unfortunately, it is impossible to say what the problem is without a real document.

Hi @alexey.noskov
Can you provide me any link for google drive or drop box where i can upload the problamatic files

@Nikhil_Kamani There is no public file exchange resource in Aspose. So you can upload the document to your google drive and share the link.

@alexey.noskov

I have placed the failing files in below drive , please let me know if you can access them
https://drive.google.com/drive/folders/12f_-a7Mq5DH22zQbKBrQMUiw5QH2VRzF?usp=sharing

@Nikhil_Kamani I have tested the scenario using the latest 23.4 version of Aspose.Words for Java and cannot reproduce the problem on my side. Here is the test code:

Document doc = new Document("C:\\Temp\\Chapter_11_large.docx");
doc.updateWordCount();

I have tested with the both documents you had provided.

Hi @alexey.noskov

I tried with aspose-total 23.4 , still get the same result

instead of directly passing the file to Document , can you try to convert the file into inputstream and try as our code is converting it into the stream below is our code for reference

        com.aspose.words.Document document = 
        new com.aspose.words.Document(fileStream);
        WordCountDetails wordCountDetails = new WordCountDetails();

        document.setIncludeTextboxesFootnotesEndnotesInStat(true);
        document.updateWordCount(true); // works if i remove true from here

        wordCount = document.getBuiltInDocumentProperties().getWords();
        pageCount = document.getBuiltInDocumentProperties().getPages();

it does work if i replace

document.updateWordCount(true) to document.updateWordCount();

although can you tell me what are the implications on accuracy if i remove this boolean value true ?

@Nikhil_Kamani Thank you for additional information. We managed to reproduce the problem on my side.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25393

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

When you call document.updateWordCount(true) it also updates lines count in the document. Calling updateWordCount without parameters updates only words count.

HI @alexey.noskov , is there any update on ticket WORDSNET-25393

@Nikhil_Kamani We have completed analysis of the issue. The problem occurs upon building document layout (required for calculating line numbers), because invalid floating shape properties in a footnote are not expected and handled.
The issue, is not yet scheduled for development. We will keep you updated and let you know once the issue is resolved.

Hi @alexey.noskov
Is there any time line on when this can be picked up and when we get the fix

@Nikhil_Kamani Unfortunately, there are no news regarding the issue. It is not yet scheduled for development. We will be sure to let you know once there is any update regarding it. Please accept our apologies for your inconvenience.

HI @alexey.noskov
It has been long now , is there any new updates on when we could expect the fix

@Nikhil_Kamani Unfortunately, the issue is still not scheduled for development. i have asked the responsible developer to take a look at the issue once again and schedule it for development if possible. Please accept our apologies for you inconvenience.

Hi @alexey.noskov
Thanks for the update, Please do check with your dev , we want this issue to be resolved as we are closing in our release and this issue can hamper user experience .

@Nikhil_Kamani The fix is already implemented and the code is currently in review. If everything goes smoothly, the fix will be included into the next 23.7 version of Aspose.Words. We will be sure to let you know once version with the fix is available.

@alexey.noskov
Is the version 23.7 ready or released ?

@Nikhil_Kamani 23.7 version is not released yet. It will be published at the beginning of July. We will be sure to let you know once it is available.

HI @alexey.noskov
Is the new version ready for release ?