Make metadata parsing more lenient (JAVA-377, JAVA-391).