The row in the POI import data table is obviously not empty, but the value obtained by the background is null?

when using POI to import data, it is found that sometimes, or some excel files, the import process will report a null pointer, and later found that the corresponding row of cells are caused by null. The
code is as follows: `public Map < String,Object > readExcel (MultipartFile file) {

    
    Workbook workBook = null;
    InputStream is = file.getInputStream();
    try {
        if(file.getOriginalFilename().endsWith("xls")){
            workBook =new  HSSFWorkbook(is);
        }else if(file.getOriginalFilename().endsWith("xlsx")){
            workBook =new  XSSFWorkBook(is);
            
        }
        
        Sheet sheet1 = workBook.getSheetAt(0);
        /**
         * for
         * excel
         */
        
        Cell cell = sheet1.getRow(2).getCell(0);
        //...
    } catch (Exception e) {
    }
    
}`


Jun.30,2021

where is the null pointer reported? If it is a value, you can try String value = sheet.getCell (colIndex, rowIndex). GetContents () to take the value, the empty take out in excel is the empty string "".

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c6dd-4089d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c6dd-4089d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?