]> source.dussan.org Git - poi.git/commitdiff
bug 60153: move flushSheets out to its own method
authorJaven O'Neal <onealj@apache.org>
Wed, 21 Sep 2016 03:31:15 +0000 (03:31 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 21 Sep 2016 03:31:15 +0000 (03:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761668 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java

index 331ad9a0fd3e9d786c222a11c69d446e607ea06e..6b9ce374fbb00a71652207df1c5b4e6084403430 100644 (file)
@@ -907,7 +907,9 @@ public class SXSSFWorkbook implements Workbook {
             try {
                 sheet.getSheetDataWriter().close();
             } catch (IOException e) {
-                // ignore exception here
+                logger.log(POILogger.WARN,
+                        "An exception occurred while closing sheet data writer for sheet "
+                        + sheet.getSheetName() + ".", e);
             }
         }
 
@@ -926,11 +928,8 @@ public class SXSSFWorkbook implements Workbook {
     @Override
     public void write(OutputStream stream) throws IOException
     {
-       for (SXSSFSheet sheet : _xFromSxHash.values())
-       {
-               sheet.flushRows();
-       }
-       
+        flushSheets();
+
         //Save the template
         File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx");
         try
@@ -956,6 +955,13 @@ public class SXSSFWorkbook implements Workbook {
         }
     }
     
+    protected void flushSheets() throws IOException {
+        for (SXSSFSheet sheet : _xFromSxHash.values())
+        {
+            sheet.flushRows();
+        }
+    }
+    
     /**
      * Dispose of temporary files backing this workbook on disk.
      * Calling this method will render the workbook unusable.