From 2a765b9c3a0d20bf2794c569f584bde05fb21d16 Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Thu, 13 Jun 2019 10:35:44 +0200 Subject: Refactor: Create and Reuse Info Message Template --- src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java b/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java index c611f9e..84e5299 100644 --- a/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java +++ b/src/main/java/at/gv/egiz/moazs/config/MoaSigConfig.java @@ -22,6 +22,7 @@ public class MoaSigConfig { private static final String MOA_SPSS_CONFIG_FILE_PROPERTY = "moa.spss.server.configuration"; private static final String JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY = "javax.net.ssl.trustStoreType"; private static final String JAVAX_SSL_KEYSTORE_TYPE_PROPERTY = "javax.net.ssl.keyStoreType"; + private static final String SET_PROPERTY_MSG_TEMPLATE = "Set system property '{}' to {}" ; private final String trustStoreType; private final String keyStoreType; @@ -48,7 +49,7 @@ public class MoaSigConfig { var realFile = new File(realPath); if(realFile.exists() && realFile.canRead()) { - log.info("Set system property '{}' to {}", MOA_SPSS_CONFIG_FILE_PROPERTY, realPath); + log.info(SET_PROPERTY_MSG_TEMPLATE, MOA_SPSS_CONFIG_FILE_PROPERTY, realPath); System.getProperties().setProperty(MOA_SPSS_CONFIG_FILE_PROPERTY, realPath); } else { throw new FileNotFoundException("File '" + realPath + "' does not exist or is not readable."); @@ -68,12 +69,12 @@ public class MoaSigConfig { private void fallBackToSpringEnvForJavaxNetSSLStoreTypeProperty() { if (System.getProperty(JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY) == null) { - log.info("Set system property '{}' to {}", JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY, trustStoreType); + log.info(SET_PROPERTY_MSG_TEMPLATE, JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY, trustStoreType); System.getProperties().setProperty(JAVAX_SSL_TRUSTSTORE_TYPE_PROPERTY, trustStoreType); } if (System.getProperty(JAVAX_SSL_KEYSTORE_TYPE_PROPERTY) == null) { - log.info("Set system property '{}' to {}", JAVAX_SSL_KEYSTORE_TYPE_PROPERTY, keyStoreType); + log.info(SET_PROPERTY_MSG_TEMPLATE, JAVAX_SSL_KEYSTORE_TYPE_PROPERTY, keyStoreType); System.getProperties().setProperty(JAVAX_SSL_KEYSTORE_TYPE_PROPERTY, keyStoreType); } } @@ -95,7 +96,7 @@ public class MoaSigConfig { return new MoaSPSSSignatureVerifier(moaSigVerifyService(), defaultTrustProfile); } else { log.warn("Moa SPSS is not active. Signatures in SOAP Messages will not be verified."); - return (signedXMLdocument) -> true; + return signedXMLdocument -> true; } } } -- cgit v1.2.3