FileCorruptedException is Thrown for Word Document using Java

<artifactId>aspose-words</artifactId>
<version>20.12</version>

Code :
doc = new Document(elementFile.getPath());
Exception message thrown : The document appears to be corrupted and cannot be loaded
Exception Stacktrace : com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.FileFormatUtil.zzZ(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.fichorga.etude.metier.signatureNumerique.impl.SignatureNumeriqueServiceImpl.genererContexteSignature(SignatureNumeriqueServiceImpl.java:786)
at com.fichorga.etude.metier.signatureNumerique.impl.SignatureNumeriqueServiceImpl.sendSignatureNumerique(SignatureNumeriqueServiceImpl.java:885)
at com.fichorga.etude.metier.signatureNumerique.impl.SignatureNumeriqueServiceImpl$1.run(SignatureNumeriqueServiceImpl.java:968)
Caused by: java.lang.NullPointerException
at com.aspose.words.zzZHE.zzE(Unknown Source)
at com.aspose.words.zzZHE.zzZOh(Unknown Source)
at com.aspose.words.zzYVC.zzZ(Unknown Source)
at com.aspose.words.zzZ7W.zzZ(Unknown Source)
at com.aspose.words.zzZ7W.zzYg(Unknown Source)
at com.aspose.words.zzZ7W.parse(Unknown Source)
at com.aspose.words.zz9U.read(Unknown Source)
at com.aspose.words.zzA1.read(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
… 6 more
Some Word documents are working and some others not.

Here is a file that trigger the exception
DocExampleAnonyme.zip (59.6 KB)

@Adrux

We are moving your inquiry to Aspose.Words category as you are using it at your side. You will be soon assisted there accordingly.

@Adrux

We have tested the scenario using the latest version of Aspose.Words for Java 20.12 and have not found the shared issue. Please make sure that you are using the latest version of Aspose.Words and using the same document.

I’ve just created a reprex of the problem and I’ve got the same result as you.

It seems that for some reasons, the latest library wasn’t load on our global project and the old version (17.9 for info) was still used.

Thank you for you quick reply and sorry for the time waisted

@Adrux

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.