Skip to content

Commit

Permalink
fix - update check string
Browse files Browse the repository at this point in the history
  • Loading branch information
duyenthaind committed Oct 14, 2024
1 parent e36d4e6 commit 48cff04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Map<Integer, CellMetaData> readMetaData(Sheet sheet) {
Iterator<Cell> iterator = sheet.getRow(0).cellIterator();
while (iterator.hasNext()) {
Cell cell = iterator.next();
String cellName = cell.getStringCellValue();
String cellName = cell.getStringCellValue().trim();
CellMetaData cellMetaData = columnMetaData.get(cellName);
if (cellMetaData != null) {
metadata.put(cell.getColumnIndex(), cellMetaData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.vitadairy.libraries.importexport.service;

import com.vitadairy.libraries.importexport.helper.ILogger;
import com.vitadairy.libraries.importexport.utils.StringUtils;
import org.apache.poi.ss.usermodel.Cell;

import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -32,6 +33,9 @@ public ParseCellDateService(String dateFormat, ILogger logger) {
@Override
public Date parseCellValue(Cell cell) {
String date = cell.getStringCellValue();
if (StringUtils.isEmpty(date)) {
return null;
}
try {
return sdf.parse(date);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ public static String snakeToCamel(String str, boolean firstCharUpperCase) {
String snakeToCamel = snakeToCamel(str);
return snakeToCamel.substring(0, 1).toLowerCase() + snakeToCamel.substring(1);
}

public static boolean isEmpty(String str) {
return str == null || str.isEmpty();
}
}

0 comments on commit 48cff04

Please sign in to comment.