From 5650f6ab78d83cd32ca5aee8d1bbcd0deaf4b7e1 Mon Sep 17 00:00:00 2001 From: arjan Date: Thu, 28 Nov 2024 13:45:21 +0100 Subject: [PATCH] Debug statements toegevoegd. --- .../java/nl/imvertor/OfficeCompiler/OfficeCompiler.java | 2 ++ src/main/java/nl/imvertor/common/file/WordFile.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/nl/imvertor/OfficeCompiler/OfficeCompiler.java b/src/main/java/nl/imvertor/OfficeCompiler/OfficeCompiler.java index ecc2ec28..8f71de08 100644 --- a/src/main/java/nl/imvertor/OfficeCompiler/OfficeCompiler.java +++ b/src/main/java/nl/imvertor/OfficeCompiler/OfficeCompiler.java @@ -362,6 +362,8 @@ private boolean transformDocx(AnyFile mswordFile) throws Exception { succeeds = succeeds? infile.toXhtmlFile(outfile) : false; + configurator.getRunner().debug(logger,"DOCUMENTOR","File prepared okay? " + succeeds); + if (succeeds) { // transformeer die XHTML naar iets bruikbaars, extraheer ook meteen respec properties transformer.setXslParm("msword-file-path", outfile.getCanonicalPath()); diff --git a/src/main/java/nl/imvertor/common/file/WordFile.java b/src/main/java/nl/imvertor/common/file/WordFile.java index 33469b9d..9889b1ad 100644 --- a/src/main/java/nl/imvertor/common/file/WordFile.java +++ b/src/main/java/nl/imvertor/common/file/WordFile.java @@ -29,7 +29,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpHeaders; import org.apache.log4j.Logger; -import org.json.JSONObject; import nl.imvertor.common.Configurator; import nl.imvertor.common.Runner; @@ -96,10 +95,14 @@ public boolean toXhtmlFile(XmlFile outFile) throws Exception { + "\"text\": \"" + payloadBase64 + "\"" + "}"; try { + configurator.getRunner().debug(logger,"DOCUMENTOR","Posting payload, base64 size " + payloadBase64.length()); String result = localFile.post(HttpFile.METHOD_POST_CONTENT, URI.create(pandocServerUrl), headerMap, null, new String[] {payload}); if (StringUtils.startsWith(result,"<")) { outFile.setContent(result); return true; + } else if (result.equals("")) { + runner.error(logger, "Documentor processing error: empty result"); + return false; } else { runner.error(logger, "Documentor processing error: \"" + result + "\""); return false; @@ -152,6 +155,7 @@ public boolean toXhtmlFile(XmlFile outFile) throws Exception { */ public boolean correctCodeSpaces() throws Exception{ Configurator configurator = Configurator.getInstance(); + configurator.getRunner().debug(logger,"DOCUMENTOR","Correcting code spaces"); try { ZipFile thisFile = new ZipFile(this); AnyFolder tempFolder = configurator.getWorkFolder("documentor/msword");