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

Free Support Forum - aspose.com

Aspose Licensed version 21.9 throwing java.lang.ArrayIndexOutOfBoundsException - Java

Hi Team,

Recently We have upgraded our App with Licensed Aspose latest version – 21.9 for applying Watermark on the Excel files.

But, It has been observed that with this latest Aspose version few of the XLSX files are not getting watermarked and its throwing “ArrayIndexOutOfBoundsException” but same files with older version – 8.9.0 (which we were using earlier) are perfectly getting watermarked.


while saving i am getting this exception.


please help me how i can resolve it with version 21.9

Note - Ideally the latest version should be compatible with the older version fixes but it looks this is not the case with latest Aspose version- 21.9



Please provide test case (simulation code/console program without compilation errors, template files(if any), etc.) to reproduce the issue on our end, we will check it soon.

PS. please zip the files prior attaching here.

Hi Team,

Template file and Code has been attached.
Below is the exception we are getting :-
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:422)
at java.util.ArrayList.get(ArrayList.java:435)
at com.aspose.cells.WorksheetCollection.get(Unknown Source)
at com.aspose.cells.WorksheetCollection.a(Unknown Source)
at com.aspose.cells.zsi.q(Unknown Source)
at com.aspose.cells.zsi.(Unknown Source)
at com.aspose.cells.zf.b(Unknown Source)
at com.aspose.cells.zzj.b(Unknown Source)
at com.aspose.cells.zf.a_(Unknown Source)
at com.aspose.cells.zzj.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)
at XLSWatermarking1.main(XLSWatermarking1.java:31)

Please help in resolving it.TestFile.zip (24.5 KB)
TestFile.zip (24.5 KB)


I did test your scenario/case using your sample code and template file with latest version/fix (Aspose.Cells for Java 21.12.x) and it works fine. Please try our latest version and let us know your feedback.
aspose-cells-21.12.6-java.zip (7.5 MB)

Thanks Amjad for looking into it.

Yes with latest Version( Aspose.Cells for Java 21.12.x) Exception “java.lang.ArrayIndexOutOfBoundsException” on loading an XLSX file is not coming. Working fine.

is it possible to make the same fix available for Aspose.cells Version 21.9 as well by any chance ?


Thanks for confirmation that the latest version/fix fixes the issue.

We are sorry but we cannot include fixed to older versions. All the enhancements and fixes are based based on latest APIs set only. So, you may upgrade to latest version/fix for your needs.