Skip to content

Commit

Permalink
fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
vananiev committed May 3, 2023
1 parent b6f8059 commit c403b6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,24 @@ public int getLastRowNum() {
@Override
public int findEmptyRow(int startRow) {
int lastRowNum = startRow;
LAST_ROW:
for (int n = getLastRowNum(); lastRowNum <= n; lastRowNum++) {
Row row = sheet.getRow(lastRowNum);
if (row == null || row.getLastCellNum() == -1) {
return lastRowNum; // all row cells blank
return lastRowNum; // all row cells blank
}
boolean isEmptyRow = true;
for (@Nullable Cell cell : row) {
@Nullable Object value;
if (!(cell == null
|| ((value = ExcelCellDataAccessObject.INSTANCE.getValue(cell)) == null)
|| (value instanceof String) && (value.toString().isEmpty()))) {
// not empty
continue LAST_ROW;
isEmptyRow = false;
break;
}
}
return lastRowNum; // all row cells blank
if (isEmptyRow) {
return lastRowNum; // all row cells blank
}
}
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ private static boolean equals(Cell cell, CellType cellType, @Nullable Object exp
return Objects.equals(expected, cell.getBooleanCellValue());
case FORMULA:
return equals(cell, cell.getCachedFormulaResultType(), expected);
default:
return false;
}
} catch (Exception ignore) {
return false;
}
return false;
}
}

0 comments on commit c403b6c

Please sign in to comment.