From: Rainer Klute Date: Thu, 8 Jan 2004 14:25:35 +0000 (+0000) Subject: Buf fix plus testcasde: Reading property values failed with a StringIndexOutOfBoundsE... X-Git-Tag: PERF_BEFORE_MERGE~62 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=11850930ed336923abbdad47a60d84eb9897d512;p=poi.git Buf fix plus testcasde: Reading property values failed with a StringIndexOutOfBoundsException on empty strings. git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353485 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hpsf/Property.java b/src/java/org/apache/poi/hpsf/Property.java index 2b04da8528..ee99468e2c 100644 --- a/src/java/org/apache/poi/hpsf/Property.java +++ b/src/java/org/apache/poi/hpsf/Property.java @@ -265,7 +265,7 @@ public class Property b.append((char) src[o + j]); /* Strip 0x00 characters from the end of the string: */ - while (b.charAt(b.length() - 1) == 0x00) + while (b.length() > 0 && b.charAt(b.length() - 1) == 0x00) b.setLength(b.length() - 1); if (codepage == CP_UNICODE) { diff --git a/src/testcases/org/apache/poi/hpsf/data/TestSolidWorks.sldprt b/src/testcases/org/apache/poi/hpsf/data/TestSolidWorks.sldprt new file mode 100644 index 0000000000..a7962b369f Binary files /dev/null and b/src/testcases/org/apache/poi/hpsf/data/TestSolidWorks.sldprt differ