Java Tag

[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

In the RAP project, reading and writing JSON are critical operations, since the server processes and creates JSON messages for a large number of clients at a high rate. For this reason, we need something fast for this job. When we switched to JSON, we included the org.json parser, which is reasonably small but not famous for its performance. There are many better JSON libraries out...

Read More

Lately a colleague showed me how to improve JUnit tests written for a distance calculator. Speaking with other developers I found out that the majority wasn't aware of the undocumented @Theories Runner which can be found in an experimental package in JUnit, so I decided to share this valuable "experiment". In contrast to the parameterized JUnit test, the Theories-runner will try out all possible combinations of...

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 https://localhost:5984/mydatabase/mydocumentid will return the document with an HTTP status code 200 if it is successfully found. If the...

Read More

Defining APIs is crucial to maintaining modularity. OSGi defines the concepts necessary for API definition such as a service concept and package visibility. However, pure OSGi is not enough to really maintain an API and its potential usages. There are several cases in an API definition where it is required to do more than restrict the accessibility to packages. As an example, a public package...

Read More

Today I'd like to present Tabris 0.11.0. This build marks the last public milestone before the 1.0 release. From my point of view this milestone is a breakthrough for cross-platform mobile development in Java. We have managed to abstract common mobile navigation patterns into a Java API. In addition to this we have added support for SWT Menus and facilities to gain device specific information...

Read More

[caption id="attachment_11460" align="alignright" width="240"] Via Creative Commons from OliBac[/caption] One option for detecting memory leaks in Java is the analysis of heap dumps. The first step is to create an HPROF heap dump from the running Java application, the second is the analysis of the dump with an appropriate analysis tool like jvisualvm or Eclipse Memory Analyzer (MAT). Wanting to do the first step for...

Read More

Over the last years I have seen many OSGi project, and while I am pretty happy with most of them there is a tendency to oversized launch configurations. Keeping the launch configs lean is not easy because the automatic dependency resolver can not always pick the smallest set possible. And maybe even worse it is not always obvious which bundles you need to select to...

Read More