apache-commons

What is the point of Apache Lang3 StopWatch.split()?

我只是一个虾纸丫 提交于 2021-02-18 22:33:46
问题 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, and what value it has. According to the documentation for StopWatch: https://commons.apache.org/proper/commons-lang/javadocs/api-3.9/org/apache/commons/lang3/time/StopWatch.html split() the watch to get the time whilst the watch continues in the background. unsplit() will remove the effect of

Commons Configuration2 ReloadingFileBasedConfiguration

余生颓废 提交于 2021-02-18 12:34:08
问题 I am trying to implement the Apache Configuration 2 in my codebase import java.io.File; import java.util.concurrent.TimeUnit; import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.commons.configuration2.builder.ConfigurationBuilderEvent; import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder; import org.apache.commons.configuration2.builder.fluent.Parameters; import org.apache.commons.configuration2.convert

FTP timing out on Heroku

爱⌒轻易说出口 提交于 2021-02-11 18:11:23
问题 Using Apache Commons FTPClient in a Scala application works as expected on my local machine, but always times out when running on Heroku. Relevant code: val ftp = new FTPClient ftp.connect(hostname) val success = ftp.login(username, pw) if (success) { ftp.changeWorkingDirectory(path) //a logging statement here WILL print val engine = ftp.initiateListParsing(ftp.printWorkingDirectory) //a logging statement here will NOT print while (engine.hasNext) { val files = engine.getNext(5) //do stuff

FTP timing out on Heroku

≡放荡痞女 提交于 2021-02-11 18:09:30
问题 Using Apache Commons FTPClient in a Scala application works as expected on my local machine, but always times out when running on Heroku. Relevant code: val ftp = new FTPClient ftp.connect(hostname) val success = ftp.login(username, pw) if (success) { ftp.changeWorkingDirectory(path) //a logging statement here WILL print val engine = ftp.initiateListParsing(ftp.printWorkingDirectory) //a logging statement here will NOT print while (engine.hasNext) { val files = engine.getNext(5) //do stuff

Latest dependency versions of various Apache libraries from maven suddenly use a very old version

南楼画角 提交于 2021-02-11 15:23:20
问题 So I've been using various Apache commons libraries for a while and all was fine until suddenly when using the mvn versions:use-latest-versions command or the LATEST version tag uses/places a very old version of various Apache libraries into the <version> tag: <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>20030805.205232</version> <!-- Note: 2003! --> </dependency> If we take a look at the maven repository of commons-net , we can tell that this is

Exclude specific sub-directories using apache commons fileutils

只愿长相守 提交于 2021-02-10 12:42:56
问题 I want to list all the files under current directory but excluding all the files within the subdirectory and it's subdirectories using apache commons lib. For Example : If my current directory is -- A and its subdirectory as B, C ,D B having subdirectory as b1,b2 (b1 has b12 as its subdirectory) and C having c1 , c2... now I want to list all the files in C,c1,c2, D (excluding B , b1 ,b12 , b2 ) Any help will be highly appreciated! 回答1: Use org.apache.commons.io.FileFilter, there's a good

PropertyUtils performance

别来无恙 提交于 2021-02-08 02:35:11
问题 I have a problem where i need to walk through an object graph and pick out a particular property value. My original solution caches a linked list of property names that need to be applied in order to get from point A to point B in the object graph. I then use apache commons PropertyUtils to iterate through the linked list calling getProperty(Object bean, String name) until i have reached point B. My question is around how this will perform compared to perhaps cahing the Method objects for

HTTPS Client with FTP Login Error: javax.net.ssl.SSLException: 502 SSLv23/TLSv1 java

霸气de小男生 提交于 2021-02-07 11:01:49
问题 I am pretty new to Java so the more you explain the more I learn, and less questions I will ask ;) I am trying to program a client to connect to ftp.availity.com but I cannot for the life of me get the client to login. I have tried changing the port numbers (443, 20, etc) but they all do not return a response in the console log and it only returns a timeout error. The only one I can get some action with is port 21. I know this is FTP and I think that may be where there error is coming from

Is GenericObjectPools borrowObject Method thread safe?

我是研究僧i 提交于 2021-01-27 13:55:40
问题 In this question Is GenericObjectPool<T> from commons.apache.org thread safe? It is mentioned that its thread safe . Edited:But im having a situation in my multithreaded application that two threads are getting the same object from the pool at the same time.-This statement was wrong. I moved the borrowObject to synchronize block and it solved my issue. Has anyone faced this issue earlier? Here is my code: public static GenericObjectPool<IDocBuilderPool> documentBuilderPool = new

CSVPrinter datas appears not separated in columns

吃可爱长大的小学妹 提交于 2021-01-07 05:07:33
问题 I'm trying to use this library commons-csv (1.5) for generating the csv file, i've make a simple program for seeing the result : String SAMPLE_CSV_FILE = "./sample.csv"; try ( BufferedWriter writer = Files.newBufferedWriter(Paths.get(SAMPLE_CSV_FILE)); CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.EXCEL .withHeader("ID", "Name", "Designation", "Company")); ) { csvPrinter.printRecord("1", "Name1 ", "CEO", "Google"); csvPrinter.printRecord("2", "Name2", "CEO", "Microsoft");