Skip to content
Advertisement

Tag: apache-commons

Apache Telnet Client does not recevie non-ASCII characters

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 non-ASCII characters. My code looks something like this (simplified a bit for readability): I

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 package. Latest version for commons-fileupload – https://search.maven.org/classic/#search%7Cga%7C1%7Ca%3A%22commons-fileupload%22%20AND%20g%3A%22commons-fileupload%22 Do we have any way to overcome

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 well: Result: Maven:

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/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

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 visible to the MethodUtils as it won’t see the modified Method reference: will still

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 from BaseClassLoader Struts 2 framework demo http://apache-commons.680414.n4.nabble.com/lang-java-lang-NoClassDefFoundError-org-apache-commons-lang-StringUtils-Exception-td3735881.html Answer I have added commons-lang-2.6.jar & commons-lang3-3.1-sources.jar… Here’s your problem: commons-lang-2.6.jar doesn’t contain the org.apache.commons.lang3 package, since

Advertisement