CategoryJava

VI like editing in eclipse

V

Since a few days I’m using a plugin in eclipse which allows vi like editing. It’s called vrapper and can be found under . It is a very good light weight alternative to commercial vi plugins. In my opinion there are not more disadvantages as in other vi plugins. Sometimes it has hangers, this means it does not fall back to the main state instead it hangs in any command mode. In this rare cases normally helps to restart the plugin with the icon in eclipse. The installation is very...

Create mocks with mockito

C

This is a small summarization what the differences are between the different variations creating mocks with mockito. Null values (default) Per default, after creating a mock, every method will return null. Just create your mock with: I think, this is very useful and straight forward. (And based by mockito developers idea, to create very fast a mock for testing). Sometimes it is very difficult to determine an error which was produced through such a null value. For this case it is very...

How to find a concurrency bug with java?

H

How to find a concurrency bug – this was the question I asked myself some time ago. It is always very hard to find a concurrency bug. Mostly you have no idea when it happens or if it is really a concurrency issue or some nasty bit of code. If it is a concurrency issue the question is if the bug is in your code or in a supplied library? Will the problem happen only on multicore processors or on any machine? Besides the technical problem the customer is eager to get a solution and...

Strange Java 1.6.0 update 14 debugging problem

S

A few days ago, we upgraded the jdk we use for development. After this some developers experienced a special problem with our eclipse while debugging. When they set a breakpoint, eclipse did not stop. After a try and error phase we found a working solution. The problem disappeared when we set the vm parameter -Xms (define initial size of heap) to a higher value for the jvm inside eclipse. In our case we set -Xms to -Xms256m. We still do not know why this solution works. But we thought...

Luke – The Lucene Index Toolbox

L

Lucene offers great full text search capabilities. It is based on an index, which is maintained by Lucene. With Luke, the Lucene Index Toolbox () you can analyze your index and let explain queries. After startup, you have to select your index. For this example, I created a test index with one file. It’s content is “this is a lucene test”. I used the StandardAnalyzer, which uses the WhitespaceTokenizer and filters out all tokens less than 3 characters and stop words. This will result in an index...

Perform XPath Queries inside Ant

P

Ant offers some XML features like the xslt task, which transforms XML files into other files. But unfortunately, with Ant you can’t make simple XPath Queries on a specific XML file.
 
Luckily, there is a nice open source solution called XmlTask, which offers many possibilities to work with XML files.
 

Download the latest version of XmlTask from

GC Viewer

G

Wrong use of the memory options can cause serious performance problems. To optimize the right memory size of the JVM or to find some critical memory issues, the GC log of the JVM can be very useful. Simply start the Java application with the option -Xloggc:<file>. Every GC action gets logged into this file. To analyse this log file, there is a nice tool called GCViewer, which can be downloaded from . GCViewer is able to display the memory usage of the application based on time and...

Use Groovy inside Ant

U

There are some kind of tasks, which Ant won’t do. One of them is the loop. There is no simple way to implement a dynamic for or while loop in Ant. What do i mean with dynamic? Let me make an example. Ant reads out a number of iterations from a property file (we call it the number x) and should perform a loop x-times to call another Ant task. And this can only hardly be done with Ant. But fortunately, there is Groovy. Groovy is a scripting language, which runs in a Java Virtual Machine...

Mockito

M

A few weeks ago, I started using Mockito. Mockito is a mocking framework for Java.
What mockito is able to do:
– mocking interfaces and abstract classes
– mocking concrete classes
– spy real objects
()
I liked mockito so much that I decided to present it to you…

Recent Posts