I am reading values from some specific cells in an excel sheet. Those cells generally contain String but sometimes they may be blank (thus may return a blank or a null). I am using the following code to get the cell data:
Cell cellValue = row.getCell(10, Row.RETURN_NULL_AND_BLANK);
List.add(cellValue.getStringCellValue());
However, when I run this code I get a NullPointerException
. Can anybody point out what is wrong and should be added?
Note: I am deliberately using Row.RETURN_NULL_AND_BLANK
and not MissingCellPolicy.RETURN_NULL_AND_BLANK
because using the latter was giving me an error.