diff options
author | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-05-13 08:39:35 +0200 |
---|---|---|
committer | Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at> | 2019-05-13 08:39:35 +0200 |
commit | 2e77e538c1561d8859acee499948b1a17a87365f (patch) | |
tree | 65ecd07d288415ef9253820d4ec5d34946924126 | |
parent | 8b0ec5cd17ff3c399f47a04de50dcca03ae74731 (diff) | |
download | moa-zs-2e77e538c1561d8859acee499948b1a17a87365f.tar.gz moa-zs-2e77e538c1561d8859acee499948b1a17a87365f.tar.bz2 moa-zs-2e77e538c1561d8859acee499948b1a17a87365f.zip |
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`).
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/App2MzsService.java | 7 |
1 files 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)); } |