This commit is contained in:
jstaerk
2024-12-04 14:34:34 +01:00
parent 87caa542dd
commit 6c0fcdf876
3 changed files with 18 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
595
591
577
575
573
601
2.15.1
=======
- #566 Failed to parse PDF - Could not reproduce the invoice

View File

@@ -51,7 +51,9 @@ public class FileChecker {
if ((!isPDF) && (!thisRun.shallIgnoreFileExt())) {
return false;
}
ZUGFeRDImporter zi = new ZUGFeRDImporter(filename);
ZUGFeRDImporter zi = new ZUGFeRDImporter();
zi.doIgnoreCalculationErrors();
zi.setPDFFilename(filename);
try {
if (zi.canParse()) {
thisRun.incZUGFeRDCount(zi.getVersion());

View File

@@ -106,7 +106,14 @@ public class NodeMap {
* @return the text content of the matching node, converted to BigDecimal
*/
public Optional<BigDecimal> getAsBigDecimal(String... localNames) {
return getNode(localNames).map(Node::getTextContent).map(s->new BigDecimal(s.trim()));
return getNode(localNames).map(Node::getTextContent).map(s->{
try {
return new BigDecimal(s.trim());
} catch (NumberFormatException e) {
return null;
}
});
}
/**