]> source.dussan.org Git - poi.git/commitdiff
bug 60255: use actual number of package parts rather than hard-coding an upper-bound
authorJaven O'Neal <onealj@apache.org>
Wed, 19 Oct 2016 07:47:07 +0000 (07:47 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 19 Oct 2016 07:47:07 +0000 (07:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765546 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java

index a321faf8f4848bcd5ab6bd3faa997b49d2d24a35..e6a77f854efa4d8f777e895e1c5769d0de36ca6b 100644 (file)
@@ -575,7 +575,8 @@ public class POIXMLDocumentPart {
             // Default to searching from 1, unless they asked for 0+
             int idx = minIdx;
             if (minIdx < 0) idx = 1;
-            while (idx < 1000) {
+            int maxIdx = minIdx + pkg.getParts().size();
+            while (idx <= maxIdx) {
                 name = descriptor.getFileName(idx);
                 PackagePartName ppName = PackagingURIHelper.createPartName(name);
                 if (!pkg.containPart(ppName)) {