Questions tagged [apache-commons-lang]

The standard Java libraries fail to provide enough methods for manipulation of its core classes. Apache Commons Lang provides these extra methods.

Apache Commons Lang provides a host of helper utilities for the java.lang API, notably string manipulation methods, basic numerical methods, object reflection, concurrency, creation and serialization and System properties. Additionally it contains basic enhancements to java.util.Date and a series of utilities dedicated to help with building methods, such as hashCode(), toString() and equals().

Note that Lang 3.0 (and subsequent versions) use a different package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version.

Official Website: http://commons.apache.org/lang/

Useful Links:

Related Tags:

80 questions
1
vote
3 answers

Hashcode & equals implementation

I'm writing some code to demonstrate equals and hashcode, for my implementation I used User example : public class User { private String name; private String pass; //... @Override public boolean equals(Object obj) { if…
PacDroid
  • 541
  • 1
  • 7
  • 22
1
vote
1 answer

StringUtils.replaceEach that returns StringBuilder or StringBuffer?

Is there a version of Apache's StringUtils.replaceEach() that returns a StringBuilder or StringBuffer instead of String? I'd like to avoid copying code. If not, is there another library?
1
vote
1 answer

EqualsBuilder using as comparator for attributes

If you know EqualsBuilder from apache commons lang you know that you can use it for implementing equals methods with reflection. It seems to work well but since I am using third party software I need to change its behavior. I need a generic…
1
vote
1 answer

About Apache Commons EqualsBuilder and HashCodeBuilder and null values

The classes EqualsBuilder and HashCodeBuilder from the Apache Commons Lang library can be used for object comparison purposes. E.g., one can test equality between two Person objects like follows: Person p1 =...; Person p2 =...; boolean equals = new…
mat_boy
  • 12,998
  • 22
  • 72
  • 116
1
vote
2 answers

Grabbing a non-english character in jexcelapi

I have an excel sheet with some non-english characters in it and when I try to grab the contents via sheet.getColumn(column)[row].getContents() It returns the string with the replacement character \uFFFD instead of the non-english character which…
buddyp450
  • 528
  • 2
  • 10
  • 27
1
vote
3 answers

NoClassDefFoundError when project imported to Eclipse?

I am working on an app which uses Commonslang.jar libraries. I was trying to setup it on a new system with newly installed Eclipse.The project is not showing any error But when I run the project it force closes with NoClassDefFoundError at each…
Navdroid
  • 4,453
  • 7
  • 29
  • 47
0
votes
1 answer

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) { for (Diff diff :…
Peter Penzov
  • 1,126
  • 134
  • 430
  • 808
0
votes
1 answer

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 DefaultDeserializer?; nested exception is…
0
votes
1 answer

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(valuesMap); String resolvedString = sub.replace(templateString); But there is no…
0
votes
1 answer

How do I set the format of toString methods with ToStringBuilder in commons-lang?

how do I configure the setting of the format for toString
flybywire
  • 261,858
  • 191
  • 397
  • 503
0
votes
1 answer

Escape XML using stringutils commons.lang version3 apply on writer

In the older version of "org.apache.commons.lang"(2.6) StringEscapeUtils, there is a method to escapexml by passing an instance of "java.io.Writer" as one of the parameter. eg: escapeXml(Writer writer, String str) But, in newer version 3…
0
votes
1 answer

Mule - Updating third party library in runtime

I'm using Mule Server 3.8 EE which brings commons-lang 2.4 with it. A third-party library in my project needs commons-lang 2.6, because it uses a method that was introduced in this version. So when I just start my application, I get a…
Erik P
  • 353
  • 3
  • 15
0
votes
2 answers

Using Apache SystemUtils Java

I am trying to use the Apache Java library SystemUtils to determine the operating system being used. Here is a link: https://commons.apache.org/proper/commons-lang/download_lang.cgi I am using netbeans to create my application. I can not figure out…
RailsSon
  • 19,897
  • 31
  • 82
  • 105
0
votes
0 answers

JavaFX Null Pointer Exception When Populating ListView From A Website

I am trying to dynamically populate a ListView with strings gathered from a website that are within certain tags. The following code uses Apache Commons lang and Apache Commons IO to firstly go to the website and then use a for loop to put the text…
0
votes
1 answer

GAE throws AccessControlException by TimedSemaphore

I'm using Google App Engine (Java) and my war has to use TimedSemaphore to control resources within specific time period but GAE throws well-known exceptions due to accessed to disallowed API as follows. java.security.AccessControlException: access…
pot8os
  • 11
  • 4