IndexOutOfBoundsException error while generating Excel file if a child array is empty

Hello,

The current smart marker implementation struggles when processing nested arrays where one or more child arrays are empty.

PFA source code, template, and input.
Error details: Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
Aspose Cells for Java: 25.5

14-may-2025.zip (9.0 KB)

Specifically, it throws an IndexOutOfBoundsException when encountering an empty array within the nested structure. This occurs when attempting to iterate through the child array, even though it’s legitimate for a director to have no reporters (represented by an empty array).

Ideally, the engine should gracefully handle these empty arrays by simply skipping over them and continuing to process the remaining data in the parent iteration.

To improve the functionality and usability, providing a mechanism for the smart marker in the template to check for the presence of items within the target array or collection before processing would be beneficial.

This would allow users to implement conditional logic and avoid errors when dealing with potentially empty nested structures.

@sagaofsilence.dev,

After initial testing, I am able to reproduce the issue as you have mentioned by using your template Excel file with JSON data file and code snippet. I found IndexOutOfBoundsException exception while generating Excel file if a child array is empty for smart markers.

We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSJAVA-46372

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

@sagaofsilence.dev,

We are pleased to inform you that your issue (Ticket ID: “CELLSJAVA-46372”) has been resolved. The fix/enhancement will be included in the next release (Aspose.Cells v25.6) scheduled for release in the first half of June 2025. We will notify you when the next version is released.

1 Like