Procházet zdrojové kódy

1.增加为空判断。

zhengqiang před 5 roky
rodič
revize
7d5970aa8f

+ 14 - 13
picc-common/src/main/java/com/jpsoft/picc/modules/common/utils/POIUtils.java

@@ -402,21 +402,22 @@ public class POIUtils {
         while(srcRowIndex<= rowNum){
             Row dataRow1 = srcSheet.getRow(srcRowIndex);
 
-            Cell cell = dataRow1.getCell(validateColIndex);
-
-            if (cell!=null && StringUtils.isNotEmpty(cell.getStringCellValue())){
-                Row dataRow2 = destSheet.createRow(destRowIndex);
-
-                for (int i=0;i<dataRow1.getLastCellNum();i++){
-                    if (dataRow1.getCell(i)!=null) {
-                        dataRow2.createCell(i).setCellValue((String)getCellValue(0,srcRowIndex,i));
-                    }
-                    else{
-                        break;
+            if(dataRow1!=null) {
+                Cell cell = dataRow1.getCell(validateColIndex);
+
+                if (cell != null && StringUtils.isNotEmpty(cell.getStringCellValue())) {
+                    Row dataRow2 = destSheet.createRow(destRowIndex);
+
+                    for (int i = 0; i < dataRow1.getLastCellNum(); i++) {
+                        if (dataRow1.getCell(i) != null) {
+                            dataRow2.createCell(i).setCellValue((String) getCellValue(0, srcRowIndex, i));
+                        } else {
+                            break;
+                        }
                     }
-                }
 
-                destRowIndex++;
+                    destRowIndex++;
+                }
             }
 
             srcRowIndex++;