You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2010/09/11 15:48:00 UTC

svn commit: r996148 - in /poi/trunk/src: documentation/content/xdocs/status.xml ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java

Author: yegor
Date: Sat Sep 11 13:48:00 2010
New Revision: 996148

URL: http://svn.apache.org/viewvc?rev=996148&view=rev
Log:
avoid corruption of XSSFWorkbook after removing all merged cells from sheet, see Bugzilla 49895

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=996148&r1=996147&r2=996148&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat Sep 11 13:48:00 2010
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.7-beta3" date="2010-??-??">
+           <action dev="poi-developers" type="fix">49895 - avoid corruption of XSSFWorkbook after removing all merged cells from sheet</action>
            <action dev="poi-developers" type="fix">49907 - fixed inconsistent behaviour between HSSF and XSSF when creating consecutive names</action>
            <action dev="poi-developers" type="add">Add getMimeType() method to HWPF Picture, alongside existing file extension</action>
            <action dev="poi-developers" type="add">Add code for reading Ole10Native data</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=996148&r1=996147&r2=996148&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Sat Sep 11 13:48:00 2010
@@ -1350,7 +1350,11 @@ public class XSSFSheet extends POIXMLDoc
                 mergeCellsArray[i - 1] = ctMergeCells.getMergeCellArray(i);
             }
         }
-        ctMergeCells.setMergeCellArray(mergeCellsArray);
+        if(mergeCellsArray.length > 0){
+            ctMergeCells.setMergeCellArray(mergeCellsArray);
+        } else{
+            worksheet.unsetMergeCells();
+        }
     }
 
     /**

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java?rev=996148&r1=996147&r2=996148&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java Sat Sep 11 13:48:00 2010
@@ -253,6 +253,8 @@ public final class TestXSSFSheet extends
         sheet.removeMergedRegion(1);
         sheet.removeMergedRegion(0);
         assertEquals(0, sheet.getNumMergedRegions());
+        assertNull(" CTMergeCells should be deleted after removing the last merged " +
+                "region on the sheet.", sheet.getCTWorksheet().getMergeCells());
     }
 
     public void testSetDefaultColumnStyle() {



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