commons

Simple way to repeat a String in java

I'm looking for a simple commons method or operator that allows me to repeat some String n times. I know I could write this using a for loop, but I wish to avoid for loops whenever necessary and a simple direct method should exist somewhere. String str = "abc"; String repeated = str.repeat(3); repeated.equals("abcabcabc"); Related to...

Commons Digester add Singleton Object

Hi I Have a XML and I am using commons-digester1.8 to create a object of my bean. My bean contains a reference to another Bean which is singleton. Is there any way I can create/get the reference of singleton object and get my bean populated. My xml contains <>/language tag and for this tag bean has Language.class reference. Language.cl...

Apache Commons Configuration trigger event on property file change

Hi, I'm using Apache Commons Configuration library to store my app properties. I can monitor changes of property file using FileChangedReloadingStrategy and it works perfectly. What I would like to do is to trigger configurationChanged event of ConfigurationListener when property file is changed. This case works if I will try to get...

Commons VFS and IBM MVS System

Hello All, I'm using Apache Commons VFS / SFTP, we are trying to download files from the IBM MVS system. The download part is all good, however, we can not open up the zipped files after downloading. Seems like the zip file was compressed using a different algorithm or something Anyone has any pointers? *Note, the same function wo...

File Upload in GXT discriminates against certain file types

We are using GXT (EXT + GWT) and Apache commons file upload servlet utility. We have file uploads working but certain types are not uploaded, e.g., text files. Even if the text files have their extension changed they are still not uploaded. In the FileUploadBase.parseRequest method this is the code that seems to be found to skip the...

Java apache commons telnetclient

Hey guys, I'm trying to use the telnetclient class in apache.commons.net and have run into a bit of a problem. TelnetClient telnet = new TelnetClient(); terminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler("VT100", false, false, true, false); EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true, false); Suppre...

Logging in DBCP

I'm using Apache Commons DBCP. There is a task to track the inner behavior of the DBCP - number of active and idle connections. I found out that DBCP lacks any such logging at all. Yes, tt is possible to write the code that outputs the status of the BasicDataSource when connection is borrowed from the pool. However there is no way to t...

How do I do this using guava?

Is there a way of achieving the below using Guava? //anything better than using Files.append() in a loop? org.apache.commons.io.FileUtils.writeLines(File file, Collection lines, String lineEnding); //gives a byte[] that is fed to Files.write(byte[] from, File to) org.apache.commons.lang.SerializationUtils.serialize(Serializable obj) ...

How to test file transfer restarting code [setRestartOffset(offset) in Commons NET API]?

Hi, I wrote small FTP Client Applet which uploads files to FTP Server using Commons Net API. In my code I handled 'CopyStreamException' and trying to restart the same file transfer by setting the offset using FTPClient.setRestartOffset() method. Is there any proper way to test this part of the code? I tried by disconnecting my interne...