Make metadata parsing more lenient (JAVA-377, JAVA-391).
Merge branch '2.0' into 2.1