From 2fb1cb3b33a1cd82ad2360d88e002722a4ccf870 Mon Sep 17 00:00:00 2001 From: Karen Hanson Date: Tue, 28 Nov 2023 17:18:39 -0500 Subject: [PATCH 1/2] Empty properties causing extra indents in XmlHandler Minor fix to move down the code that increments the indent level in XmlHandler.showProperty - when Utils.isPropertyEmpty is true, it indents unnecessarily causing misalignment in the XML. --- .../edu/harvard/hul/ois/jhove/handler/XmlHandler.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/XmlHandler.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/XmlHandler.java index 57db68870..b417ea7f8 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/XmlHandler.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/XmlHandler.java @@ -744,11 +744,6 @@ protected String valueToString(Object obj) { } protected void showProperty(Property property) { - String margin = getIndent(++_level); - String margn2 = margin + " "; - String margn3 = margn2 + " "; - String margn4 = margn3 + " "; - PropertyArity arity = property.getArity(); PropertyType type = property.getType(); @@ -756,6 +751,11 @@ protected void showProperty(Property property) { // as this could result in a schema violation. if (Utils.isPropertyEmpty(property, arity)) return; + + String margin = getIndent(++_level); + String margn2 = margin + " "; + String margn3 = margn2 + " "; + String margn4 = margn3 + " "; boolean valueIsProperty = PropertyType.PROPERTY.equals(type); boolean valueIsNiso = PropertyType.NISOIMAGEMETADATA.equals(type); From 2d8331e324ea805ad01e88191b068c40fb060f56 Mon Sep 17 00:00:00 2001 From: Carl Wilson Date: Tue, 5 Mar 2024 14:24:05 +0000 Subject: [PATCH 2/2] FIX: Tests affected by indent change. --- jhove-bbt/scripts/create-1.29-target.sh | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/jhove-bbt/scripts/create-1.29-target.sh b/jhove-bbt/scripts/create-1.29-target.sh index 8f8f713b6..30f9491fd 100755 --- a/jhove-bbt/scripts/create-1.29-target.sh +++ b/jhove-bbt/scripts/create-1.29-target.sh @@ -90,3 +90,30 @@ fi if [[ -f "${candidateRoot}/regression/modules/PNG-gdm/issue_148.png.jhove.xml" ]]; then cp "${candidateRoot}/regression/modules/PNG-gdm/issue_148.png.jhove.xml" "${targetRoot}/regression/modules/PNG-gdm/issue_148.png.jhove.xml" fi + +declare -a indent_affected=("errors/modules/PDF-hul/pdf-hul-14-govdocs-489354.pdf.jhove.xml" + "errors/modules/PDF-hul/pdf-hul-9-govdocs-065694.pdf.jhove.xml" + "errors/modules/PDF-hul/pdf-hul-1-govdocs-519846.pdf.jhove.xml" + "errors/modules/PDF-hul/pdf-hul-49-32932439X.pdf.jhove.xml" + "errors/modules/JPEG2000-hul/is_jpx.jp2.jhove.xml" + "errors/modules/WAVE-hul/wf-pcm-44khz-8bit-mono-fmt-chunk-2-unrecognized-bytes.wav.jhove.xml" + "regression/modules/PNG-gdm/issue_694.png.jhove.xml" + "regression/modules/PDF-hul/null-string.pdf.jhove.xml" + "regression/modules/PDF-hul/pdf-hul-94-false-positive.pdf.jhove.xml" + "regression/modules/PDF-hul/issue_646.pdf.jhove.xml" + "regression/modules/PDF-hul/null-string-sig-2.pdf.jhove.xml" + "regression/modules/PDF-hul/null-string-sig-1.pdf.jhove.xml" + "regression/modules/PDF-hul/pdf-hul-40-govdocs-088919.pdf.jhove.xml" + "examples/modules/TIFF-hul/cramps.tif.jhove.xml" + "examples/modules/TIFF-hul/text.tif.jhove.xml" + "examples/modules/TIFF-hul/testpage-small.tif.jhove.xml" + "examples/modules/JPEG2000-hul/ROITest.jpx.jhove.xml" + "examples/modules/WAVE-hul/8-Bit-Noise-1.wav.jhove.xml" + "examples/modules/WAVE-hul/8-Bit-Noise-2.wav.jhove.xml" + ) +for filename in "${indent_affected[@]}" +do + if [[ -f "${candidateRoot}/${filename}" ]]; then + cp "${candidateRoot}/${filename}" "${targetRoot}/${filename}" + fi +done \ No newline at end of file