Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Apache Commons Lang3 vs Apache Commons Text?

I am wondering what is the difference between Apache Commons Lang3 (org.apache.commons.lang3) vs Apache Commons Text (org.apache.commons.text)?

I saw many similarities between them.
For intance, they both have StringEscapeUtils:

  • org.apache.commons.lang3.StringEscapeUtils, which is Deprecated.
  • org.apache.commons.text.StringEscapeUtils

But I also saw many differences.
So which one should I use, Lang3 or Text?
Or what are the common use cases for each of these two?

like image 985
fluency03 Avatar asked Oct 23 '17 15:10

fluency03


People also ask

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 Apache Commons text?

Apache Commons Text is an open source Java library designed for working with strings. Alvaro Munoz, a researcher at GitHub's Security Lab, discovered in March that the library is affected by an arbitrary code execution vulnerability related to untrusted data processing and variable interpolation.

What is the use of Apache Commons?

The Apache Commons is a project of the Apache Software Foundation, formerly under the Jakarta Project. The purpose of the Commons is to provide reusable, open source Java software. The Commons is composed of three parts: proper, sandbox, and dormant.

What is StringEscapeUtils in Java?

StringEscapeUtils is a utility class which escapes and unescapes String for Java, JavaScript, HTML, XML, and SQL. For example, @Test. public void test_StringEscapeUtils() { assertEquals("\\\\\\n\\t\\r", StringEscapeUtils.escapeJava("\\\n\t\r")); // escapes the Java String.


1 Answers

Well, the text method states

This code has been adapted from Apache Commons Lang 3.5.

Looks like they simply plan on moving the method from one library to the other. You'd have to get the authors of that code to explain why.

However, worth pointing out that lang3 is a compile dependency of text, therefore if you included text, you would have lang3 anyway

https://github.com/apache/commons-text/blob/master/pom.xml#L61-L65

like image 142
OneCricketeer Avatar answered Sep 20 '22 12:09

OneCricketeer