作者 yuhong0206@sina.cn

读取excel增加

if(row == null)
{
    continue;
}
判断。防止有时候Excel表中有空数据行,导致读取时出现空指针异常。
@@ -229,6 +229,10 @@ public class ExcelUtil<T> @@ -229,6 +229,10 @@ public class ExcelUtil<T>
229 { 229 {
230 // 从第2行开始取数据,默认第一行是表头. 230 // 从第2行开始取数据,默认第一行是表头.
231 Row row = sheet.getRow(i); 231 Row row = sheet.getRow(i);
  232 + if(row == null)
  233 + {
  234 + continue;
  235 + }
232 T entity = null; 236 T entity = null;
233 for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet()) 237 for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet())
234 { 238 {