Fix ClassCastException in CLI (Main.java).
This commit is contained in:
@@ -722,9 +722,6 @@ public class Main {
|
|||||||
((ZUGFeRDExporterFromPDFA) ze).ignorePDFAErrors();
|
((ZUGFeRDExporterFromPDFA) ze).ignorePDFAErrors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (FileAttachment attachment : attachments) {
|
|
||||||
((ZUGFeRDExporterFromA3) ze).attachFile(attachment.getFilename(), attachment.getData(), attachment.getMimetype(), attachment.getRelation());
|
|
||||||
}
|
|
||||||
|
|
||||||
ze.load(pdfName);
|
ze.load(pdfName);
|
||||||
ze.setProducer("Mustang-cli")
|
ze.setProducer("Mustang-cli")
|
||||||
@@ -737,6 +734,14 @@ public class Main {
|
|||||||
|
|
||||||
ze.setXML(Files.readAllBytes(Paths.get(xmlName)));
|
ze.setXML(Files.readAllBytes(Paths.get(xmlName)));
|
||||||
|
|
||||||
|
for (FileAttachment attachment : attachments) {
|
||||||
|
if (((ZUGFeRDExporterFromPDFA) ze).getExporter() instanceof ZUGFeRDExporterFromA3 ) {
|
||||||
|
((ZUGFeRDExporterFromA3) ((ZUGFeRDExporterFromPDFA) ze).getExporter()).attachFile(attachment.getFilename(), attachment.getData(), attachment.getMimetype(), attachment.getRelation());
|
||||||
|
} else {
|
||||||
|
System.err.println("IZUGFeRDExporter ze is not of type 'ZUGFeRDExporterFromA3'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ze.export(outName);
|
ze.export(outName);
|
||||||
System.out.println("Written to " + outName);
|
System.out.println("Written to " + outName);
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
protected IZUGFeRDExporter getExporter() {
|
public IZUGFeRDExporter getExporter() {
|
||||||
if (theExporter==null) {
|
if (theExporter==null) {
|
||||||
throw new RuntimeException("In ZUGFeRDExporterFromPDFA, source must always be loaded before other operations are performed.");
|
throw new RuntimeException("In ZUGFeRDExporterFromPDFA, source must always be loaded before other operations are performed.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user