Avoid using ReflectiveOperationException to retain jdk 6 compatibility