aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java
diff options
context:
space:
mode:
authorDavid North <dnorth@apache.org>2015-08-06 15:57:48 +0000
committerDavid North <dnorth@apache.org>2015-08-06 15:57:48 +0000
commit9260284a0a63f7b6e88f6ad0d9f06cdd714966a4 (patch)
tree5cde72c7c97f3b35fd7d49e358a69ec8217a08a2 /src/ooxml/java
parent766798e8882ecdfce315e55c9ca066db0ee9841b (diff)
downloadpoi-9260284a0a63f7b6e88f6ad0d9f06cdd714966a4.tar.gz
poi-9260284a0a63f7b6e88f6ad0d9f06cdd714966a4.zip
Proposed refactor for:
https://bz.apache.org/bugzilla/show_bug.cgi?id=58219 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1694531 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java')
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
index 153fc05d90..cb9ba9a5fe 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
@@ -377,14 +377,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable<X
// 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 POIXMLDocument implements Workbook, Iterable<X
}
}
+ 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
*/