Free Support Forum - aspose.com

AsposeWords for Java 17.6: Nullpointer exception when loading a document with de_US locale

With the locale de_US (caused by a combination of settings in Windows) and loading a document Aspose crashed. It does not matter on which document is loaded.

This example works:
Locale.setDefault(new Locale(“de”, “US”));
new Document(“C:\temp\empty.docx”);

This does not:
Locale.setDefault(new Locale(“en”, “US”));
new Document(“C:\temp\empty.docx”);

But this also works:
Locale.setDefault(new Locale(“en”, “US”));
new Document(“C:\temp\empty.docx”);
Locale.setDefault(new Locale(“de”, “US”));
new Document(“C:\temp\empty.docx”);

@Wouter_Smeenk,

Thanks for your inquiry. Please use the correct language code in Locale constructor. Please refer to the following article.
Internationalization: Understanding Locale in the Java Platform

Yes I agree. But this is caused by the enviroment being set in a certain way. We do not call Locale.setDefault(new Locale(“de”, “US”)); in our code.

I would still not expect a com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
Or a NullPointerException.

I also dont understand why it does not crash when you first set en US

@Wouter_Smeenk,

Thanks for your inquiry. We have logged this problem in our issue tracking system as WORDSJAVA-1761. We will investigate this issue and provide you update after analysis. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-1761) have been fixed in this Aspose.Words for .NET 18.5 update and this Aspose.Words for Java 18.5 update.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan