Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why was org.apache.common.lang3 StringEscapeUtils deprecated?

I couldn't find any explanation why StringEscapeUtils was deprecated from Apache Lang3 v3.7.

https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringEscapeUtils.html

What are we supposed to use now for HTML escaping/unescaping

like image 427
gene b. Avatar asked Dec 14 '17 15:12

gene b.


People also ask

Is lang3 deprecated?

@user3871754 No, it is deprecated in the org. apache. commons. lang3 as it was adopted here in org.

What is Apache Commons lang3?

Description. org.apache.commons.lang3. Provides highly reusable static utility methods, chiefly concerned with adding value to the java. lang classes.

What is the use of StringEscapeUtils?

Method SummaryReturns a String value for a CSV column enclosed in double quotes, if required. Escapes the characters in a String using EcmaScript String rules. Escapes the characters in a String using HTML entities. Escapes the characters in a String using HTML entities.


2 Answers

The class was moved from package

org.apache.commons.lang3

to

org.apache.commons.text

You can replace the deprecated library easily:

In your build.gradle:

implementation 'org.apache.commons:commons-text:1.9' 

And in your class using StringEscapeUtils make sure you import the correct class:

import org.apache.commons.text.StringEscapeUtils; 

1.9 is currently the newest version (last checked February 24th 2021) but you can check the versions at maven: https://mvnrepository.com/artifact/org.apache.commons/commons-text

like image 123
Björn Kechel Avatar answered Sep 20 '22 15:09

Björn Kechel


Per the deprecation listing, it was moved to a new project -- commons-text

like image 26
Jamie Bisotti Avatar answered Sep 22 '22 15:09

Jamie Bisotti