diff --git a/dev-support/docker/Dockerfile b/dev-support/docker/Dockerfile index dcd84c89c218..e3f2ede01bc9 100644 --- a/dev-support/docker/Dockerfile +++ b/dev-support/docker/Dockerfile @@ -43,6 +43,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \ rsync='3.2.3-*' \ tar='1.34+dfsg-*' \ wget='1.21.2-*' \ +# for validating xml files with xmllint + libxml2-dev='2.9.13+dfsg-*' \ + libxml2-utils='2.9.13+dfsg-*' \ # install the dependencies required in order to enable the sundry precommit # checks/features provided by Yetus plugins. bats='1.2.1-*' \ diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh index c7131c45e2f1..d3b106eda63b 100755 --- a/dev-support/hbase-personality.sh +++ b/dev-support/hbase-personality.sh @@ -890,6 +890,62 @@ function hbase_javac_logfilter ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" | sort > "${output}" } +###################################### + +# Override the default xml_postcompile to use xmllint instead of jrunscript because the javascript +# engine has been removed from JDK starting from JDK15 +# https://openjdk.org/jeps/372 +function hbase_xml_postcompile +{ + declare repostatus=$1 + declare i + declare count + + if ! verify_needed_test xml; then + return 0 + fi + + if [[ "${repostatus}" = branch ]]; then + return 0 + fi + + big_console_header "XML verification: ${BUILDMODE}" + + start_clock + + pushd "${BASEDIR}" >/dev/null || return 1 + for i in "${CHANGED_FILES[@]}"; do + if [[ ${i} =~ \.xml$ && -f ${i} ]]; then + if ! "xmllint" --noout "${i}" > "${PATCH_DIR}/xml.txt.tmp" 2>&1; then + { + echo "" + echo "${i}:" + echo "" + cat "${PATCH_DIR}/xml.txt.tmp" + } >> "${PATCH_DIR}/xml.txt" + ((count=count+1)) + XML_FILES+=("${i}") + fi + fi + done + + popd >/dev/null || return 1 + + if [[ -f "${PATCH_DIR}/xml.txt.tmp" ]]; then + rm "${PATCH_DIR}/xml.txt.tmp" + fi + + if [[ ${count} -gt 0 ]]; then + add_vote_table -1 xml "${BUILDMODEMSG} has ${count} ill-formed XML file(s)." + add_footer_table xml "@@BASE@@/xml.txt" + populate_test_table "XML" "Parsing Error(s):" "${XML_FILES[@]}" + return 1 + fi + + add_vote_table +1 xml "${BUILDMODEMSG} has no ill-formed XML file." + return 0 +} + ## This is named so that yetus will check us right after running tests. ## Essentially, we check for normal failures and then we look for zombies. #function hbase_unit_logfilter