From 2e77e538c1561d8859acee499948b1a17a87365f Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Mon, 13 May 2019 08:39:35 +0200 Subject: Refactor + Fix: Replace MessageFormat.format with String.format - Reason: Using MessageFormat.format and String.format via static imports (meaning: code only contains `format()`) is confusing. - Format String Fix: Switch from argument position (`{0}`) to argument type specifies (`%s`). --- src/main/java/at/gv/egiz/moazs/App2MzsService.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsService.java b/src/main/java/at/gv/egiz/moazs/App2MzsService.java index be4bc9e..29b75ef 100644 --- a/src/main/java/at/gv/egiz/moazs/App2MzsService.java +++ b/src/main/java/at/gv/egiz/moazs/App2MzsService.java @@ -18,7 +18,7 @@ import java.util.concurrent.TimeoutException; import static at.gv.egiz.moazs.MoaZSException.moaZSException; import static at.gv.zustellung.msg.xsd.DeliveryAnswerType.deliveryAnswerTypeBuilder; import static at.gv.zustellung.msg.xsd.DeliveryRequestStatusType.deliveryRequestStatusTypeBuilder; -import static java.text.MessageFormat.format; +import static java.lang.String.format; import static java.util.concurrent.CompletableFuture.supplyAsync; @Service @@ -63,8 +63,7 @@ public class App2MzsService implements App2MzsPortType { return generatePartialSuccessResponse(appDeliveryID); } catch (Exception e ) { - logger.error("Could not deliver request.", e); - var message = format("An error occurred while processing DeliveryRequest with AppDeliveryID={0}. ", appDeliveryID); + var message = format("An error occurred while processing DeliveryRequest with AppDeliveryID=%s. ", appDeliveryID); throw new MoaZSException(message, e); } @@ -80,7 +79,7 @@ public class App2MzsService implements App2MzsPortType { pipeline.processRequest(appDeliveryID); return repository.getDeliveryRequestStatus(appDeliveryID) - .orElseThrow(() -> moaZSException("Could not get a response for AppDeliveryID={0}", appDeliveryID)); + .orElseThrow(() -> moaZSException("Could not get a response for AppDeliveryID=%s", appDeliveryID)); } -- cgit v1.2.3