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

Free Support Forum - aspose.com

FileCorruptedException on wrong system locale (en-RU)

Hi,

I’ve spent tons of time on investigation exception (below) that was occurred on the simplest line of code:
new com.aspose.words.Document()

When I lost the last drop of hope I started flipping through logs and accidentally discovered another stacktrace from aspose.Imaging, that was more informative and told about problems with locale.

Then I found this thread: Support for Russian Culture Name: en-RU (Java)

The decision was to update the primary language on mac to Russian to adjust my locale to ru-RU.

Please, make a handling exception with the wrong locale in Aspose.Words talkative.

Original exception:
com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded. at ru.croc.ctp.just.general.barcode.BarcodePrinterServiceTest.test1([BarcodePrinterServiceTest.java:82](https://barcodeprinterservicetest.java:82/)) Caused by: java.lang.NullPointerException at ru.croc.ctp.just.general.barcode.BarcodePrinterServiceTest.test1([BarcodePrinterServiceTest.java:82](https://barcodeprinterservicetest.java:82/))

Helpful exception from aspose.Imaging:
Caused by: com.aspose.imaging.coreexceptions.FrameworkException: Failed to set license. Details: Culture Name: en-RU is not a supported culture at com.aspose.imaging.License.setLicense(Unknown Source) at ru.croc.ctp.just.general.rendition.AsposeImagingLicenseConfigurator.doSetLicense([AsposeImagingLicenseConfigurator.java:25](https://asposeimaginglicenseconfigurator.java:25/)) at ru.croc.ctp.cmf.aspose.configurator.AbstractAsposeLicenseConfigurator.configure([AbstractAsposeLicenseConfigurator.java:71](https://abstractasposelicenseconfigurator.java:71/)) ... 142 common frames omitted

@EVoynov Could you please specify which version of Aspose.Words for Java you use? I have checked the scenario on my side with the latest 22.1 version of Aspose.Words for Java and no exceptions is thrown. Here is my test code:

Locale defaultLocale = Locale.getDefault();
System.out.println(defaultLocale.getDisplayName());

// set incorrect default Locale
Locale.setDefault(new Locale("en", "RU"));
System.out.println(Locale.getDefault().getDisplayName());

License lic = new License();
lic.setLicense("Aspose.Words.Java.lic");

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("Hello, World!!!");
doc.save("C:\\Temp\\out.docx");

Locale.setDefault(defaultLocale);