From e2ff39e10f0341392af3accab202c666a83d04c7 Mon Sep 17 00:00:00 2001 From: Mathis Mensing Date: Wed, 31 Jul 2024 15:35:11 +0200 Subject: [PATCH] refactor(ZUGFeRDVisualizer): improve PDF visualization performance --- .../org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java index 7d417820..7b79711b 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java @@ -226,13 +226,6 @@ public class ZUGFeRDVisualizer { } FileInputStream fis = new FileInputStream(xmlFilename); - try { - // TODO why are we reading the whole file here and discarding the content? - new String(Files.readAllBytes(Paths.get(xmlFilename)), StandardCharsets.UTF_8); - } catch (IOException e2) { - LOGGER.error("Failed to read file", e2); - } - ByteArrayOutputStream iaos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -276,12 +269,11 @@ public class ZUGFeRDVisualizer { String result = null; - ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); /* remove file endings so that tests can also pass after checking out from git with arbitrary options (which may include CSRF changes) */ try { - result = zvi.toFOP(CIIinputFile.getAbsolutePath()); + result = this.toFOP(CIIinputFile.getAbsolutePath()); } catch (FileNotFoundException | TransformerException e) { LOGGER.error("Failed to apply FOP", e); }