Tag Archives: java

The Curse of Convenience Methods

In the old days, many Java APIs were fairly low level and pretty generic. You often had to explicitly select a concrete implementation, provide lots of parameters, and generally needed to know how things worked. This has changed in recent years – modern … Continue reading

Posted in best practices, java | Tagged , , | Leave a comment

Empty InputStream with Spring MVC

The other day, I was trying to build a simple batch upload interface for a Java web application running Spring Boot with Spring MVC on Apache Tomcat. But when I tried reading the InputStream in my controller, it was always empty. … Continue reading

Posted in java | Tagged , , | Leave a comment

Normalizing Text in Java

Once in a while I see misguided attempts at normalizing text to make it suitable for use in URLs, file names, or other situations where a plain ASCII representation is desired. This can be tricky but with Java’s excellent Unicode … Continue reading

Posted in java | Tagged , | Leave a comment

Preventing Cascading Failure

With the advent of reactive programming and frameworks like Netflix’ Hystrix, classic stability patterns like Nygard’s Circuit Breaker Pattern have entered mainstream software development. The circuit breaker is used inside your clients to cut the connection to a collaborating system … Continue reading

Posted in best practices | Tagged , , , | Leave a comment

Installing Oracle’s JDK on Debian/Ubuntu

Due to licensing issues, Linux distributions don’t ship Oracle Java packages anymore. In many cases, that doesn’t matter since you can just use OpenJDK. But if you do need Oracle’s JDK, Debian packages are a bit more convenient than handling … Continue reading

Posted in java | Tagged , , | 1 Comment

Maven: Discovering Dependency Conflicts

Among other things, Maven’s dependency plugin displays the result of Maven’s dependency resolution mechanism. The output of the dependency:tree goal makes it easy to see where transitive dependencies come from. This week I discovered that recent versions of the plugin … Continue reading

Posted in java | Tagged , , | 2 Comments

Testing equals() with Guava

I’ve long held the opinion that Guava belongs on every Java classpath because its design and the quality of its implementation surpass other comparable utility libraries (and sometimes even the JDK). Guava’s testlib is pretty cool, too, even though it’s … Continue reading

Posted in java | Tagged , , , | Leave a comment