aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/preprocess
diff options
context:
space:
mode:
authorChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-17 13:17:21 +0200
committerChristof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>2019-07-17 13:27:40 +0200
commitf2e1263702901581512131ea587fad7a2ba45baa (patch)
treeb92a38f758fecb039de184963116017921d2e314 /src/main/java/at/gv/egiz/moazs/preprocess
parent896195cc9b287a3f41008cc85997b9c2209120b8 (diff)
downloadmoa-zs-f2e1263702901581512131ea587fad7a2ba45baa.tar.gz
moa-zs-f2e1263702901581512131ea587fad7a2ba45baa.tar.bz2
moa-zs-f2e1263702901581512131ea587fad7a2ba45baa.zip
Put MoaZSException on Diet & Handle Edge Cases
Reason: MoaZSException (and: its builder) were used to collect intermediary results while stepping through the delivery request backend. These results were needed to generate meaningful responses towards the sender application in case of error. However, the builder sprawled over too many interfaces (e.g. DeliveryRequestBackend and TNVZHelper) and it became difficult to understand from where intermediary results originated. Solution: Put MoaZSException on diet: - Remove all DeliveryAnswer fields from MoaZSException and refactor code base to ensure that the removed fields get sourced by other means. - Remove Builder since amount of parameters is manageable. Refactor DeliveryRequestBackend: - Instead of passing down the builder and using MoaZSException as the only source for intermediary results, we collect available results at the outermost stack frame (DeliveryRequestBackend.accept) and only retrieve results via exception if those results appear somewhere down the stack frame (E.g. PredviceNoteSent). We collect available results with the "fallbackAnswerBuilder" and switch to the msg client response, once received. Refactor MsgResponseBackend: - Handle cases (response missing, binary response missing) properly. - Integrate changes from MsgResponse.generateError() Refactor TVNZHelper: - Remove MoaZSExceptionBuilder from all interfaces. Refactor MsgResponse.generateError: - Change interface such that it's more intuitive. - Implement NotificationResponse.generateError. - Implement RequestStatusResponse.generateError. Others: - Replace all invocations against MoaZSException.Builder.
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/preprocess')
-rw-r--r--src/main/java/at/gv/egiz/moazs/preprocess/DeliveryRequestAugmenter.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/preprocess/DeliveryRequestAugmenter.java b/src/main/java/at/gv/egiz/moazs/preprocess/DeliveryRequestAugmenter.java
index eac7ea6..e7ee357 100644
--- a/src/main/java/at/gv/egiz/moazs/preprocess/DeliveryRequestAugmenter.java
+++ b/src/main/java/at/gv/egiz/moazs/preprocess/DeliveryRequestAugmenter.java
@@ -9,6 +9,7 @@ import java.util.Map;
import static at.gv.egiz.moazs.MoaZSException.moaZSException;
import static at.gv.zustellung.app2mzs.xsd.DeliveryRequestType.deliveryRequestTypeBuilder;
+import static java.lang.String.format;
@Component
public class DeliveryRequestAugmenter {
@@ -62,7 +63,8 @@ public class DeliveryRequestAugmenter {
: util.merge(requestConfig, fallbackConfig);
if (!validator.isConfigProfileComplete(mergedConfig)) {
- throw moaZSException(INCOMPLETE_MERGED_CONFIG_ERROR_MESSAGE, fallbackProfileId);
+ var message = format(INCOMPLETE_MERGED_CONFIG_ERROR_MESSAGE, fallbackProfileId);
+ throw moaZSException(message);
}
var mergedRequest = deliveryRequestTypeBuilder(request)