ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Le Roux (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (OFBIZ-10023) Replace org.apache.commons.lang.StringEscapeUtils.unescapeHtml() method by org.jsoup.parser.Parser.unescapeEntities()
Date Mon, 27 Nov 2017 15:22:00 GMT

     [ https://issues.apache.org/jira/browse/OFBIZ-10023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Jacques Le Roux closed OFBIZ-10023.
    Resolution: Fixed

Fixed in
trunk r1816461  
R16.11 r1816463

> Replace org.apache.commons.lang.StringEscapeUtils.unescapeHtml() method by org.jsoup.parser.Parser.unescapeEntities()
> ---------------------------------------------------------------------------------------------------------------------
>                 Key: OFBIZ-10023
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10023
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>             Fix For: Upcoming Release
> [~mleila] from Nereide crossed an issue using org.apache.commons.lang.StringEscapeUtils.unescapeHtml()
and she wrote a custom method instead. While reviewing her code I spotted jsoup possible use
reading https://stackoverflow.com/questions/599634/convert-html-character-back-to-text-using-java-standard-library
and I asked her if she could try jsoup rather. She told me that she was inspired by https://stackoverflow.com/questions/994331/java-how-to-unescape-html-character-entities-in-java
and confirmed it was OK after using jsoup and replaced her custom method by a call to org.jsoup.parser.Parser.unescapeEntities().
> So I put my grain of salt in stackoverflow and decided to replace org.apache.commons.lang.StringEscapeUtils.unescapeHtml()
method by org.jsoup.parser.Parser.unescapeEntities() in OFBiz.
> After reading  https://jsoup.org/apidocs/org/jsoup/parser/Parser.html#unescapeEntities-java.lang.String-boolean-
and https://www.programcreek.com/java-api-examples/index.php?source_dir=CN1ML-NetbeansModule-master/CN1MLParser/jsoup/src/main/java/org/jsoup/parser/Parser.java#unescapeEntities-String-string-boolean-inAttribute
I decided to use the strict  mode in all cases in OFBiz because we may cross cases like mentionned
at top of WidgetWorker.buildHyperlinkUrl() or labels like (there few other cases)
> {code}
>     <property key="ScrumTab">
>         <value xml:lang="en">&#160;&#160;&#160;&#160;&#160;</value>
>     </property>
> {code}
> BTW I really wonder about this one. I guess using & nbsp; did not work so & #160;
was used. I did not check it was the best way to do what it's used for...

This message was sent by Atlassian JIRA

View raw message