From 9381c22e42b72baf9e0b0f7a7dbb24b58318e717 Mon Sep 17 00:00:00 2001
From: Luc Everse <luc@wukl.net>
Date: Tue, 30 Aug 2022 11:06:43 +0200
Subject: [PATCH] Do not send (practically) empty reports
---
.../ewi/auta/core/controller/SubmitAppController.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/core/src/main/java/nl/tudelft/ewi/auta/core/controller/SubmitAppController.java b/core/src/main/java/nl/tudelft/ewi/auta/core/controller/SubmitAppController.java
index 1679f1280..c68325a9d 100644
--- a/core/src/main/java/nl/tudelft/ewi/auta/core/controller/SubmitAppController.java
+++ b/core/src/main/java/nl/tudelft/ewi/auta/core/controller/SubmitAppController.java
@@ -275,7 +275,7 @@ public class SubmitAppController extends ControllerBase
try {
final var report = this.reportGenerator.generateReport(
entityContainer, Set.of(e.getKey())
- );
+ ).trim();
this.sendFeedback(url, report, e.getValue(), submitMetadata, null, true);
} catch (final IOException | TemplateException ex) {
@@ -316,6 +316,8 @@ public class SubmitAppController extends ControllerBase
/**
* Sends a report to Submit.
*
+ * If the report is empty, this does nothing.
+ *
* @param url the URL to send the feedback to
* @param report the report to send
* @param visibleFor for whom the report should be visible
@@ -332,6 +334,10 @@ public class SubmitAppController extends ControllerBase
final @Nullable Integer score,
final boolean success
) {
+ if (report != null && report.isEmpty()) {
+ return;
+ }
+
try {
final var conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
--
GitLab