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

View File

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