Author: onealj
Date: Wed Oct 19 06:44:09 2016
New Revision: 1765536

URL: http://svn.apache.org/viewvc?rev=1765536&view=rev
Log:
make code more similar between default case and indexed case

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java?rev=1765536&r1=1765535&r2=1765536&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocumentPart.java Wed Oct 19 
06:44:09 2016
@@ -559,9 +559,10 @@ public class POIXMLDocumentPart {
         OPCPackage pkg = packagePart.getPackage();
         
         try {
-            if 
(descriptor.getDefaultFileName().equals(descriptor.getFileName(9999))) {
+            String name = descriptor.getDefaultFileName();
+            if (name.equals(descriptor.getFileName(9999))) {
                 // Non-index based, check if default is free
-                PackagePartName ppName = 
PackagingURIHelper.createPartName(descriptor.getDefaultFileName());
+                PackagePartName ppName = 
PackagingURIHelper.createPartName(name);
                 if (pkg.containPart(ppName)) {
                     // Default name already taken, not index based, nothing 
free
                     return -1;
@@ -575,8 +576,9 @@ public class POIXMLDocumentPart {
             int idx = minIdx;
             if (minIdx < 0) idx = 1;
             while (idx < 1000) {
-                String name = descriptor.getFileName(idx);
-                if (!pkg.containPart(PackagingURIHelper.createPartName(name))) 
{
+                name = descriptor.getFileName(idx);
+                PackagePartName ppName = 
PackagingURIHelper.createPartName(name);
+                if (!pkg.containPart(ppName)) {
                     return idx;
                 }
                 idx++;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org
For additional commands, e-mail: commits-h...@poi.apache.org

Reply via email to