Getting ClassCastException while Document.getPageCount()

Hi team,

Getting ClassCastException while using Document.getPageCount(). Attaching below the logs for reference.

Logs:

java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class com.aspose.words.Shading (java.lang.Boolean is in module java.base of loader 'bootstrap'; com.aspose.words.Shading is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @777d0bc3)
 at com.aspose.words.zz9w.zzZUB(Unknown Source)
 at com.aspose.words.zz9w.visitParagraphStart(Unknown Source)
 at com.aspose.words.Paragraph.zzXWH(Unknown Source)
 at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
 at com.aspose.words.Paragraph.accept(Unknown Source)
 at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
 at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
 at com.aspose.words.Body.accept(Unknown Source)
 at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
 at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
 at com.aspose.words.Section.accept(Unknown Source)
 at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
 at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
 at com.aspose.words.Document.accept(Unknown Source)
 at com.aspose.words.zz9w.zzXTf(Unknown Source)
 at com.aspose.words.zzW0z.zzW5v(Unknown Source)
 at com.aspose.words.Document.updatePageLayout(Unknown Source)
 at com.aspose.words.Document.zzWIr(Unknown Source)
 at com.aspose.words.Document.getPageCount(Unknown Source)

@ashu_agrawal_sirionlabs_com Could you please attach the problematic document here for testing? We will check the issue and provide you more information.

This was resolved with version upgrade. Please consider this closed

@AdityaSirion It is perfect that you managed to resolve the problem. Please feel free to ask in case of any other issues, we are always glad to help you.

Hi team,
this issue occurred again. Although now it is intermittently.
providing the document on which it got reproduced.
class_cast_exception.zip (33.9 KB)

@manmohansirionlabs Thank you for additional information. Unfortunately, I cannot reproduce the problem on my side using the latest 23.10 version of Aspose.Words for Java. Please try using the latest version and let us know if the problem still persist on your side.

Hi @alexey.noskov ,
Current we are using 22.11 version of aspose-words. Could you check with this version.

@manmohansirionlabs The problem is not reproducible with 22.11 on my side. I have used the following simple code for testing:

Document doc = new Document("C:\\Temp\\in.doc");
doc.getPageCount();

Hi @alexey.noskov ,

This is an intermittent issue. This is not reproducible every time.

@manmohansirionlabs If possible, please create a simple application that will allow us to reproduce the problem.

A post was split to a new topic: Getting ClassCastException while Document.PageCount