Author: Tillmann Seidel

[caption id="" align="alignright" width="240"] Image via CC from Sh4rp_i[/caption] Documents in Apache CouchDB are usually not really deleted but rather marked as such. In use cases with many document insertions and deletions, this considerably affects disc space consumption and performance. This post shows a practical way how to get rid of deleted documents and make your data base fast and efficient again. Deletion is not deletion Usually documents...

Read More

[caption id="" align="alignright" width="320"] Image via CC from Hades2k[/caption] JSON is becoming more and more important as a data exchange format, especially in Ajax web frameworks and RESTful web services. Apache JMeter, which is a very popular tool to perform load tests for web applications, does not come with native support to handle HTTP responses with JSON bodies. This post shows different possibilities how to deal...

Read More

[caption id="" align="alignright" width="320"] Image via CC from Alexei Kuznetsov[/caption]Probably every Java developer has developed at least one String utility class in his life. Need a proof? Feed "java StringUtil" to your favorite search engine - I found 20 different implementations among the first 30 search hits only! There is a simple reason for that - Strings are used quite frequently in common Java programs...

Read More

The Java compiler requires local variables of enclosing contexts referenced in anonymous classes (so-called captured variables) to be final. What if the anonymous class wants to alter the value of the variable, i.e. requires the variable to be mutable? This post shows different ways how to achieve that. The problem Let's assume we have a UI containing a button and a message to be displayed. The message...

Read More

[caption id="attachment_17278" align="alignright" width="256"] By Pöllö (Own work) [CC-BY-3.0], via Wikimedia Commons[/caption]Did you ever look at a colleague's Java source code file which contained mixed spaces and tabs for indentation, making the code completely unreadable? Or did you ever try to compare two versions of a Java file where the line endings changed, obfuscating the one line of code that really changed? This post shows...

Read More

I always wanted to write a blog post with a title consisting of just acronyms and numeronyms - here it is! Obviously, this post is about internationalizing web applications based on the Eclipse Remote Application Platform (RAP), using property files encoded with UTF-8 character encoding. Usually, Eclipse developers use resource bundles (pure Java) or message bundles (when working on Eclipse) to internationalize strings. Both approaches have the limitation that...

Read More

EasyMock is a powerful framework to create mock objects to use in Java JUnit tests. When used in an OSGi environment (e.g. to write Eclipse PDE tests), the creation of class extensions can cause trouble. This post describes a problematic use case and possible solutions. The use case Imagine the following situation: an Eclipse RCP application has a bundle A containing a class MyClass. This class has...

Read More

[caption id="" align="alignright" width="320"] Image via CC from Paul Gorbould[/caption] Recently I fell into the lost exception pitfall - when an exception thrown in a try block gets lost because another exception is thrown in the finally block. It wasn't that I was not aware of the problem, but rather that I underestimated and therefore ignored it. This post describes an example where suppressed exceptions have...

Read More

Reading the title, you might ask why this could be a problem. Good news: in most cases it isn't. However it can be problem if you use native code in your Eclipse plug-in and run on an older version of Equinox (3.7.2 and earlier). This post describes the problem and possible solutions. The problem On older Windows versions, our Eclipse RCP/RAP application works fine. On Windows 8...

Read More

One common task when working with CouchDB is to find out whether a document with a given ID exists. A simple solution is to send an HTTP GET request with the ID to CouchDB and check the response's HTTP status code. A GET request, executed, for example with curl curl http://localhost:5984/mydatabase/mydocumentid will return the document with an HTTP status code 200 if it is successfully found. If the...

Read More