Java Tag

Unit tests often stop being useful where concurrency is involved. A special case is thread safety which can be tested relatively easily with the use of a simple JUnit rule. Suppose middle earth wants to keep track of the dragons that were slain over the centuries. The dragons are tracked in one list, and reports come in from different dwarfs, humans or elves. Sometimes, a dragon...

Read More

From my point of view bootstrapping a new application is always tricky. Especially when you want to bootstrap an app that uses technology you are not yet familiar with. With this post I want to give you a step by step tutorial on how to bootstrap a Tabris application using Eclipse and Maven. So, let's get our hands dirty! IDE Setup The first thing you need to...

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

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