From 1a08d94f9d275919eae0532f0adc0a3246b9e8b7 Mon Sep 17 00:00:00 2001 From: Sam Alloing Date: Tue, 17 Sep 2024 09:27:23 +0200 Subject: [PATCH] fix castException with byte[] In the Viewer there is a CastException in the Byte[] in some WAVE files --- .../harvard/hul/ois/jhove/viewer/RepTreeRoot.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/RepTreeRoot.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/RepTreeRoot.java index c3bbc9900..504dea7d2 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/RepTreeRoot.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/RepTreeRoot.java @@ -485,8 +485,16 @@ private void addArrayMembers(DefaultMutableTreeNode node, Property p) { break; } case BYTE: { - addToNode(node, (Byte[]) pVal); - break; + if (pVal instanceof byte[]) { + byte[] byteArray = (byte[]) pVal; + Byte[] byteObjectArray = new Byte[byteArray.length]; + for (int i = 0; i < byteArray.length; i++) { + byteObjectArray[i] = byteArray[i]; // Autoboxing from byte to Byte + } + addToNode(node, (Byte[]) byteObjectArray); + } else { + addToNode(node, (Byte[]) pVal); + } } case STRING: { addToNode(node, (String[]) pVal);