Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
d3e36a23
Commit
d3e36a23
authored
Sep 26, 2017
by
Matija Obreza
Browse files
Return "" for empty html
parent
265b194d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/service/impl/JsoupHtmlConverter.java
View file @
d3e36a23
...
...
@@ -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
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment