From 6a9c857e08b8bbb0181cb48f8e1db3eda675ba6f Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Wed, 3 Jul 2019 10:54:12 +0200 Subject: Minor Fix: Performance of Trace Logging Improved ...by checking if log level is active before converting byte[] SOAPMessages into Strings. --- .../moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java b/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java index 4ebd2d0..ac3acc6 100644 --- a/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java +++ b/src/main/java/at/gv/egiz/moazs/msg/StoreSOAPBodyBinaryInRepositoryInterceptor.java @@ -42,15 +42,20 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt try { byte[] content = messageUtils.copyContent(message); - log.trace("Interceptor received this SOAP message: {}. ", new String(content, StandardCharsets.UTF_8)); + if(log.isTraceEnabled()) { + log.trace("Interceptor received this SOAP message: {}. ", new String(content, StandardCharsets.UTF_8)); + } if(content.length > 0) { Element document = soapUtils.toDOM(content); byte[] status = soapUtils.unwrapSoapEnvelope(document); String appDeliveryID = soapUtils.getAppDeliveryIDFrom(document); repository.addSignedDeliveryRequestStatus(status, appDeliveryID); - log.trace("DeliveryRequestStatus with AppDeliveryID={} unwrapped and stored: {}. ", - appDeliveryID, new String(status, StandardCharsets.UTF_8)); + + if(log.isTraceEnabled()) { + log.trace("DeliveryRequestStatus with AppDeliveryID={} unwrapped and stored: {}. ", + appDeliveryID, new String(status, StandardCharsets.UTF_8)); + } } } catch (ParserConfigurationException | SAXException | IOException | NullPointerException e) { throw moaZSException("Could not extract signed data from message.", e); -- cgit v1.2.3