diff options
author | Javen O'Neal <onealj@apache.org> | 2016-01-16 22:58:25 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-01-16 22:58:25 +0000 |
commit | 313cce7d77fe3e84f911d9553cd4b6169121a523 (patch) | |
tree | d2fa751b1c8293484e0b290a92fd123f23609892 | |
parent | b06744cece194b7fda709dfd54076579f97cc65b (diff) | |
download | poi-313cce7d77fe3e84f911d9553cd4b6169121a523.tar.gz poi-313cce7d77fe3e84f911d9553cd4b6169121a523.zip |
make SXSSFWorkbook member variables private
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1725047 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java | 25 | ||||
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java | 10 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java index 57bee980a2..8e15739b45 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -28,6 +28,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.NoSuchElementException; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -71,29 +72,29 @@ public class SXSSFWorkbook implements Workbook { /** * Specifies how many rows can be accessed at most via getRow(). * When a new node is created via createRow() and the total number - * of unflushed records would exeed the specified value, then the + * of unflushed records would exceed the specified value, then the * row with the lowest index value is flushed and cannot be accessed * via getRow() anymore. */ public static final int DEFAULT_WINDOW_SIZE = 100; - private static POILogger logger = POILogFactory.getLogger(SXSSFWorkbook.class); + private static final POILogger logger = POILogFactory.getLogger(SXSSFWorkbook.class); - XSSFWorkbook _wb; + private final XSSFWorkbook _wb; - HashMap<SXSSFSheet,XSSFSheet> _sxFromXHash=new HashMap<SXSSFSheet,XSSFSheet>(); - HashMap<XSSFSheet,SXSSFSheet> _xFromSxHash=new HashMap<XSSFSheet,SXSSFSheet>(); + private final Map<SXSSFSheet,XSSFSheet> _sxFromXHash = new HashMap<SXSSFSheet,XSSFSheet>(); + private final Map<XSSFSheet,SXSSFSheet> _xFromSxHash = new HashMap<XSSFSheet,SXSSFSheet>(); private int _randomAccessWindowSize = DEFAULT_WINDOW_SIZE; /** - * whetehr temp files should be compressed. + * whether temp files should be compressed. */ private boolean _compressTmpFiles = false; /** * shared string table - a cache of strings in this workbook */ - private SharedStringsTable _sharedStringSource = null; + private final SharedStringsTable _sharedStringSource; /** * Construct a new workbook @@ -220,16 +221,12 @@ public class SXSSFWorkbook implements Workbook { if (workbook == null) { _wb=new XSSFWorkbook(); - if(useSharedStringsTable){ - _sharedStringSource = _wb.getSharedStringSource(); - } + _sharedStringSource = useSharedStringsTable ? _wb.getSharedStringSource() : null; } else { _wb=workbook; - if(useSharedStringsTable){ - _sharedStringSource = _wb.getSharedStringSource(); - } + _sharedStringSource = useSharedStringsTable ? _wb.getSharedStringSource() : null; for ( int i = 0; i < _wb.getNumberOfSheets(); i++ ) { XSSFSheet sheet = _wb.getSheetAt( i ); @@ -1333,7 +1330,7 @@ public class SXSSFWorkbook implements Workbook { * @since 3.14 beta 2 */ @Override - public SpreadsheetVersion getSpreadsheetVersion() { + public SpreadsheetVersion getSpreadsheetVersion() { return SpreadsheetVersion.EXCEL2007; } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java index 4c46cd1f41..6d89aa500e 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java @@ -310,14 +310,16 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook { } } - for (SXSSFSheet sheet : wb._sxFromXHash.keySet()) { - assertTrue(sheet.getSheetDataWriter().getTempFile().exists()); + for (Sheet sheet : wb) { + SXSSFSheet sxSheet = (SXSSFSheet) sheet; + assertTrue(sxSheet.getSheetDataWriter().getTempFile().exists()); } assertTrue(wb.dispose()); - for (SXSSFSheet sheet : wb._sxFromXHash.keySet()) { - assertFalse(sheet.getSheetDataWriter().getTempFile().exists()); + for (Sheet sheet : wb) { + SXSSFSheet sxSheet = (SXSSFSheet) sheet; + assertFalse(sxSheet.getSheetDataWriter().getTempFile().exists()); } } |