added some catch clauses to ensure the batch is processed :-)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
||||
<artifactId>toecount</artifactId>
|
||||
<version>0.0.6-SNAPSHOT</version>
|
||||
<version>0.0.7-SNAPSHOT</version>
|
||||
<name>ZUGFeRD PDF checker</name>
|
||||
<description>Shows statistics on how many PDFs in a directory are ZUGFeRD-Compliant</description>
|
||||
<repositories>
|
||||
|
||||
@@ -30,11 +30,34 @@ public class FileChecker {
|
||||
return false;
|
||||
}
|
||||
ZUGFeRDImporter zi=new ZUGFeRDImporter();
|
||||
zi.extract(filename);
|
||||
if (zi.canParse()) {
|
||||
thisRun.incZUGFeRDCount();
|
||||
return true;
|
||||
} else {
|
||||
try {
|
||||
zi.extract(filename);
|
||||
if (zi.canParse()) {
|
||||
thisRun.incZUGFeRDCount();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
// something really rare happened -- corrupted ZF?
|
||||
/***
|
||||
* e.g. Exception in thread "main" java.lang.NullPointerException
|
||||
at org.mustangproject.ZUGFeRD.ZUGFeRDImporter.extractLowLevel(ZUGFeRDImporter.java:90)
|
||||
at org.mustangproject.ZUGFeRD.ZUGFeRDImporter.extract(ZUGFeRDImporter.java:64)
|
||||
at toecount.FileChecker.checkForZUGFeRD(FileChecker.java:33)
|
||||
at toecount.Toecount.main(Toecount.java:111)
|
||||
*
|
||||
*/
|
||||
// Ignore nevertheless, most likely we're batch processing
|
||||
return false;
|
||||
} catch (Exception e2) {
|
||||
/**
|
||||
* probably thrown up from
|
||||
AM org.apache.pdfbox.pdfparser.PDFParser parse, most likely
|
||||
INFORMATION: Document is encrypted
|
||||
but also other internal PDF errors possible like
|
||||
..Okt 23, 2015 11:17:53 AM org.apache.pdfbox.pdfparser.XrefTrailerResolver setStartxref
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Toecount {
|
||||
}
|
||||
private static void printHelp() {
|
||||
System.out
|
||||
.println("Mustangproject.org's Toecount 0.0.6 \r\n"
|
||||
.println("Mustangproject.org's Toecount 0.0.7 \r\n"
|
||||
+ "A Apache Public License command line tool for statistics on PDF invoices with\r\n"
|
||||
+ "ZUGFeRD Metadata (http://www.zugferd.de)\r\n"
|
||||
+ "\r\n"
|
||||
|
||||
Reference in New Issue
Block a user