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

Free Support Forum - aspose.com

IllegalStateException at importCSV() with US timestamp data under JRE6 and French (France) locale

I'm getting a java.lang.IllegalStateException under this very specific environment:
  • Java SE 6u45
  • Control Panel -> Region and Language -> set Format to "French (France)"
  • A time.txt file containing only "11/10/2014 11:03:34" and CR+LF at the end
  • Aspose.Cells for Java 8.2.2
  • Windows 7

Code to reproduce issue:
final Locale locale = new Locale("en", "US");

final Workbook workbook = new Workbook();
workbook.getSettings().setLocale(locale);

final Worksheet sheet = workbook.getWorksheets().get(0);
final Cells cells = sheet.getCells();

final TxtLoadOptions options = new TxtLoadOptions();
options.setLocale(locale);

cells.importCSV(“C:\Temp\time.txt”, options, 0, 0);

Expected output:

No errors; program terminates normally.

Actual output:

Exception in thread “main” java.lang.IllegalStateException: Parse double exception: illegal string format
at com.aspose.cells.b.a.zo.a(Unknown Source)
at com.aspose.cells.b.a.zo.a(Unknown Source)
at com.aspose.cells.zanr.a(Unknown Source)
at com.aspose.cells.zbiq.a(Unknown Source)
at com.aspose.cells.zbiq.b(Unknown Source)
at com.aspose.cells.zbiq.a(Unknown Source)
at com.aspose.cells.zbiq.a(Unknown Source)
at com.aspose.cells.Cells.importCSV(Unknown Source)
at asposetest.AsposeTest.main(AsposeTest.java:40)

Other observations:
  • Also reproducible when Windows Region and Language Format is set to "Finnish (Finland)"
  • Works fine when Windows Region and Language Format is set to “English (United States)”
  • Works fine with JRE 7 and 8
Please advise.

Hi Simon,

Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells
for Java v8.2.2.3
it should fix your issue.

We have tested your issue with the following code and it worked fine both for French and Finland settings.

Java


//final Locale locale = new Locale(“fi”, “FI”);

final Locale locale = new Locale(“fr”, “FR”);


final Workbook workbook = new Workbook();

workbook.getSettings().setLocale(locale);


final Worksheet sheet = workbook.getWorksheets().get(0);

final Cells cells = sheet.getCells();


final TxtLoadOptions options = new TxtLoadOptions();

options.setLocale(locale);


cells.importCSV(“time.txt”, options, 0, 0);

Hi Shakeel,


Great! 8.2.2.3 has fixed this issue.

By the way, the original test case was about keeping the Locale object fixed at en_US, while the Windows Region & Language Format is set to French (France) or Finnish (Finland) in Control Panel. But that is now working as well.

Many thanks.

Simon

Hi Simon,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest version. Let us know if you encounter any other issue, we will be glad to look into it and help you further.