poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dno...@apache.org
Subject svn commit: r1694531 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
Date Thu, 06 Aug 2015 15:57:48 GMT
Author: dnorth
Date: Thu Aug  6 15:57:48 2015
New Revision: 1694531

URL: http://svn.apache.org/r1694531
Log:
Proposed refactor for:

https://bz.apache.org/bugzilla/show_bug.cgi?id=58219

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=1694531&r1=1694530&r2=1694531&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Thu Aug  6 15:57:48
2015
@@ -377,14 +377,7 @@ public class XSSFWorkbook extends POIXML
             //  of CTSheet elements in the workbook
             sheets = new ArrayList<XSSFSheet>(shIdMap.size());
             for (CTSheet ctSheet : this.workbook.getSheets().getSheetArray()) {
-                XSSFSheet sh = shIdMap.get(ctSheet.getId());
-                if(sh == null) {
-                    logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + "
and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping");
-                    continue;
-                }
-                sh.sheet = ctSheet;
-                sh.onDocumentRead();
-                sheets.add(sh);
+                parseSheet(shIdMap, ctSheet);
             }
             
             // Load the external links tables. Their order is defined by the order 
@@ -408,6 +401,17 @@ public class XSSFWorkbook extends POIXML
         }
     }
 
+    protected void parseSheet(Map<String, XSSFSheet> shIdMap, CTSheet ctSheet) {
+        XSSFSheet sh = shIdMap.get(ctSheet.getId());
+        if(sh == null) {
+            logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id
" + ctSheet.getId()+ " was defined, but didn't exist in package, skipping");
+            return;
+        }
+        sh.sheet = ctSheet;
+        sh.onDocumentRead();
+        sheets.add(sh);
+    }
+
     /**
      * Create a new CTWorkbook with all values set to default
      */



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


Mime
View raw message