Fix usage of Java 6 API