Skip to content

Commit

Permalink
Fix NPE on Optional.orElseThrow in reading Placeholders in ExcelGener…
Browse files Browse the repository at this point in the history
…ator
  • Loading branch information
alexpartsch committed Jan 24, 2022
1 parent aabc11b commit 5382a90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group 'com.docutools'
version = '1.3.1'
version = '1.3.2'

sourceCompatibility = 17
targetCompatibility = 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.docutools.jocument.PlaceholderResolver;
import com.docutools.jocument.PlaceholderType;
import com.docutools.jocument.impl.ParsingUtils;
import com.docutools.jocument.impl.ScalarPlaceholderData;
import com.docutools.jocument.impl.excel.interfaces.ExcelWriter;
import com.docutools.jocument.impl.excel.util.ExcelUtils;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -73,7 +74,8 @@ private void generate() {
if (ExcelUtils.isSimpleCell(cell)) {
excelWriter.addCell(cell);
} else {
var newCellText = resolver.resolve(ExcelUtils.getPlaceholder(cell)).orElseThrow();
var newCellText = resolver.resolve(ExcelUtils.getPlaceholder(cell))
.orElse(new ScalarPlaceholderData("-"));
excelWriter.addCell(cell, newCellText.toString());
}
}
Expand Down

0 comments on commit 5382a90

Please sign in to comment.