From d1afe87095c0d429c4ede43d54d8dcd63bd54c04 Mon Sep 17 00:00:00 2001 From: e550448 Date: Mon, 10 Jun 2024 17:01:38 +0200 Subject: [PATCH] feat: Refactorings Refs: #DEV-11775 --- .../service/WeasyPrintServiceConnector.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 7860829..22a034b 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 @@ -25,7 +25,7 @@ public class WeasyPrintServiceConnector implements WeasyPrintConverter { private static final Logger logger = Logger.getLogger(WeasyPrintServiceConnector.class); private static final String WEASYPRINT_VERSION_HEADER = "Weasyprint-Version"; private static final String PYTHON_VERSION_HEADER = "Python-Version"; - private static final AtomicReference weasyprintVersion = new AtomicReference<>(); + private static final AtomicReference weasyPrintVersion = new AtomicReference<>(); private static final AtomicReference pythonVersion = new AtomicReference<>(); @Override @@ -45,7 +45,7 @@ public byte[] convertToPdf(String htmlPage, WeasyPrintOptions weasyPrintOptions) if (response.getStatus() == Response.Status.OK.getStatusCode()) { InputStream inputStream = response.readEntity(InputStream.class); try { - logWeasyprintVersionFromHeader(response); + logWeasyPrintVersionFromHeader(response); return inputStream.readAllBytes(); } catch (IOException e) { throw new IllegalStateException("Could not read response stream", e); @@ -93,15 +93,15 @@ private String getWeasyPrintServiceBaseUrl() { return PdfExporterExtensionConfiguration.getInstance().getWeasyprintService(); } - private void logWeasyprintVersionFromHeader(Response response) { + private void logWeasyPrintVersionFromHeader(Response response) { String actualWeasyprintVersion = response.getHeaderString(WEASYPRINT_VERSION_HEADER); String actualPythonVersion = response.getHeaderString(PYTHON_VERSION_HEADER); - logWeasyprintVersion(actualWeasyprintVersion, weasyprintVersion, "Weasyprint"); - logWeasyprintVersion(actualPythonVersion, pythonVersion, "Python"); + logWeasyPrintVersion(actualWeasyprintVersion, weasyPrintVersion, "Weasyprint"); + logWeasyPrintVersion(actualPythonVersion, pythonVersion, "Python"); } - private void logWeasyprintVersion(String actualVersion, AtomicReference version, String nameInMessage) { + public void logWeasyPrintVersion(String actualVersion, AtomicReference version, String nameInMessage) { if (!isEmpty(actualVersion) && !actualVersion.equals(version.getAndSet(actualVersion))) { logger.info(String.format("Using Weasyprint Service with %s version: %s", nameInMessage, actualVersion));