From eacf24f41b2361b29440ef50f48fe42f862d64bc Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 10 May 2006 13:23:48 +0000 Subject: [PATCH] If given an empty (but not null) byte array to get a whole string from, return an empty string rather than an exception git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@405755 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/util/StringUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/java/org/apache/poi/util/StringUtil.java b/src/java/org/apache/poi/util/StringUtil.java index 33a1a1328a..70bbf044b8 100644 --- a/src/java/org/apache/poi/util/StringUtil.java +++ b/src/java/org/apache/poi/util/StringUtil.java @@ -88,6 +88,7 @@ public class StringUtil { *@return the converted string */ public static String getFromUnicodeLE(final byte[] string) { + if(string.length == 0) { return ""; } return getFromUnicodeLE(string, 0, string.length / 2); } @@ -140,6 +141,7 @@ public class StringUtil { *@return the converted string */ public static String getFromUnicodeBE(final byte[] string) { + if(string.length == 0) { return ""; } return getFromUnicodeBE(string, 0, string.length / 2); } -- 2.39.5