Questions tagged [apache-commons]

The Apache Commons project provides reusable, open source Java software components. Consider using a component specific tag (such as apache-commons-lang) rather than this general tag.

The Apache Commons is a project of the Apache Software Foundation and includes many components previously found in the retired Apache Jakarta Project. Apache Commons projects are gathered into three groups:

  • Apache Commons Proper is the group of Apache Commons components that are actively being supported by the Apache Commons community.

  • Apache Commons Sandbox is the group of proposed Apache Commons components that are in the process of building a community of users and developers. The sandbox serves the purpose of vetting proposed components for inclusion into Apache Commons. Once the whole Apache Commons community feels a sandbox component has gained a large enough following, the sandbox component can graduate to Apache Commons Proper

  • Apache Commons Dormant is a group of Apache Commons Components that are no longer in active development. There is little community support for these components and most likely will not be released.

For more information, visit the Apache Commons website to learn about the individual components as well as learn how to contribute.

1814 questions
66
votes
4 answers

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…
gene b.
  • 10,512
  • 21
  • 115
  • 227
64
votes
10 answers

Joining a List in Java with commas and "and"

Given a list List l = new ArrayList(); l.add("one"); l.add("two"); l.add("three"); I have a method String join(List messages) { if (messages.isEmpty()) return ""; if (messages.size() == 1) return…
slipset
  • 2,960
  • 2
  • 21
  • 17
57
votes
5 answers

No header mapping was specified, the record values can't be accessed by name (Apache Commons CSV)

I got this error message happening when I'm trying to read a csv: Exception in thread "main" java.lang.IllegalStateException: No header mapping was specified, the record values can't be accessed by name at…
Creature
  • 994
  • 1
  • 12
  • 27
53
votes
7 answers

Java - Append quotes to strings in an array and join strings in an array

I would like to append double quotes to strings in an array and then later join them as a single string (retaining the quotes). Is there any String library which does this? I have tried Apache commons StringUtils.join and the Joiner class in Google…
Anand
  • 1,791
  • 5
  • 23
  • 41
45
votes
5 answers

SpringBoot: Large Streaming File Upload Using Apache Commons FileUpload

Am trying to upload a large file using the 'streaming' Apache Commons File Upload API. The reason I am using the Apache Commons File Uploader and not the default Spring Multipart uploader is that it fails when we upload very large file sizes (~2GB).…
balajeerc
  • 3,998
  • 7
  • 35
  • 51
42
votes
5 answers

Apache Commons CLI - option type and default value

How can I give a CLI Option a type - such as int or Integer? (Later, how can I get the parsed value with a single function call?) How can I give a CLI Option a default value? Such that CommandLine.getOptionValue() or the function call mentioned…
aib
  • 45,516
  • 10
  • 73
  • 79
41
votes
6 answers

Copy specific fields by using BeanUtils.copyProperties?

springframework.beans.BeanUtils is very useful to copy objects, and I use the "ignoreProperties" option frequently. However, sometimes I want to copy only specific objects (basically, the opposite of "ignore Properties"). Does anyone know how can I…
zono
  • 8,366
  • 21
  • 75
  • 113
41
votes
4 answers

Apache Commons Net FTPClient and listFiles()

Can anyone explain me what's wrong with the following code? I tried different hosts, FTPClientConfigs, it's properly accessible via firefox/filezilla... The problem is I always get empty filelist without any exceptions (files.length == 0). I use…
Vladimir Mihailenco
  • 3,382
  • 2
  • 24
  • 38
41
votes
4 answers

Is it safe to use Apache commons-io IOUtils.closeQuietly?

Is this code BufferedWriter bw = new BufferedWriter(new FileWriter("test.txt")); try { bw.write("test"); } finally { IOUtils.closeQuietly(bw); } safe or not? As far as I understand when we close a BufferedWriter it…
Evgeniy Dorofeev
  • 133,369
  • 30
  • 199
  • 275
40
votes
4 answers

Apache Commons CLI : Getting list of values for an option

For a CLI, I have a requirement to pass in an array of ints as input for a particular option. Example - The below command would take in an array of customerIds and perform some operations. myCommand -c 123 124 125 I have implemented the CLI using…
Gautham Reddy
  • 411
  • 1
  • 4
  • 6
38
votes
4 answers

DefaultParser in Apache Commons CLI

I wanted to try out the Apache Commons CLI, and figured a good place to start would be the 'usage' section on its web page. http://commons.apache.org/proper/commons-cli/usage.html Now, the example suggest to create a DefaultParser, however the…
benroth
  • 2,468
  • 3
  • 24
  • 25
37
votes
2 answers

what the relationship between commons-httpclient and httpclient, both from apache

Any relationship or difference between those two libraries.
user496949
  • 83,087
  • 147
  • 309
  • 426
37
votes
5 answers

Invalid char between encapsulated token and delimiter in Apache Commons CSV library

I am getting the following error while parsing the CSV file using the Apache Commons CSV library. Exception in thread "main" java.io.IOException: (line 2) invalid char between encapsulated token and delimiter at…
Santhosh Sridhar
  • 641
  • 1
  • 6
  • 12
37
votes
1 answer

Apache Commons Lang 2 vs 3

In my application I'm using apache commons Lang v.3. A requried library give my a java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils Is there a build translation between commmon.lang to commons.lang3 or I have to add both lang…
Tobia
  • 9,165
  • 28
  • 114
  • 219
35
votes
6 answers

NoClassDefFoundError: org/apache/commons/lang3/StringUtils

I'm trying to run the sample project with this library and I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils at…
Rachita Nanda
  • 4,509
  • 9
  • 42
  • 66