Possible Regression: java.lang.ArrayIndexOutOfBoundsException when loading CSV in Aspose.Cells for Node.js via Java v25.10 (works in v23.4)

I am encountering a java.lang.ArrayIndexOutOfBoundsException when trying to load a specific CSV file using Aspose.Cells for Node.js via Java by using new aspose.Workbook(csvFilePath, aspose.getCsvLoadOptions())
I have tested this with different versions and found the following results:

  • v23.4: Works correctly (No error).
  • v25.10: Fails with java.lang.ArrayIndexOutOfBoundsException.

Since this works in the older version, it appears to be a regression introduced in recent updates.

Stack Trace:

Error creating class java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3 at com.aspose.cells.k1.a(Unknown Source)
at com.aspose.cells.k1.parseObject(Unknown Source) at com.aspose.cells.z80.a(Unknown Source)
at com.aspose.cells.z80.a(Unknown Source) at com.aspose.cells.z80.a(Unknown Source)
at com.aspose.cells.z80.a(Unknown Source) at com.aspose.cells.w7.b(Unknown Source)
at com.aspose.cells.w7.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at node.MethodCallBaton.newInstance(MethodCallBaton.java:8)
===============

I have attached the CSV file that causes this issue. Could you please investigate this?
20251125_sample1.zip (237 バイト)

@coopelkatz

Summary
You receive a java.lang.ArrayIndexOutOfBoundsException when loading a specific CSV file with Aspose.Cells for Node.js (Java backend). The same file loads without error in an older version of the library, which suggests that the CSV parsing behavior has changed in newer releases.

Why it happens
The exception originates from the internal CSV parser (com.aspose.cells.k1.parseObject). It occurs when the parser tries to read a column that does not exist in the current row (e.g., “Index 3 out of bounds for length 3”). Typical causes are:

  • Rows that contain fewer fields than the header row.
  • Inconsistent delimiters, trailing delimiters, or mixed delimiter characters.
  • Quoted fields that embed the delimiter or line‑break characters, leading to a mis‑count of columns.

Newer versions may apply stricter validation of column counts, causing the parser to throw an exception where older versions silently accepted the data.

What to do next

  1. Verify the CSV content
  • Open the file in a plain‑text editor.
  • Ensure every data row has the same number of delimiters as the header row.
  • Look for trailing commas, mixed delimiters, or quoted fields that contain commas or new‑line characters.
  1. Load the file with explicit CSV options (if the API provides them)
// Create explicit CSV load options
com.aspose.cells.CsvLoadOptions csvOpts = new com.aspose.cells.CsvLoadOptions();
// Adjust the delimiter if needed
csvOpts.setDelimiter(',');
// Optionally disable automatic numeric conversion
csvOpts.setConvertNumericData(false);
// Optionally treat all cells as text
csvOpts.setDetectColumnTypes(false);

// Load the workbook
com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook("path/to/20251125_sample1.csv", csvOpts);

If the workbook loads successfully, the issue is related to the default parsing settings.

  1. Confirm the behavior with the pure Java library
    Create a small Java console project that references the aspose-cells-<version>.jar (the same JAR used by the Node.js wrapper) and run the code from step 2.
    If the exception still occurs, the problem lies in the core Aspose.Cells for Java library.

  2. Review change information
    Examine the release notes or change log for Aspose.Cells versions released after the one that works for you. Look for entries mentioning CSV parsing, column‑count validation, or related exceptions.

  3. Gather details for further investigation

  • Java runtime version and operating system.
  • Node.js version and the exact NPM package name/version.
  • A few representative rows from the CSV that trigger the error.
  • Results of step 3 (whether the pure Java library reproduces the issue).

Having this information ready will help you or the library maintainers pinpoint whether the behavior is a regression and identify an appropriate fix.

  1. Temporary workaround
    Pre‑process the CSV (e.g., with a small script) to ensure every row has the same number of columns or to replace problematic delimiters with a character that does not appear in the data.
    *Alternatively, read the file as plain text, split it manually, and populate a workbook programmatically.

Next‑step checklist

  1. Open the CSV and confirm column consistency.
  2. Try loading it with explicit CsvLoadOptions as shown above.
  3. Test the same code using the standalone Aspose.Cells Java JAR.
  4. Look for relevant changes in the library’s release notes.
  5. Collect the environment and CSV details; if the problem persists, consider escalating it to the library’s maintainers with the gathered information.

:warning: The explanation is based on typical CSV‑parsing issues; please verify the behaviour in your environment and provide additional details if needed.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

@coopelkatz,

Thanks for the CSV file.

Could you please also provide the definition of getCsvLoadOptions() method. We will look into your issue soon.

@amjad.sahi

The definition of aspose.getCsvLoadOptions() is below:

exports.getCsvLoadOptions = (options) => {
return java.callStaticMethodSync(“ai.coopel.CustomParsers”, “getCsvLoadOptions”);
};

