From cc9d459c302b9db7031dcae069d581c8c874cc96 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 13 Jul 2015 17:31:04 +0000 Subject: [PATCH] Allow dumping of null arrays git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1690772 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/util/HexDump.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/poi/util/HexDump.java b/src/java/org/apache/poi/util/HexDump.java index 979ca1c9c5..d88a2fbaf0 100644 --- a/src/java/org/apache/poi/util/HexDump.java +++ b/src/java/org/apache/poi/util/HexDump.java @@ -253,12 +253,15 @@ public class HexDump { { StringBuffer retVal = new StringBuffer(); retVal.append('['); - for(int x = 0; x < value.length; x++) + if (value != null && value.length > 0) { - if (x>0) { - retVal.append(", "); + for(int x = 0; x < value.length; x++) + { + if (x>0) { + retVal.append(", "); + } + retVal.append(toHex(value[x])); } - retVal.append(toHex(value[x])); } retVal.append(']'); return retVal.toString();