Free Support Forum - aspose.com

FileCorruptedException is thrown while importing RTF using Java

Hi,

first of all, some info :slight_smile:

I’m using last version of aspose in a springboot from linux:

aspose-words
21.1
jdk17

Some rtf docs fail when opening them like:

com.aspose.words.Document document = asposeFactory.getDocument(in);

With an exception:

Caused by: com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.FileFormatUtil.zzY(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.aspose.words.Document.(Unknown Source)
at nl.base.aspose_service.asposefactory.AsposeFactory.getDocument(AsposeFactory.java:25)
… 66 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.aspose.words.zzYSR.zzO(Unknown Source)
at com.aspose.words.zzYTQ.zzYAn(Unknown Source)
at com.aspose.words.zzYSE.zzYy0(Unknown Source)
at com.aspose.words.zzYSE.zzYy1(Unknown Source)
at com.aspose.words.zzYSE.zzKQ(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
… 71 common frames omitted

While these rtf files can be opened without any issue by using Ms Office Word or OpenOffice, they crash when opening via aspose, so I cannot work with them.

It seems it is about an hyperlink so I created the smallest as possible rtf (removing superfluous data) that makes aspose to trigger the exception.

Thanks in advance

rtf_files.zip (10.0 KB)

@basenet

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

For document link_not_working_with_aspose_from_openoffice.rtf, we have not found the issue while using the latest version of Aspose.Words for Java 21.1. Please make sure that you are using the correct document and latest version of Aspose.Words for Java.

Thank you @tahir.manzoor for you fast answer, we will wait for that WORDSNET-21628 one :slight_smile:

@basenet

Hopefully, you will get the fix of this issue in the next version of Aspose.Words i.e. 21.2. Please note that this ETA is not final at the moment. We will inform you via this forum thread once it is resolved.