83 questions
5
votes
1
answer
2k
views
commons-text 1.11.0 with commons-lang3 3.13.0 still gives error java.lang.NoSuchMethodError
When I use commons-text 1.11.0 with the upgraded commons-lang3 3.14.0,
java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.text.StringEscapeUtils
When I use commons-text 1....
0
votes
1
answer
178
views
Issue with ImmutablePair after upgrading Apache Commons Lang3 version
I am facing an issue with my code since upgrading the lang3 version from 2.12.0 to 2.12.13
ImmutablePair(it, action).apply { className.invoke(this) }
It was working fine before but after the update, ...
0
votes
1
answer
136
views
Unable to unesape consecutive escape char in org.apache.commons.lang3.StringEscapeUtils.unescapeXml()
Unable to unescape consecutive escape char like <errors>.
Below is the sample code:
String error = "&lt;errors&gt;";
String out = org.apache.commons....
0
votes
1
answer
257
views
hive-exec gets into conflict with commons-lang3 in CDH 6.3.2 when generating a CSV file via Java Spark 2.4
I have been stumbling with java.io.InvalidClassException: org.apache.commons.lang3.time.FastDateParser lately, trying to solve it with no avail.
My current workspace consists of Talend Studio 7.3.1 ...
1
vote
1
answer
4k
views
Java apache commons lang3 update to 3.12.0 not found in IntelliJ Maven Project
This is my first time using Maven and I want to make the Apache commons lang3 a dependency.
When I added it to the pom.xml file, originally as version 3.1, Intellij comes up with the message:
I ...
0
votes
0
answers
415
views
A required class was missing while executing net.masterthought:maven-cucumber-reporting:5.7.0:generate: org/apache/commons/lang3/ArrayUtils
Jenkins mvn --version:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: /appl/xxx/maven/apache-maven-3.3.9
Java version: 1.8.0_51, vendor: Oracle ...
3
votes
1
answer
1k
views
Why is Java's System.getSystemProperty("os.name") wrong? [duplicate]
I've upgraded my PC from Windows 10 to Windows 11 and when I run the following Java code with Java 17, it still returns Windows 10:
System.getSystemProperty("os.name")
Why is the OS version ...
-1
votes
1
answer
167
views
Java parallel Stream slower than serial when mocking data using RandomStringUtils
I have a database record of around 1000000 paragraphs with around ~500 characters each. By reading all the records, I need to get the list of alphabet ordered by most to least used.
I mock the ...
0
votes
1
answer
705
views
Migrate apache commons lang3 from 3.8.1 to 3.12.0 throws error incompatible types: Object cannot be converted to Diff<?>
I have this Java method which is used to compare data:
org.apache.commons.lang3.builder.Diff;
public void addChangedPositions(DiffrentResult diffrentResult , List<UpdatedPositionsData> ...
-3
votes
4
answers
1k
views
incompatible types: Object cannot be converted to Diff<?>
I have this Java method which his used to compare data:
org.apache.commons.lang3.builder.Diff;
public void addChangedPositions(DiffrentResult diffrentResult , List<UpdatedPositionsData> ...
1
vote
1
answer
1k
views
apache commons: FailableFunction and Function inside same FailableStream
Is there any way to use both FailableFunction and Function lambdas into a single .map chaining stream?
Function<String, Organization> hook = (id) -> this.organizationRepository.findById(id)....
0
votes
1
answer
545
views
How can I use TypeUtils.parameterize to represent nested generic type like Result<List<R>>
I'm using org.apache.commons.lang3.reflect.TypeUtils and jackson library to handle object deserialization。
One layer nested generic type can be handled well with the following code.
final ...
6
votes
1
answer
13k
views
Apache Commons lang: What's difference between SerializationUtils.clone() and BeanUtils.cloneBean(), when to use which
While writing tests I came across a requirement to clone an object. found 2 Utill classes by apache-commons then I tried to find which one should I use,
I've tried to find the diff by reading out both ...
2
votes
1
answer
961
views
Jupyter Notebook with Almond Scala Kernel Runs into Error
Is there a way to identify which library version should I be using for a specific scala version? For example., I want to use commons-lang3 library but whatever version I choose I run into an error.
I'...
0
votes
1
answer
588
views
Camunda Upgrade - org.apache.commons.lang error
nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for ...
0
votes
1
answer
1k
views
Maven Nexus can't find a dependency
I have Nexus OSS 3.29 installed on the local network and I am able to start and browse http://somehost:8081/. I uploaded commons-lang-3.1.jar to maven-releases and I can see it there. I have a Maven ...
0
votes
2
answers
882
views
the best way to clone hybris beans?
I needed to clone the hybris bean "ProductData", and I couldn't find something OOTB from Hybris that helps with this.
And since hybris beans don't implement Cloneable and don't have ...
1
vote
0
answers
4k
views
adding Apache Commons Lang3 to my Spring Boot project
I am doing a Spring Boot exercise from Baeldung.com. The project has a test class that uses the method randomAlphabetic, which I have traced back to RandomStringUtils, which in turn belongs to Lang3 ...
0
votes
1
answer
797
views
How to solve NoClassDefFoundError: Apache Commons Lang Android
I'm receiving this exception when I try to use DateUtils.addMinutes():
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.example.apprainha, PID: 7742
java.lang.RuntimeException: An ...
0
votes
0
answers
102
views
Why is comparision method violating general contract?
I can't understand why it's happening on a compareTo method using CompareToBuilder from Apache Commons Lang 3 and how may I solve it?
The class is as follow:
import lombok.Data;
import lombok....
0
votes
1
answer
1k
views
How to use Apache Commons Lang code without an IDE? (org.apache.commons.lang3)
I am using Amazon Coretto, a JDK, to write and run Java code. I am trying to use a class from Apache Commons Lang with simple import statements like:
import org.apache.commons.lang3.*
However, ...
0
votes
1
answer
2k
views
if an attribute is not present in map, How to replace the values in template string using strsubsitutor as null or empty string
I have a string
String templateString = "The ${animal} jumps over the ${target}.";
valuesMap.put("animal", "quick brown fox");
StrSubstitutor sub = new StrSubstitutor(...
0
votes
1
answer
772
views
Mule Anypoint Studio groovy.lang.MissingPropertyException: No such property: StringEscapeUtils for class
This is for Mule 4, on 4.3 EE Runtime
Updated
POM File holds standard dependency, and thanks to Aled's answer also included it as a shared library:
<build>
<plugins>
<plugin&...
13
votes
2
answers
6k
views
What is the point of Apache Lang3 StopWatch.split()?
I am currently evaluating implementations between Apache StopWatch and Guava's Stopwatch and the split functionality in the former intrigued me, but I am struggling to understand what exactly it does, ...
-1
votes
1
answer
582
views
Why Commons Lang Pair implements Map Entry?
I think I once knew, but I might have ever since forgottoen, or maybe never knew. Do you know why?
http://commons.apache.org/proper/commons-lang/javadocs/api-3.10/org/apache/commons/lang3/tuple/Pair....
0
votes
2
answers
307
views
Apache Commons HashCodeBuilder: null vs zero for Numeric types
Recently I have encountered the following hashcode "equality" scenario in a Java codebase using Apache Commons Lang 3, and was surprised that I could not find much information on how to handle what ...
0
votes
0
answers
376
views
Exception in thread "Thread-1" NoClassDefFoundError with jar file when compiled with javac -cp "commons-lang3-3.10.jar"
I'm receiving an error while trying to run a multi-command window server application. I'm compiling both the Client and Server with the -cp "commons-lang3-3.10.jar" file, but I continue to run into ...
1
vote
0
answers
260
views
apache lang3:3.9 RandomStringUtils strange behaviour with regex
I got strange behaviour from apache.commons.lang3:3.9 (but everything is ok in 3.5).
I use RandomStringUtils.random to generate string with length 350. And it matches regex (that has 300 limit).
I ...
1
vote
2
answers
3k
views
Apache lang3 works but Apache lang does not. Why?
I have implemented the spring boot project with starter parent pom version 2.0.3.
When I try to use
import org.apache.commons.lang.StringUtils
it throws error
import cannot be resolved.
Even ...
1
vote
2
answers
2k
views
How to check whether given string converted to long is EpochMills or not?
Hi Is there any way to check whether the given string is epoch millis or not
The below code from java.time package converts to EpochMillis.
I am looking for isEpochMillis to return a boolean ...
5
votes
1
answer
2k
views
Apache Commons Lang: Can the "incompatibilities" between 'lang' and 'lang3' cause different runtime results?
My code uses Apache Commons Lang v.2 (commons-lang). If I update my code to use v.3 (commons-lang3) instead, should I worry that my code might start to behave differently (of course except differences ...
0
votes
1
answer
1k
views
java.lang.ClassNotFoundException when use Apache Commons Lang3 SerializationUtils.deserialize
I use Apache Commons Lang3's SerializationUtils in the code.
SerializationUtils.serialize()
to store a customized class as files into disk and
SerializationUtils.deserialize(byte[])
to restore ...
0
votes
0
answers
498
views
Java: Inheritence of static methods on example commons-lang3 `StringUtils`
I want to build upon org.apache.commons.lang3.StringUtils and add a certain method specific for a problem of mine. So I try to inherit from the commons class and write
package org.test.project;
...
2
votes
0
answers
504
views
StringEscapeUtils.escapeHtml/escapeHtml4 inconsistent between commons-lang and commons-lang3
unit test shows StringEscapeUtils.escapeHtml/escapeHtml4 don't produce same results.
trying to upgrade commons-lang(2.6) to commons-lang3(3.9) and found parity-mismatch in escapeHtml/escapeHtml4 ...
2
votes
1
answer
3k
views
Difference between splitByWholeSeparator, splitPreserveAllTokens, and splitByWholeSeparatorPreserveAllTokens
In the org.apache.commons.lang3.StringUtils class, what is the difference between splitByWholeSeparator(String, String), splitPreserveAllTokens(String, String) and ...
0
votes
0
answers
103
views
ToString method print String Objcet like Char array
I'm trying to log in to soap request, if my input is just a String object, ReflectionToStringBuilder build a log with my object splitted char by char. The strange thing is that if I have a String ...
2
votes
1
answer
2k
views
What is the difference between Apache Common's StrBuilder and Java's StringBuilder?
How is StrBuilder from Apache Commons different from Java's StringBuilder?
In Apache Commons I see StrBuilder is deprecated.
import org.apache.commons.lang3.text.StrBuilder;
StrBuilder sb = new ...
0
votes
1
answer
1k
views
commons-lang3 invalid versions in cloudera 6.1 with spark 2.4
We installed cloudera 6.1 and running with spark 2.4
We use oozie to run our spark applications.
We have a code that writes and reads using data frames (we read json from spark streaming and writing ...
4
votes
1
answer
12k
views
Intellij cannot resolve symbol 'lang3' apache
I would like to use StringUtils and have downloaded the "apache commons jar" zip file, copied the unzipped jar file into a lib folder in my intellij project, and added it to Libraries and to the ...
3
votes
0
answers
3k
views
Fatal Exception: java.lang.NoSuchMethodError for org.apache.commons.lang3.tuple.Pair
I need to compare two custom objects which are complex. Instead of overriding the equals method I used the apache.commons.lang3 method EqualsBuilder.reflectionEquals(obj1, obj2).
It works all fine ...
0
votes
1
answer
4k
views
NoSuchMethodError exception in production
I am getting the following exception in production ( Tomcat server ) but not when i run unit tests.
java.lang.NoSuchMethodError: org.apache.commons.lang3.StringUtils.isAllBlank([Ljava/lang/...
1
vote
2
answers
2k
views
Output all of the values for variables in an object using reflection
I would like to output all of the values for variables in an object.
Currently I am using ReflectionToStringBuilder but the problem is that it includes the [,] characters when outputting collections....
0
votes
1
answer
1k
views
How to make ConstructorUtils.invokeConstructor work even when all value is stored in string?
How to make ConstructorUtils.invokeConstructor work even
when a value is stored in a string?
here is the code:
public static void main(String[] args) {
try {
String type = "java....
0
votes
3
answers
1k
views
can use ObjectUtils.identityToString() for checking the Object null
Please find my below code that am checking for null using ternary operator before am setting the value to my bean class attributes.
doc.setCatalog_description(sourceAsMap != null && ...
4
votes
1
answer
2k
views
Check if a Java version is greater than a certain iteration in Java?
I wish to check if a user's Java version is at least 1.8.0_171. I mean that specific iteration or higher, meaning 1.8.0_151, for instance, would not work.
I planned to originally use org.apache....
-2
votes
4
answers
2k
views
what is the difference between equals() and equalsIgnoreCase() in StringUtils of commons-lang3-3.6.jar?
when i use this two methods, i want to know the difference,and how did equalsIgnoreCase() ignore the case of two String. But i even do not find the difference of the source code,only the order of code ...
1
vote
1
answer
2k
views
NoSuchMethodError: No virtual method decrementAndGet
On some devices my app crashes with
Exception java.lang.NoSuchMethodError: No virtual method decrementAndGet()I in class Lorg/apache/commons/lang3/mutable/MutableInt; or its super classes (...
20
votes
2
answers
8k
views
How to use apache commons BooleanUtils.and method?
Apache commons-lang has two overloaded BooleanUtils.and methods.
public static boolean and(final boolean... array) {
public static Boolean and(final Boolean... array) {
When calling BooleanUtils....
6
votes
1
answer
4k
views
How can I throw an exception for an illegal reflective access warning?
How can I throw an exception for an illegal reflective access warning? For example, consider the following code:
import org.apache.commons.lang3.builder.*;
class Test {
public static void main(...
-1
votes
1
answer
655
views
Why does ToStringBuilder work inconsistently?
In the following code, why do the two lines containing System.out.println(person); yield different outputs? The second line indirectly calls the method Job.toString yielding the string "Manager", but ...