Fix PMD errors

This commit is contained in:
Thierry Göckel 2020-08-10 13:48:23 +02:00
parent 00c96c6f57
commit d97a7b629a
2 changed files with 12 additions and 16 deletions

View File

@ -38,7 +38,6 @@ public class SectionsBuilderService {
current.setPage(page.getPageNumber());
if (prev != null && current.getClassification().startsWith("H ") || !document.isHeadlines()) {
Paragraph chunkBlock = buildTextBlock(chunkWords, lastHeadline, previousTable);
chunkBlock.setHeadline(lastHeadline);
lastHeadline = current.getText();
@ -85,11 +84,10 @@ public class SectionsBuilderService {
table.setHeadline("Table in: " + lastHeadline);
}
// Distribute header information for subsequent tables
if (previousTable != null && hasInvalidHeaderInformation(table) && hasValidHeaderInformation(previousTable)) {
if ((previousTable.isVerticalHeader() && previousTable.getRowCount() == table.getRowCount()) || previousTable
.getColCount() == table.getColCount()) {
table.setHeaders(previousTable.getHeaders());
}
if (previousTable != null && hasInvalidHeaderInformation(table) && hasValidHeaderInformation(previousTable) &&
(previousTable.isVerticalHeader() && previousTable.getRowCount() == table.getRowCount() ||
previousTable.getColCount() == table.getColCount())) {
table.setHeaders(previousTable.getHeaders());
}
if (textBlock != null && !alreadyAdded) {

View File

@ -82,11 +82,10 @@ public class Table extends AbstractTextContainer {
boolean allBold = true;
List<Cell> rowCells = rows.get(0);
for (Cell cell : rowCells) {
if (CollectionUtils.isNotEmpty(cell.getTextBlocks())) {
if (!cell.getTextBlocks().get(0).getMostPopularWordStyle().equals("bold")) {
allBold = false;
break;
}
if (CollectionUtils.isNotEmpty(cell.getTextBlocks()) &&
!cell.getTextBlocks().get(0).getMostPopularWordStyle().equals("bold")) {
allBold = false;
break;
}
}
if (!allBold) {
@ -94,11 +93,10 @@ public class Table extends AbstractTextContainer {
List<Cell> firstColCells = new ArrayList<>();
for (List<Cell> row : rows) {
Cell firstInRow = row.get(0);
if (CollectionUtils.isNotEmpty(firstInRow.getTextBlocks())) {
if (!firstInRow.getTextBlocks().get(0).getMostPopularWordStyle().equals("bold")) {
allBold = false;
break;
}
if (CollectionUtils.isNotEmpty(firstInRow.getTextBlocks()) &&
!firstInRow.getTextBlocks().get(0).getMostPopularWordStyle().equals("bold")) {
allBold = false;
break;
}
firstColCells.add(firstInRow);
}