https://bz.apache.org/bugzilla/show_bug.cgi?id=68231

            Bug ID: 68231
           Summary: removeAllCells()@HSSFRow can raise an exception issue
           Product: POI
           Version: 5.3.x-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: zhong...@pku.org.cn
  Target Milestone: ---

The code is as follows:

 protected void removeAllCells() {
        for (HSSFCell cell : cells) {
            if (cell != null) {
                removeCell(cell, true);
            }
        }
        cells=new HSSFCell[INITIAL_CAPACITY];
    }

NPOI fixed a bug:
https://github.com/nissl-lab/npoi/commit/7a885c42e2f21147c1c4b744db55f6d4af1e69fc

The buggy code is as follows:

public void RemoveAllCells(){
 int initialLen = cells.Count;
 for (int i = 0; i < initialLen; i++){
   RemoveCell(cells[i], true);
}}

The fixed code is as follows:
public void RemoveAllCells(){
  foreach (ICell cell in cells.Values){
    RemoveCell(cell, true);
}}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to