Fix handling of build messages on Java 5 and Java 6