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
23
votes
2 answers

Logging using SL4J, Jakarta Commons logging, log4j for third party libraries and my own code

I have some questions about logging, more specifically about setting it up and making sure it works. The project I'm doing will use Wicket, Spring and Hibernate. I know that Wicket and Hibernate uses Simple Logging Facade for Java (SL4J) and that…
user14070
23
votes
3 answers

Apache CLI: Required options contradicts with help option.

If I have 2 options defined as required such as: public static void main(String [] args){ Options options= new Options(); Option inputFileOp=Option.builder("i").longOpt("input").hasArg().desc("Input…
Mohamed Gad-Elrab
  • 636
  • 1
  • 6
  • 20
23
votes
1 answer

Phonetic search for Indian languages

I want to compare strings phonetically in my android app. But the special case here is, I want to compare Indian language words written in English. For example, I want to check if "Edhu" "Adhu" "Yethu" are phonetically equal, they all mean the same…
55597
  • 2,033
  • 1
  • 21
  • 40
23
votes
3 answers

ConfigurationException in Java?

Decided to use Apache's Common Configuration package to parse an XML File. I decided to do a: XMLConfiguration xmlConfig = new XMLConfiguration(file); To which Eclipse complained that I haven't caught an exception(Unhandled exception type…
Federer
  • 33,677
  • 39
  • 93
  • 121
22
votes
5 answers

Apache's StringUtils.isBlank(str) vs. Guava's Strings.isNullOrEmpty(str): Should you routinely check for whitespace?

Is there any advantage in using StringUtils.isBlank(str) from Apache commons-lang. vs Strings.isNullOrEmpty(String string) from Google Guava? I want to replace hundreds of cases of they following usage in a Java project: if(str == null ||…
Bryce Marden
  • 221
  • 1
  • 2
  • 3
22
votes
2 answers

Apache Commons CLI: replacement for deprecated OptionBuilder?

IntelliJ shows that OptionBuilder is deprecated in this example code from http://commons.apache.org/proper/commons-cli/usage.html. What should I use as the replacement? import org.apache.commons.cli.*; Options options = new…
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
22
votes
2 answers

Cleaner way to check if a string is ISO country of ISO language in Java

Suppose to have a two-characters String, which should represent the ISO 639 country or language name. You know, Locale class has two functions getISOLanguages and getISOCountries that return an array of String with all the ISO languages and ISO…
mat_boy
  • 12,998
  • 22
  • 72
  • 116
21
votes
4 answers

Can Apache Commons CLI options parser ignore unknown command-line options?

I am writing a Java application that takes command line arguments which are processed using Apache Commons CLI with the GnuParser. For reasons that are not interesting to get into, I would like it to silently ignore unknown command line options…
Michael Ridley
  • 10,378
  • 3
  • 22
  • 16
21
votes
2 answers

VerifyError on Tomcat 7 production server probably caused by Apache Commons Logging 1.0.4

I'm developing webapp on Tomcat 7. Everything works fine on my local version of Tomcat, but when I deploy it on production server, it throws this exception. java.lang.VerifyError: (class: org/apache/commons/logging/impl/Log4JLogger, method: fatal…
Přemysl Šťastný
  • 1,676
  • 2
  • 18
  • 39
21
votes
6 answers

Is there a fast concat method for linked list in Java?

How can I concat two linked lists in O(1) with Java via jdk1.6, google or apache commons collection or whatever? E.g. in the jdk there is only the addAll method which is O(n). Another feature I miss is to concat two lists where each of them could…
rocker
  • 283
  • 3
  • 8
21
votes
5 answers

Preventing HttpClient 4 from following redirect

I'm connecting to my AppEngine application using the Apache HttpComponents library. In order to authenticate my users, I need to pass an authentication token along to the application's login address (http://myapp.appspot.com/_ah/login?auth=...) and…
mjumbewu
  • 1,104
  • 5
  • 14
  • 28
20
votes
3 answers

What is the difference between maven dependencies org.apache.commons:commons-io and commons-io:commons-io?

Maven repositories contain these two dependencies: org.apache.commons:commons-io:1.3.2 and commons-io:commons-io:1.3.2. What is the difference and which one I should be using in my pom.xml? In general some of the apache commons packages are located…
Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183
20
votes
7 answers

Apache Commons FTPClient.listFiles

I am using org.apache.commons.net.ftp.FTPClient in one of my applications to work with a FTP server. I am able to connect, login, pwd and cwd. However, when I try to list the files it doesn't return the list of files in that directory, where I know…
Shyam Kumar Sundarakumar
  • 5,649
  • 13
  • 42
  • 69
19
votes
5 answers

apache commons configuration loads property until "," character

I want to load configuration (apache commons configuration) from a properties file. My program is: PropertiesConfiguration pc = new PropertiesConfiguration("my.properties"); System.out.println(pc.getString("myValue")); In my.properties I have …
Tyler
  • 213
  • 1
  • 2
  • 5
19
votes
4 answers

servlet file upload filename encoding

I am using the Apache Commons Fileupload tools for standard file upload. My problem is that I cannot get the proper filename of uploaded files if they contain special characters (á, é, ú, etc.) They all get converted to ?…
jabal
  • 11,987
  • 12
  • 51
  • 99