I’ve been trying to useorg.apache.commons.net.telnet.TelnetClient and I am having trouble to receive non-ASCII characters (in my case polish chars like ą,ę,ć,ź and few others). The problem is not on server side – when I use default Ubuntu telnet implementation or Putty I have no problem receiving …
Tag: apache-commons
Jetty 11 and commons-fileupload
I am updating Jetty9 to Jetty11. I updated my package from javax.servlet to jakarta.servlet because servlet 5.0 is the prerequisite for Jetty11. but the problem is when I am using commons-fileupload`-1.4.jar as it is still using java.servlet package. The above method is expecting argument from java.servlet pa…
How to avoid backslash before comma in CSVFormat
I am creating a CSV file using CSVFormat in java, the problem i am facing in both header and values is whenever the string is long and there is a comma the api is inserting a before the comma always. As a result the header is not forming correctly and the values in the csv file is taking next
How to unescape HTML 5 entities in Java (')
The answers to this question mostly suggest to use apache-common-text StringEscapeUtils. But this (latest version of commons-text is 1.9) only supports HTML 4, and Mastodon appears to use HTML 5 which includes '. How can I decode HTML 5 entities, including '? Answer unbescape does the job we…
POIXMLException when updating excel file with apache-poi
When I try overwrite existing excel file, I get this error message: By the way, there is no problem if I try write a new excel file.So Its working correctly but I can’t update existing file. What am I doing wrong? There is my code: Answer Multiple issues in your code. If you are creating an OPCPackage o…
Apache Commons: UnsupportedZipFeatureException (LZMA)
I want to unzip .zip files (with .jpg files inside) that were created using Windows 10’s zipping feature. First I tested it with Java 8’s native util.zip.ZipEntry but kept getting an invalid CEN header (bad compression method) error, which seems to be caused by an incompatibility with Win10’…
What is the point of Apache Lang3 StopWatch.split()?
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/…
Invoke private static method with MethodUtils from Apache commons-lang3
Is it possible to invoke a private static method with MethodUtils? This code throws the exception: If I change method’s access modifier to public it works. Answer No, because MethodUtils.invokeStaticMethod() calls Class.getMethod() under the hood. Even if you try to hack the modifier it won’t be v…
NoClassDefFoundError: org/apache/commons/lang3/StringUtils
I’m trying to run the sample project with this library and I get the following error: I’ve added commons-lang-2.6.jar & commons-lang3-3.1-sources.jar in libs and classpath Main class: I have referred to the following links: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils …
Apache Commons Text StringEscapeUtils vs JSoup for XSS prevention?
I want to clean user input for help preventing XSS attacks and we don’t necessarily care to have a HTML whitelist, as our users shouldn’t need to post any HTML / CSS. Eyeing the alternatives out there, which would be better? [Apache Commons Text’s StringEscapeUtils] [1] or [JSoup Cleaner][2]…