From cd339e91d8e8d86a8811caed629d2cc475795703 Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Tue, 23 Jul 2024 14:53:18 +0200 Subject: [PATCH] fix: log input HTML before PDF convert --- .../extension/pdf/exporter/converter/PdfConverter.java | 6 +++--- .../weasyprint/service/WeasyPrintServiceConnector.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/sbb/polarion/extension/pdf/exporter/converter/PdfConverter.java b/src/main/java/ch/sbb/polarion/extension/pdf/exporter/converter/PdfConverter.java index c355261..f0d97f2 100644 --- a/src/main/java/ch/sbb/polarion/extension/pdf/exporter/converter/PdfConverter.java +++ b/src/main/java/ch/sbb/polarion/extension/pdf/exporter/converter/PdfConverter.java @@ -100,15 +100,15 @@ public byte[] convertToPdf(@NotNull ExportParams exportParams, @Nullable ExportM htmlContent = htmlProcessor.internalizeLinks(htmlContent); generationLog.log("Html is ready, starting pdf generation"); + if (PdfExporterExtensionConfiguration.getInstance().isDebug()) { + new HtmlLogger().log(documentData.getDocumentContent(), htmlContent, generationLog.getLog()); + } byte[] bytes = generatePdf(documentData, exportParams, metaInfoCallback, htmlContent, generationLog); if (exportParams.getInternalContent() == null) { //do not log time for internal parts processing String finalMessage = "PDF document '" + documentData.getDocumentTitle() + "' has been generated within " + (System.currentTimeMillis() - startTime) + " milliseconds"; logger.info(finalMessage); generationLog.log(finalMessage); - if (PdfExporterExtensionConfiguration.getInstance().isDebug()) { - new HtmlLogger().log(documentData.getDocumentContent(), htmlContent, generationLog.getLog()); - } } return bytes; } diff --git a/src/main/java/ch/sbb/polarion/extension/pdf/exporter/weasyprint/service/WeasyPrintServiceConnector.java b/src/main/java/ch/sbb/polarion/extension/pdf/exporter/weasyprint/service/WeasyPrintServiceConnector.java index a78fc32..e2fe253 100644 --- a/src/main/java/ch/sbb/polarion/extension/pdf/exporter/weasyprint/service/WeasyPrintServiceConnector.java +++ b/src/main/java/ch/sbb/polarion/extension/pdf/exporter/weasyprint/service/WeasyPrintServiceConnector.java @@ -51,7 +51,7 @@ public byte[] convertToPdf(String htmlPage, WeasyPrintOptions weasyPrintOptions) throw new IllegalStateException("Could not read response stream", e); } } else { - throw new IllegalStateException("Could not get proper response from WeasyPrint Service"); + throw new IllegalStateException("Could not get proper response from WeasyPrint Service. Status: " + response.getStatus()); } } } finally {