Commit d3e36a23 authored by Matija Obreza's avatar Matija Obreza
Browse files

Return "" for empty html

parent 265b194d
......@@ -16,6 +16,7 @@
package org.genesys2.server.service.impl;
import org.apache.commons.lang.StringUtils;
import org.genesys2.server.service.HtmlConverter;
import org.jsoup.Jsoup;
import org.jsoup.helper.StringUtil;
......@@ -43,6 +44,9 @@ public class JsoupHtmlConverter implements HtmlConverter {
@Override
@Cacheable(value = "htmltotextcache", key = "#html", unless = "#result == null")
public String toText(String html) {
if (StringUtils.isBlank(html)) {
return StringUtils.EMPTY;
}
Document doc = Jsoup.parseBodyFragment(html);
return getPlainText(doc);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment