vaadin / vaadin/spreadsheet

Refresh Cells cause IllegalArgumentException

Open
#666 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
50
Forks
53
Avg merge
1d 21h
Merged PRs (30d)
1

Description

version: 2.1.0.alpha1
method: sheet. refreshCells(Collection cells)

java.lang.IllegalArgumentException: Cell index must be >= 0
	at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:270)
	at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:259)
	at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:45)
	at com.vaadin.addon.spreadsheet.Spreadsheet.loadHyperLinks(Spreadsheet.java:3214)
	at com.vaadin.addon.spreadsheet.Spreadsheet.loadHyperLinks(Spreadsheet.java:3201)
	at com.vaadin.addon.spreadsheet.Spreadsheet.updateRowAndColumnRangeCellData(Spreadsheet.java:3044)
	at com.vaadin.addon.spreadsheet.Spreadsheet.reloadVisibleCellContents(Spreadsheet.java:2676)
	at com.vaadin.addon.spreadsheet.Spreadsheet.updateMarkedCells(Spreadsheet.java:1597)
	at com.vaadin.addon.spreadsheet.Spreadsheet.refreshCells(Spreadsheet.java:1537)

trace code:
firstColumn(c1) is "-1" & lastColumn(c2) is "-1"
for (int c = c1 - 1; c < c2; c++)
--> c is "-2" and c2 is "-1", "-2" < "-1" then run into loop "row.getCell(c);"

    private void loadHyperLinks(int r1, int c1, int r2, int c2) {
        for (int r = r1 - 1; r < r2; r++) {
            final Row row = getActiveSheet().getRow(r);
            if (row != null) {
                for (int c = c1 - 1; c < c2; c++) {
                    Cell cell = row.getCell(c);
                    if (cell != null) {
                        try {
                            Hyperlink link = cell.getHyperlink();

Same error:
com.vaadin.addon.spreadsheet.CellValueManager.loadCellDataForRowAndColumnRange

java.lang.IllegalArgumentException: Cell index must be >= 0
	at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:270)
	at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:259)
	at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:45)
	at com.vaadin.addon.spreadsheet.CellValueManager.loadCellDataForRowAndColumnRange(CellValueManager.java:1105)
	at com.vaadin.addon.spreadsheet.CellValueManager.loadCellData(CellValueManager.java:1045)
	at com.vaadin.addon.spreadsheet.Spreadsheet.updateRowAndColumnRangeCellData(Spreadsheet.java:3050)
	at com.vaadin.addon.spreadsheet.Spreadsheet.reloadVisibleCellContents(Spreadsheet.java:2676)
	at com.vaadin.addon.spreadsheet.Spreadsheet.updateMarkedCells(Spreadsheet.java:1597)
	at com.vaadin.addon.spreadsheet.Spreadsheet.refreshCells(Spreadsheet.java:1537)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Spreadsheet.refreshCells and trace the calls to loadHyperLinks in Spreadsheet.java and loadCellDataForRowAndColumnRange in CellValueManager.java. Reproduce the refreshCells path with firstColumn and lastColumn reported as -1, then verify that the visible-cell refresh completes without passing a negative index to XSSFRow.getCell. No test file is mentioned in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.