From 20dc9dc71447702f838ff863494cc708136d994c Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 11 Jul 2018 21:32:55 +0000 Subject: [PATCH] code formatting git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1835674 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xssf/streaming/SXSSFSheet.java | 41 ++++++++----------- .../poi/xssf/streaming/SXSSFWorkbook.java | 7 ++-- .../poi/xssf/streaming/TestSXSSFSheet.java | 8 ++-- .../poi/xssf/streaming/TestSXSSFWorkbook.java | 4 +- 4 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index 6530fafec..c7dbc40af 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -66,7 +66,7 @@ public class SXSSFSheet implements Sheet { /*package*/ final XSSFSheet _sh; private final SXSSFWorkbook _workbook; - private final TreeMap _rows= new TreeMap<>(); + private final TreeMap _rows = new TreeMap<>(); private final SheetDataWriter _writer; private int _randomAccessWindowSize = SXSSFWorkbook.DEFAULT_WINDOW_SIZE; private final AutoSizeColumnTracker _autoSizeColumnTracker; @@ -138,17 +138,13 @@ public class SXSSFSheet implements Sheet "in the range [0," + _sh.getLastRowNum() + "] that is already written to disk."); } - SXSSFRow newRow=new SXSSFRow(this); - _rows.put(rownum,newRow); + SXSSFRow newRow = new SXSSFRow(this); + _rows.put(rownum, newRow); allFlushed = false; - if(_randomAccessWindowSize>=0&&_rows.size()>_randomAccessWindowSize) - { - try - { + if(_randomAccessWindowSize >= 0 && _rows.size() > _randomAccessWindowSize) { + try { flushRows(_randomAccessWindowSize); - } - catch (IOException ioe) - { + } catch (IOException ioe) { throw new RuntimeException(ioe); } } @@ -167,11 +163,9 @@ public class SXSSFSheet implements Sheet throw new IllegalArgumentException("Specified row does not belong to this sheet"); } - for(Iterator> iter=_rows.entrySet().iterator();iter.hasNext();) - { - Map.Entry entry=iter.next(); - if(entry.getValue()==row) - { + for(Iterator> iter = _rows.entrySet().iterator(); iter.hasNext();) { + Map.Entry entry = iter.next(); + if(entry.getValue() == row) { iter.remove(); return; } @@ -199,7 +193,7 @@ public class SXSSFSheet implements Sheet @Override public int getPhysicalNumberOfRows() { - return _rows.size()+_writer.getNumberOfFlushedRows(); + return _rows.size() + _writer.getNumberOfFlushedRows(); } /** @@ -208,8 +202,7 @@ public class SXSSFSheet implements Sheet * @return the number of the first logical row on the sheet (0-based) */ @Override - public int getFirstRowNum() - { + public int getFirstRowNum() { if(_writer.getNumberOfFlushedRows() > 0) { return _writer.getLowestIndexOfFlushedRows(); } @@ -971,7 +964,7 @@ public class SXSSFSheet implements Sheet @NotImplemented @Override public void shiftRows(int startRow, int endRow, int n) { - throw new RuntimeException("NotImplemented"); + throw new RuntimeException("Not Implemented"); } /** @@ -996,7 +989,7 @@ public class SXSSFSheet implements Sheet @Override public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight) { - throw new RuntimeException("NotImplemented"); + throw new RuntimeException("Not Implemented"); } /** @@ -1734,7 +1727,7 @@ public class SXSSFSheet implements Sheet // corrupted .xlsx files as rows appear multiple times in the resulting sheetX.xml files // return _sh.setArrayFormula(formula, range); - throw new RuntimeException("NotImplemented"); + throw new RuntimeException("Not Implemented"); } /** @@ -1749,7 +1742,7 @@ public class SXSSFSheet implements Sheet // corrupted .xlsx files as rows appear multiple times in the resulting sheetX.xml files // return _sh.removeArrayFormula(cell); - throw new RuntimeException("NotImplemented"); + throw new RuntimeException("Not Implemented"); } @Override @@ -1831,7 +1824,7 @@ public class SXSSFSheet implements Sheet if(value == 0 || value < -1) { throw new IllegalArgumentException("RandomAccessWindowSize must be either -1 or a positive integer"); } - _randomAccessWindowSize=value; + _randomAccessWindowSize = value; } /** @@ -2123,6 +2116,6 @@ public class SXSSFSheet implements Sheet @NotImplemented @Override public void shiftColumns(int startColumn, int endColumn, int n){ - throw new UnsupportedOperationException("NotImplemented"); + throw new UnsupportedOperationException("Not Implemented"); } } 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 6dc03d884..c066fcd2b 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -691,9 +691,8 @@ public class SXSSFWorkbook implements Workbook { */ @Override @NotImplemented - public Sheet cloneSheet(int sheetNum) - { - throw new RuntimeException("NotImplemented"); + public Sheet cloneSheet(int sheetNum) { + throw new RuntimeException("Not Implemented"); } @@ -1291,7 +1290,7 @@ public class SXSSFWorkbook implements Workbook { @Override @NotImplemented public int linkExternalWorkbook(String name, Workbook workbook) { - throw new RuntimeException("NotImplemented"); + throw new RuntimeException("Not Implemented"); } /** diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java index d5be11e2f..f6fbd8587 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java @@ -59,7 +59,7 @@ public final class TestSXSSFSheet extends BaseTestXSheet { @Test public void cloneSheet() throws IOException { thrown.expect(RuntimeException.class); - thrown.expectMessage("NotImplemented"); + thrown.expectMessage("Not Implemented"); super.cloneSheet(); } @@ -67,7 +67,7 @@ public final class TestSXSSFSheet extends BaseTestXSheet { @Test public void cloneSheetMultipleTimes() throws IOException { thrown.expect(RuntimeException.class); - thrown.expectMessage("NotImplemented"); + thrown.expectMessage("Not Implemented"); super.cloneSheetMultipleTimes(); } @@ -78,7 +78,7 @@ public final class TestSXSSFSheet extends BaseTestXSheet { @Test public void shiftMerged() throws IOException { thrown.expect(RuntimeException.class); - thrown.expectMessage("NotImplemented"); + thrown.expectMessage("Not Implemented"); super.shiftMerged(); } @@ -91,7 +91,7 @@ public final class TestSXSSFSheet extends BaseTestXSheet { @Test public void bug35084() throws IOException { thrown.expect(RuntimeException.class); - thrown.expectMessage("NotImplemented"); + thrown.expectMessage("Not Implemented"); super.bug35084(); } 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 a25d26b6c..120fe0b5b 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java @@ -80,7 +80,7 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook { super.cloneSheet(); fail("expected exception"); } catch (RuntimeException e){ - assertEquals("NotImplemented", e.getMessage()); + assertEquals("Not Implemented", e.getMessage()); } } @@ -94,7 +94,7 @@ public final class TestSXSSFWorkbook extends BaseTestXWorkbook { super.sheetClone(); fail("expected exception"); } catch (RuntimeException e){ - assertEquals("NotImplemented", e.getMessage()); + assertEquals("Not Implemented", e.getMessage()); } }