diff --git a/pom.xml b/pom.xml index 4e35b89..3eb1c50 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 de.tum.in.www1 bamboo-server - 1.1.4 + 1.1.5 LS1 TUM http://www1.in.tum.de/ diff --git a/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java b/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java index 1737120..256574a 100644 --- a/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java +++ b/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java @@ -65,6 +65,9 @@ public class ServerNotificationTransport implements NotificationTransport private VariableDefinitionManager variableDefinitionManager = (VariableDefinitionManager) ContainerManager.getComponent("variableDefinitionManager"); // Will be injected by Bamboo + // Maximum length for the feedback text. The feedback will be truncated afterwards + private static int FEEDBACK_DETAIL_TEXT_MAX_CHARACTERS = 5000; + public ServerNotificationTransport(String webhookUrl, @Nullable ImmutablePlan plan, @Nullable ResultsSummary resultsSummary, @@ -288,9 +291,11 @@ private JSONObject createTestsResultsJSONObject(TestResults testResults, boolean if (addErrors) { JSONArray testCaseErrorDetails = new JSONArray(); for(TestCaseResultError testCaseResultError : testResults.getErrors()) { - String content = testCaseResultError.getContent(); - content = content.substring(0, Math.min(content.length(), 5000)); - testCaseErrorDetails.put(content); + String errorMessageString = testCaseResultError.getContent(); + if(errorMessageString != null && errorMessageString.length() > FEEDBACK_DETAIL_TEXT_MAX_CHARACTERS) { + errorMessageString = errorMessageString.substring(0, FEEDBACK_DETAIL_TEXT_MAX_CHARACTERS); + } + testCaseErrorDetails.put(errorMessageString); } testResultsJSON.put("errors", testCaseErrorDetails); }