We are getting error while trying to read the data to excel using aspose(java.lang.StringIndexOutOfBoundsException: String index out of range: 0)

Hi Team,

we are using aspose cells jar version 21.9 and we are getting exceptions while reading the file.

I have attached the file and the code which is throwing the error is below,

Code :

final License license = new License(); license.setLicense(licensePath); try(InputStream workBkInput = new BufferedInputStream(new FileInputStream(inputFileName))) {
final Workbook workbook = new Workbook(workBkInput); // Erroring out here final File filePath = getFile(inputFileName); workbook.getWorksheets().get(0).setVisible(true);
}

exception log:

String index out of range: 0
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658)
at com.aspose.cells.zbds.n(Unknown Source)
at com.aspose.cells.zaqa.a(Unknown Source)
at com.aspose.cells.zarg.b(Unknown Source)
at com.aspose.cells.zarh.a(Unknown Source)
at com.aspose.cells.zarh.a(Unknown Source)
at com.aspose.cells.zarh.a(Unknown Source)
at com.aspose.cells.zarh.a(Unknown Source)
at com.aspose.cells.zaql.n(Unknown Source)
at com.aspose.cells.zaql.a(Unknown Source)
at com.aspose.cells.zaql.a(Unknown Source)
at com.aspose.cells.ze.a(Unknown Source)
at com.aspose.cells.ze.d(Unknown Source)
at com.aspose.cells.ze.s(Unknown Source)
at com.aspose.cells.ze.a(Unknown Source)
at com.aspose.cells.zaru.a(Unknown Source)
at com.aspose.cells.zkk.a(Unknown Source)
at com.aspose.cells.zkk.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
at com.rsi.cis.preprocessor.service.utils.ExcelUtils.excelExtract(ExcelUtils.java:99)

sample.zip (1.4 MB)

@nvn16,

Thanks for the sample file.

Please notice, we were able to reproduce the issue as you mentioned. We found an error “java.lang.StringIndexOutOfBoundsException: String index out of range: 0” while trying to read the Excel file via Aspose.Cells for Java API.
e.g.
Sample code:

Workbook workbook = new Workbook("f:\\files\\sample.xlsx");

We have logged a ticket with an id “CELLSJAVA-44939” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@nvn16,

This is to inform you that your issue (logged earlier as “CELLSJAVA-44939”) has been resolved now. The fix will be included in our upcoming release (Aspose.Cells v22.11) which is scheduled in the first half of November, 2022. You will also be notified when the next version is released.

The issues you have found earlier (filed as CELLSJAVA-44939) have been fixed in this update. This message was posted using Bugs notification tool by Peyton.Xu