We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

RTF to HtmlFixed conversion throws NullPointerException using Java

Hello,

our customers provided us with an RTF document that cannot be converted to HTML using Aspose Words for Java (v19.3).

After reducing the document to the most simple version that still fails, it turned out that the combination of indentation (with different indents for first and following lines) and hyphenation caused the NullPointerException.

This is our application code (with some fonts folder initialization, skipped here):

HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
options.setExportEmbeddedImages(true);
options.setExportEmbeddedCss(true);
options.setExportEmbeddedFonts(true);
options.setExportEmbeddedSvg(true);
options.setUpdateFields(false);

Document doc = new Document(inputStream);
doc.save(outputStream, options);

We are using dictionaries from openoffice.org for German hyphenation and register them via Hyphenation.registerDictionary(...)

Stacktrace part, showing all Aspose code and removing our application code:

[...]
Caused by: java.lang.NullPointerException
	at com.aspose.words.zzZL2.zzb(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL2.zzc(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL2.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL2.zzW(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL2.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL5.zzY(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL5.zzVm(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZKZ.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZKZ.zzP(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL8.zzH(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL7.zzC(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZL7.zzU(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzW2.zzY(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzW2.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzYY4.zzYQb(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzYY4.zzY(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzYY4.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzXN.zzjR(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzXN.zzW(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzXN.zzX(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZ77.zzF(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZ77.zzG(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZ77.zzZ4R(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZ77.zzQ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZ6L.zzF(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzYW7.zzc(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zz92.zzF(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zz93.zzZPG(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZMJ.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.Document.updatePageLayout(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.Document.zzXd(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.Document.getPageCount(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zz0E.zzY(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zz0E.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.zzZGP.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.Document.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.Document.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.Document.zzZ(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
	at com.aspose.words.Document.save(Unknown Source) ~[aspose-words-19.3-jdk17.jar:19.3]
[...]

See the attached RTF document (in zip archive) for reproducing the issue.

Please let me know if you have problems with reproducing the error (we had to provide the Arial font so the text had the same length and hyphenation was applied).

Looking forward to your answer and support,
Stefan Raubal, Unycom

Aspose indentation and hyphenation bug.zip (9.3 KB)

@stefan.raubal

We have tested the scenario using the latest version of Aspose.Words for Java 20.1 and have not found the shared issue. So, please use Aspose.Words for Java 20.1.