From 6967fa2db4c04d8cfc71db4fec98f85a3b6d8dd6 Mon Sep 17 00:00:00 2001 From: Mathis Dirksen-Thedens Date: Tue, 12 Sep 2023 22:45:32 +0200 Subject: [PATCH] fix Hibiscus connection setup and add logging --- .../service/HibiscusImportService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/zephyrsoft/optigemspoonfeeder/service/HibiscusImportService.java b/src/main/java/org/zephyrsoft/optigemspoonfeeder/service/HibiscusImportService.java index 02ee1ad..39ab2a3 100644 --- a/src/main/java/org/zephyrsoft/optigemspoonfeeder/service/HibiscusImportService.java +++ b/src/main/java/org/zephyrsoft/optigemspoonfeeder/service/HibiscusImportService.java @@ -34,6 +34,9 @@ import org.zephyrsoft.optigemspoonfeeder.mt940.Mt940File; import org.zephyrsoft.optigemspoonfeeder.mt940.Mt940Record; +import lombok.extern.slf4j.Slf4j; + +@Slf4j @Service public class HibiscusImportService { @@ -44,22 +47,26 @@ public class HibiscusImportService { public HibiscusImportService(OptigemSpoonfeederProperties properties) { this.properties = properties; - if (isConfiguredAndReachable()) { + if (isConfigured()) { client = createXmlRpcClient(); } } public boolean isConfigured() { - return Objects.nonNull(properties.getHibiscusServerUrl()) + boolean result = Objects.nonNull(properties.getHibiscusServerUrl()) && StringUtils.isNotBlank(properties.getHibiscusServerUsername()) && StringUtils.isNotBlank(properties.getHibiscusServerPassword()); + log.info("Hibiscus is configured: {}", result); + return result; } public boolean isReachable() { try { client.execute("hibiscus.xmlrpc.konto.find", Collections.emptyList()); + log.info("Hibiscus is reachable: true"); return true; } catch (Exception e) { + log.info("Hibiscus is reachable: false ({})", e.getMessage()); return false; } }