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
This commit is contained in:
Nick Burch 2006-05-10 13:23:48 +00:00
parent f80d4eadfa
commit 5d14b4debb
1 changed files with 2 additions and 0 deletions

View File

@ -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);
}