Browse code

BM-15425 Fix: do not print 'null' in event description when no resource template

Vincent Vignaud authored on 27/11/2019 10:55:40
Showing 1 changed files
... ...
@@ -24,6 +24,8 @@ import java.util.regex.Pattern;
24 24
 
25 25
 import org.apache.commons.lang.StringEscapeUtils;
26 26
 
27
+import com.google.common.base.Strings;
28
+
27 29
 import net.bluemind.core.api.fault.ErrorCode;
28 30
 import net.bluemind.core.api.fault.ServerFault;
29 31
 import net.bluemind.core.context.SecurityContext;
... ...
@@ -203,9 +205,12 @@ public class ResourceTemplateHelper implements IResourceTemplateHelper {
203 205
 	}
204 206
 
205 207
 	@Override
206
-	public String addTemplate(final String text, final String processedTemplate) {
207
-		final String sanitizedText = sanitizeText(text);
208
-		final String separator = sanitizedText.isEmpty() ? "" : TEMPLATE_SEPARATOR;
208
+	public String addTemplate(String text, String processedTemplate) {
209
+		String sanitizedText = sanitizeText(text);
210
+		if (Strings.isNullOrEmpty(processedTemplate)) {
211
+			return sanitizedText;
212
+		}
213
+		String separator = sanitizedText.isEmpty() ? "" : TEMPLATE_SEPARATOR;
209 214
 		return String.format("%s%s%s%s", sanitizedText, separator, processedTemplate, TEMPLATE_SUFFIX);
210 215
 	}
211 216