Cómo identificar una celda está en blanco o nula o vacía mientras lee un archivo de Excel

Leí un archivo de Excel para pasar la entrada de algunos campos de datos. Pero cuando ejecuto el programa, algunos valores de celda vuelven como nulos, algunos como en blanco. Físicamente cuando abro el archivo de Excel no hay ningún valor disponible en la celda.

¿Cómo puedo identificar manualmente una celda de Excel nula o en blanco?

Para algunos escenarios necesito pasar los valores en blanco a los campos. Si la celda es nula, no puedo pasar los valores a los campos.

Guíame para llegar.

Código:

public static void readAllData() throws IOException{

    Object result = null;

    String sheetName = "Testsheet";

    String filePathxlsx = "C:/Users/MSTEMP/Documents/Files/Testxssf.xlsx";

    try

    {

     FileInputStream in = new FileInputStream(filePathxlsx);

     File file = new File(filePathxlsx);



    if(file.isFile() && file.exists()){

        XSSFWorkbook xworkbook = new XSSFWorkbook(in);
        XSSFSheet xsheet=xworkbook.getSheet(sheetName);
        int totalRows = xsheet.getLastRowNum();

        for(int row =1; row<totalRows;row++){
            xrow=xsheet.getRow(row);
            int totalCells=xrow.getLastCellNum();

            for(int cell =0; cell<totalCells;cell++){
                if(xrow != null)
                {
                    xcell= xrow.getCell(cell);

                    if(xcell!=null)
                    {
                        switch (xcell.getCellType()) {

                            case Cell.CELL_TYPE_NUMERIC:// numeric value in excel
                                if(DateUtil.isCellDateFormatted(xcell)){

                                    Date myDate = xcell.getDateCellValue();
                                    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy", Locale.US);
                                    result = formatter.format(myDate);
                                    //System.out.println("Today : " + result);  
                                }
                                else{
                                    result = new BigDecimal(xcell.getNumericCellValue()).toPlainString();
                                }
                                break;

                            case Cell.CELL_TYPE_STRING: // string value in excel
                                result = xcell.getStringCellValue();
                                break;

                            case Cell.CELL_TYPE_BOOLEAN: // boolean value in excel
                                result = xcell.getBooleanCellValue();
                                break;

                            case Cell.CELL_TYPE_BLANK: // blank value in excel
                                result = xcell.getStringCellValue();
                                break;

                            case Cell.CELL_TYPE_ERROR: // Error value in excel
                                result = xcell.getErrorCellValue()+"";
                                break;
                            }
                        }
                        else
                        {
                            System.out.println("Cell is empty");
                        }
                    System.out.println("Value "+result);
                }
                else
                {
                    System.out.println("Row is empty");
                }
            }    
        }
    }
    inputStream.close();
}
catch (Exception ex){
    ex.printStackTrace();
}

}

Respuestas a la pregunta(1)

Su respuesta a la pregunta