Backport to JDK 5