Why does my code ignore empty fields?


I'm using apache poi to read from excel files but when it comes to the empty cells it skips the cell. Why is it so? I've placed a if else condition to catch it. Here's my code:

while (cellIterator.hasNext()) {

    cell = (XSSFCell) cellIterator.next();
        if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC)

CellIterator does not support iterating over null cells. It will automatically skip such cells. To change this behavior, you need to manually iterate over cells (using 0 based index) of a particluar row.

An example of same is described here.