From eea2ace0cc8e8a4b2f342fa0ef3254555e3ac138 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Thu, 31 Jan 2013 10:26:20 +0100 Subject: [PATCH] jira-integration: Fix bug if comment length is lower than max length If the comment length is lower than the max length of the DescriptionField, then it's not needed to truncate it. FEA: ItEr77S16JiraAndTimConnectorContributionIntegration --- .../org/libreplan/importers/JiraTimesheetSynchronizer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java b/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java index 15c617dac..2a56a7635 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/JiraTimesheetSynchronizer.java @@ -245,7 +245,11 @@ public class JiraTimesheetSynchronizer implements IJiraTimesheetSynchronizer { private void updateOrCreateDescriptionValuesAndAddToWorkReportLine(WorkReportLine workReportLine, String comment) { DescriptionField descriptionField = workReportType.getLineFields().iterator().next(); - comment = comment.substring(0, descriptionField.getLength() - 1); + + Integer maxLenght = descriptionField.getLength(); + if (comment.length() > maxLenght) { + comment = comment.substring(0, maxLenght - 1); + } Set descriptionValues = workReportLine .getDescriptionValues();