From 65163646205b6e05139485fe957bceabe531f447 Mon Sep 17 00:00:00 2001 From: Christof Rabensteiner Date: Tue, 9 Jul 2019 12:56:54 +0200 Subject: Minor Fixes And Refactoring - Fix typo in SafeResponseToFileSink. - MoaZSException: Simplify constructor by replacing lots of arguments with the builder instance. - Fix minor codesmells (unused imports, superfluous braces). --- src/main/java/at/gv/egiz/moazs/MoaZSException.java | 25 ++++++++-------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/main/java/at/gv/egiz/moazs/MoaZSException.java') diff --git a/src/main/java/at/gv/egiz/moazs/MoaZSException.java b/src/main/java/at/gv/egiz/moazs/MoaZSException.java index 1e86c22..dbb2894 100644 --- a/src/main/java/at/gv/egiz/moazs/MoaZSException.java +++ b/src/main/java/at/gv/egiz/moazs/MoaZSException.java @@ -5,9 +5,6 @@ import at.gv.zustellung.msg.xsd.PreAdviceNoteSentType; import at.gv.zustellung.tnvz.xsd.PersonResultType; import org.springframework.lang.Nullable; -import java.util.concurrent.ExecutorService; - - public class MoaZSException extends RuntimeException { public static final String ERROR_MZS_MIMETYPE_MISSMATCH = "8001"; @@ -27,19 +24,16 @@ public class MoaZSException extends RuntimeException { @Nullable private final String appDeliveryID; - private MoaZSException(String message, @Nullable Throwable cause, @Nullable String errorCode, @Nullable PreAdviceNoteSentType preAdviceNoteSent, - @Nullable String deliverySystem, @Nullable String gz, @Nullable String zsDeliveryID, - @Nullable String appDeliveryID) { - super(message, cause); - this.errorCode = errorCode; - this.preAdviceNoteSent = preAdviceNoteSent; - this.deliverySystem = deliverySystem; - this.gz = gz; - this.zsDeliveryID = zsDeliveryID; - this.appDeliveryID = appDeliveryID; + private MoaZSException(Builder builder) { + super(builder.message, builder.cause); + this.errorCode = builder.errorCode; + this.preAdviceNoteSent = builder.preAdviceNoteSent; + this.deliverySystem = builder.deliverySystem; + this.gz = builder.gz; + this.zsDeliveryID = builder.zsDeliveryID; + this.appDeliveryID = builder.appDeliveryID; } - public static MoaZSException moaZSException(String message, Throwable cause) { return moaZSExceptionBuilder(message).withCause(cause).build(); } @@ -166,8 +160,7 @@ public class MoaZSException extends RuntimeException { } public MoaZSException build() { - return new MoaZSException(message, cause, errorCode, preAdviceNoteSent, deliverySystem, gz, - zsDeliveryID, appDeliveryID); + return new MoaZSException(this); } } -- cgit v1.2.3