added some catch clauses to ensure the batch is processed :-)
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
||||||
<artifactId>toecount</artifactId>
|
<artifactId>toecount</artifactId>
|
||||||
<version>0.0.6-SNAPSHOT</version>
|
<version>0.0.7-SNAPSHOT</version>
|
||||||
<name>ZUGFeRD PDF checker</name>
|
<name>ZUGFeRD PDF checker</name>
|
||||||
<description>Shows statistics on how many PDFs in a directory are ZUGFeRD-Compliant</description>
|
<description>Shows statistics on how many PDFs in a directory are ZUGFeRD-Compliant</description>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class FileChecker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ZUGFeRDImporter zi=new ZUGFeRDImporter();
|
ZUGFeRDImporter zi=new ZUGFeRDImporter();
|
||||||
|
try {
|
||||||
zi.extract(filename);
|
zi.extract(filename);
|
||||||
if (zi.canParse()) {
|
if (zi.canParse()) {
|
||||||
thisRun.incZUGFeRDCount();
|
thisRun.incZUGFeRDCount();
|
||||||
@@ -37,6 +38,28 @@ public class FileChecker {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPDF() {
|
public boolean isPDF() {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class Toecount {
|
|||||||
}
|
}
|
||||||
private static void printHelp() {
|
private static void printHelp() {
|
||||||
System.out
|
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"
|
+ "A Apache Public License command line tool for statistics on PDF invoices with\r\n"
|
||||||
+ "ZUGFeRD Metadata (http://www.zugferd.de)\r\n"
|
+ "ZUGFeRD Metadata (http://www.zugferd.de)\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user