The corresponding Java class CustomParsers is attached.
CustomParsers.zip (1.0 KB)

@coopelkatz,

Thanks for the code snippet.

We require thorough evaluation on the exception “java.lang.ArrayIndexOutOfBoundsException” when loading your CSV with Aspose.Cells for Node.js via Java. 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): CELLSNODEJSJAVA-78

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.

@coopelkatz
I tested your CustomParser and csv file with Aspose.Cells for Node.js via Java v25.10, it works fine.

var aspose = aspose || {};
aspose.cells = require("aspose.cells");

var java = require("java");

exports.getCsvLoadOptions = (options) => {
    return java.callStaticMethodSync("cellsTestDemo.CustomParsers", "getCsvLoadOptions");
};

console.log(aspose.cells.CellsHelper.getVersion());
var workbook = new aspose.cells.Workbook("20251125_sample1.csv", exports.getCsvLoadOptions());
console.log(workbook.getWorksheets().get(0).getCells().get("A1").getStringValue());
console.log("done");

The console output is below:

25.10.0
CustomParser.parseObject called
CustomParser.parseObject called
COL_ID
done

The following line is added to your CustomParse to verify the parseObject() called.

System.out.println("CustomParser.parseObject called");

Could you tell me how you deployed the CustomParser class? What version of Java and Java Bridge did you use? I did a clean install of v25.10 on Windows for testing, and the Java Bridge version installed was 0.16.2. I also tested Java 1.8 and Java 22. Thanks.

@Nick.Liu
Thank you for looking into it.
I can confirm the issue occurs even without our custom parser.
The issue occurs if you use aspose.cells@25.10 . The issue doesn’t occurs with aspose.cells@25.7 .

  • Node.js v20.18.0
  • Java Temurin-17.0.17+10

package.json

{
  "name": "study-aspose",
  "version": "0.0.1",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "UNLICENSED",
  "description": "",
  "dependencies": {
    "aspose.cells": "25.10",
    "java": "0.13.0",
    "node-gyp": "9.3.1"
  },
  "overrides": {
    "java": {
      "nan": "2.17.0",
      "async": "2.6.4",
      "node-gyp": "9.3.1"
    },
    "aspose.cells": {
      "java": "0.13.0"
    }
  }
}

index.js

var aspose = aspose || {};
aspose.cells = require("aspose.cells");

var workbook = new aspose.cells.Workbook("20251125_sample1.csv");
console.log(
  workbook.getWorksheets().get(0).getCells().get(0, 0).getStringValue()
);

@coopelkatz
By testing the following sample code on the latest version v25.10, we were able to run the program normally without any exceptions.

var aspose = aspose || {};
aspose.cells = require("aspose.cells");

console.log(aspose.cells.CellsHelper.getVersion());
var workbook = new aspose.cells.Workbook("20251125_sample1.csv");
console.log(
  workbook.getWorksheets().get(0).getCells().get(0, 0).getStringValue()
);

The output:

25.10.0
COL_ID

If you still have questions, would you like to provide a detailed description of your abnormal information? If you could provide screenshots and highlight the errors, it would be very helpful for us to locate the issue. We will check it soon.

@coopelkatz
I tried installing the aspose.cells@25.10.0 package using your package.json file on the same version of Node.js and JDK, but it didn’t work(Compilation error). So I changed the java-bridge version as follows:
“java”: “0.13.0” => “java”: “0.16.2”, the installation works and the program works fine.
I suggest you reinstall aspose.cells@25.10.0 in a new directory using the updated package.json.

{
  "name": "study-aspose",
  "version": "0.0.1",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "UNLICENSED",
  "description": "",
  "dependencies": {
    "aspose.cells": "^25.10.0",
    "java": "^0.16.2",
    "node-gyp": "9.3.1"
  },
  "overrides": {
    "java": {
      "nan": "2.17.0",
      "async": "2.6.4",
      "node-gyp": "9.3.1"
    },
    "aspose.cells": {
      "java": "0.16.2"
    }
  }
}

@Nick.Liu @amjad.sahi
Thank you for looking into it.
Now I finally found the trigger that causes this regression.

If OS’s language is set to ja_JP.UTF-8, the issue is reproducible.

  1. extract the attached repro.zip
  2. build Docker image by docker buildx build --platform linux/amd64 -t aspose_x64 . --no-cache
  3. run the docker image by docker run --platform=linux/amd64 -it aspose_x64 /bin/bash
  4. inside the docker, run node index.js
  5. you’ll see the issue.
  6. if you run LANG=C node index.js, the issue won’t occur.

repro.zip (20.4 KB)

@coopelkatz
Thanks for your feedback and details. We will investigate your issue further. Once we have an update on it, we will let you know.

@coopelkatz
Thank you for providing the detailed steps, which enabled us to reproduce the issue in the Japanese environment . We will fix it as soon as possible.