I am using Apache POI 3.6. I have a column that is blank. I would like it needs to be read after which to another cell. Even when I possibly could resolve NullPointerException problem I possibly could not arrive at the next cell.

Here's my code snippet :

HSSFCell cell = row.getCell(c);
String value = null;

switch (cell.getCellType()) {

    case HSSFCell.CELL_TYPE_FORMULA:
        value = "FORMULA value=" + cell.getCellFormula();
        break;

    case HSSFCell.CELL_TYPE_NUMERIC:
        value = "NUMERIC value=" + cell.getNumericCellValue();
        break;

    case HSSFCell.CELL_TYPE_STRING:
        value = "STRING value=" + cell.getStringCellValue();
        break;

    case HSSFCell.CELL_TYPE_BLANK:
        value="";
        break;

    case HSSFCell.CELL_TYPE_ERROR:
        value="error";
        break;

    default:
        break;
}

System.out.println("CELL col=" + cell.getColumnIndex() + " VALUE=" + value);

If anyone can resolve it, assist me to...

You have to see if cell!=null, if a cell does not exist consecutively, row.getCell(c) returns null

Well, you can look for null before your switch statement, or you might change which call to row.getCell you are making. Checking the Javadoc for POI you will find 2 forms, the very first is what you're using, the 2nd comes with an additional parameter, from the type Row.MissingCellPolicy, where one can pass something that will automagically transform null cells into blanks.

I have finally got things i want. I thank mezmo for this. I wish to share the precise code snippet to become transformed. Just replace the road getting :

HSSFCell cell = row.getCell(c);

with

HSSFCell cell=row.getCell(c, org.apache.poi.ss.usermodel.Row.CREATE_NULL_AS_BLANK );