]> source.dussan.org Git - poi.git/commitdiff
purged calls to cell.setCellType(CellType.BLANK) from the project, replaced with...
authorVladislav Galas <gallon@apache.org>
Sat, 26 Jan 2019 19:41:10 +0000 (19:41 +0000)
committerVladislav Galas <gallon@apache.org>
Sat, 26 Jan 2019 19:41:10 +0000 (19:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1852245 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
src/java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationCell.java
src/java/org/apache/poi/ss/usermodel/RangeCopier.java
src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFCell.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTable.java
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFCell.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
src/testcases/org/apache/poi/hssf/record/TestSharedFormulaRecord.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
src/testcases/org/apache/poi/ss/formula/TestEvaluationCache.java
src/testcases/org/apache/poi/ss/formula/atp/TestRandBetween.java
src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java

index dbeaba8b48c6981ff936cb2186c5c6e27846687c..eb92d5bddb7d79e85d18ae657c0d6541478cb45e 100644 (file)
@@ -42,14 +42,12 @@ import org.apache.poi.ss.formula.FormulaType;
 import org.apache.poi.ss.formula.eval.ErrorEval;
 import org.apache.poi.ss.formula.ptg.ExpPtg;
 import org.apache.poi.ss.formula.ptg.Ptg;
-import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellBase;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.CellType;
 import org.apache.poi.ss.usermodel.CellValue;
 import org.apache.poi.ss.usermodel.Comment;
 import org.apache.poi.ss.usermodel.FormulaError;
-import org.apache.poi.ss.usermodel.FormulaEvaluator;
 import org.apache.poi.ss.usermodel.Hyperlink;
 import org.apache.poi.ss.usermodel.RichTextString;
 import org.apache.poi.ss.util.CellAddress;
@@ -492,7 +490,7 @@ public class HSSFCell extends CellBase {
     public void setCellValue(Date value)
     {
         if(value == null) {
-            setCellType(CellType.BLANK);
+            setBlank();
             return;
         }
 
@@ -517,7 +515,7 @@ public class HSSFCell extends CellBase {
     public void setCellValue(Calendar value)
     {
         if(value == null) {
-            setCellType(CellType.BLANK);
+            setBlank();
             return;
         }
 
@@ -1302,3 +1300,4 @@ public class HSSFCell extends CellBase {
         return styleIndex;
     }
 }
+
index 48a90959075d3b0051d292549b0477e3b0baa750..84d13ca0b9f303fe400a7cd90c3e444b08d67c42 100644 (file)
@@ -2389,7 +2389,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
         CellRange<HSSFCell> result = getCellRange(range);
         // clear all cells in the range
         for (Cell c : result) {
-            c.setCellType(CellType.BLANK);
+            c.setBlank();
         }
         return result;
     }
index 88beb361d4c9cf3ab8fac37c83b302c38c9f72cd..21897a98bfcbf520ce9ebb164e487139452bc83c 100644 (file)
@@ -91,7 +91,7 @@ final class ForkedEvaluationCell implements EvaluationCell {
        }
        public void copyValue(Cell destCell) {
                switch (_cellType) {
-                       case BLANK:   destCell.setCellType(CellType.BLANK);          return;
+                       case BLANK:   destCell.setBlank();                           return;
                        case NUMERIC: destCell.setCellValue(_numberValue);           return;
                        case BOOLEAN: destCell.setCellValue(_booleanValue);          return;
                        case STRING:  destCell.setCellValue(_stringValue);           return;
index ea3bc4e225a8c4d71cd8a3e6d3cddd11481e564b..162100240f60ff7a34f2a0c71e634a20b41aeae9 100644 (file)
@@ -140,7 +140,7 @@ public abstract class RangeCopier {
                  destCell.setCellValue(srcCell.getNumericCellValue());   
                  break;   
              case BLANK:   
-                 destCell.setCellType(CellType.BLANK);   
+                 destCell.setBlank();
                  break;   
              case BOOLEAN:   
                  destCell.setCellValue(srcCell.getBooleanCellValue());   
index 3f67266f21adb877fef8e3a1dd826e1830546394..797c39bba63a491eaab800a79335a58f54f464f0 100644 (file)
@@ -224,7 +224,7 @@ public class SXSSFCell extends CellBase {
     @Override
     public void setCellValue(Date value) {
         if(value == null) {
-            setCellType(CellType.BLANK);
+            setBlank();
             return;
         }
 
@@ -251,7 +251,7 @@ public class SXSSFCell extends CellBase {
     @Override
     public void setCellValue(Calendar value) {
         if(value == null) {
-            setCellType(CellType.BLANK);
+            setBlank();
             return;
         }
 
@@ -283,7 +283,7 @@ public class SXSSFCell extends CellBase {
                 ((RichTextValue) _value).setValue(value);
             }
         } else {
-            setCellType(CellType.BLANK);
+            setBlank();
         }
     }
 
@@ -311,7 +311,7 @@ public class SXSSFCell extends CellBase {
                 ((PlainStringValue) _value).setValue(value);
             }
         } else {
-            setCellType(CellType.BLANK);
+            setBlank();
         }
     }
 
index 66061f4c64647dfa4937b8068958db6f3a5e851a..a45ae4c6299f0542d4bfd01c75155655fd2f3de2 100644 (file)
@@ -431,7 +431,7 @@ public final class XSSFCell extends CellBase {
     @Override
     public void setCellValue(RichTextString str) {
         if(str == null || str.getString() == null){
-            setCellType(CellType.BLANK);
+            setBlank();
             return;
         }
 
@@ -830,7 +830,7 @@ public final class XSSFCell extends CellBase {
     @Override
     public void setCellValue(Date value) {
         if(value == null) {
-            setCellType(CellType.BLANK);
+            setBlank();
             return;
         }
 
@@ -857,7 +857,7 @@ public final class XSSFCell extends CellBase {
     @Override
     public void setCellValue(Calendar value) {
         if(value == null) {
-            setCellType(CellType.BLANK);
+            setBlank();
             return;
         }
 
index d95decccef38602d1ec92858ef1229ea87cdb3ae..8f3e411644ea7e468228ae7eb54317047b2bf739 100644 (file)
@@ -3993,7 +3993,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet  {
                 arrayFormulas.remove(range);
                 CellRange<XSSFCell> cr = getCellRange(range);
                 for (XSSFCell c : cr) {
-                    c.setCellType(CellType.BLANK);
+                    c.setBlank();
                 }
                 return cr;
             }
index 16a21f0d6af66c4dc218df7b6e92fc5c91b71e37..de560ddd2e2e7f77916d0275d93287f21f84796e 100644 (file)
@@ -766,7 +766,7 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
             if (row != null) {
                 XSSFCell cell = row.getCell(cellRef.getCol());
                 if (cell != null) {
-                    cell.setCellType(CellType.BLANK);
+                    cell.setBlank();
                     cell.setCellStyle(null);
                 }
             }
index 8ecbce0544da3397f0209be22af69d98caf535c5..e696378667341ac6afe5705e2170027002383c67 100644 (file)
@@ -154,7 +154,7 @@ public class TestSXSSFCell extends BaseTestXCell {
      */
     @Override
     @Ignore
-    public void setCellType_BLANK_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() {
+    public void setBlank_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() {
     }
 
     /**
@@ -164,7 +164,7 @@ public class TestSXSSFCell extends BaseTestXCell {
     @Override
     @Ignore
     @Test // <- annotation is necessary to override expected exception
-    public void setCellType_BLANK_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
+    public void setBlank_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
     }
 
     @Override
index 610ac7b22fba12849de3c85060982024bf06dcbf..7ed41f9c6d745e6622506e674f3e587ee2207562 100644 (file)
@@ -637,7 +637,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
         validateCells(sheet);
         XSSFTestDataSamples.writeOutAndReadBack(wb1).close();
 
-        sheet.getRow(6).getCell(0).setCellType(CellType.BLANK); // go
+        sheet.getRow(6).getCell(0).setBlank(); // go
         XSSFTestDataSamples.writeOutAndReadBack(wb1).close();
 
         sheet.getRow(7).getCell(0).setCellValue((String) null); // go
index fd8a9c03a72affe86e1c8611bb78db1f1ca4bfcd..b061221fb497b4ea630d7267c0c9ff643e0fec9a 100644 (file)
@@ -204,7 +204,7 @@ public final class TestSharedFormulaRecord extends TestCase {
 
         assertEquals("A$1*2", sheet.getRow(ROW_IX).getCell(1).getCellFormula());
         cell = sheet.getRow(ROW_IX).getCell(1);
-        cell.setCellType(CellType.BLANK);
+        cell.setBlank();
         assertEquals(3, countSharedFormulas(sheet));
 
         wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
index b4200df08771d026a3be4cea40a342e2ee874771..5f37ad44fd5d8fa0942b751b92a3774ae73804bf 100644 (file)
@@ -436,7 +436,7 @@ public final class TestHSSFCell extends BaseTestCell {
         Row row = sheet.createRow(0);
         Cell cell = row.createCell(0);
 
-        cell.setCellType(CellType.BLANK);
+        cell.setBlank();
         assertNull(null, cell.getDateCellValue());
         assertFalse(cell.getBooleanCellValue());
         assertEquals("", cell.toString());
index db6d96c77ff2a736125fe665e1a797bc96943912..c2abe42e2402f046ea7c042d8c3d2e0a50c5f32d 100644 (file)
@@ -232,14 +232,14 @@ public class TestEvaluationCache extends TestCase {
                public void setCellValue(String cellRefText, double value) {
                        HSSFCell cell = getOrCreateCell(cellRefText);
                        // be sure to blank cell, in case it is currently a formula
-                       cell.setCellType(CellType.BLANK);
+                       cell.setBlank();
                        // otherwise this line will only set the formula cached result;
                        cell.setCellValue(value);
                        _evaluator.notifyUpdateCell(wrapCell(cell));
                }
                public void clearCell(String cellRefText) {
                        HSSFCell cell = getOrCreateCell(cellRefText);
-                       cell.setCellType(CellType.BLANK);
+                       cell.setBlank();
                        _evaluator.notifyUpdateCell(wrapCell(cell));
                }
 
@@ -606,7 +606,7 @@ public class TestEvaluationCache extends TestCase {
                cv = fe.evaluate(cellA1);
                assertEquals(3.7, cv.getNumberValue(), 0.0);
 
-               cellB1.setCellType(CellType.BLANK);
+               cellB1.setBlank();
                fe.notifyUpdateCell(cellB1);
                cv = fe.evaluate(cellA1); // B1 was used to evaluate A1
                assertEquals(2.2, cv.getNumberValue(), 0.0);
index 206d17016dcd32b1ca23121585109ce3bd1dd4b9..5a922080c0d3b1b86f3b328a986106366f198b85 100644 (file)
@@ -119,7 +119,7 @@ public class TestRandBetween extends TestCase {
        public void testRandBetweenTopBlank() {
 
                bottomValueCell.setCellValue(-1);               
-               topValueCell.setCellType(CellType.BLANK);
+               topValueCell.setBlank();
                formulaCell.setCellFormula("RANDBETWEEN($A$1,$B$1)");
                evaluator.clearAllCachedResultValues();
                evaluator.evaluateFormulaCell(formulaCell);
@@ -174,7 +174,7 @@ public class TestRandBetween extends TestCase {
                assertEquals(CellType.ERROR, formulaCell.getCachedFormulaResultType());
                assertEquals(ErrorEval.NUM_ERROR.getErrorCode(), formulaCell.getErrorCellValue());              
                bottomValueCell.setCellValue(1);                
-               topValueCell.setCellType(CellType.BLANK);
+               topValueCell.setBlank();
                formulaCell.setCellFormula("RANDBETWEEN($A$1,$B$1)");
                evaluator.clearAllCachedResultValues();
                evaluator.evaluateFormulaCell(formulaCell);
index 94a003dcb150349263d1b3cfc79a5d23cddb3708..3190c62f03f8bd3c1009e12dfcee5b527520c400 100644 (file)
@@ -642,7 +642,7 @@ public abstract class BaseTestCell {
     }
 
     /**
-     *  Make sure that cell.setCellType(CellType.BLANK) preserves the cell style
+     *  Make sure that cell.setBlank() preserves the cell style
      */
     @Test
     public void testSetBlank_bug47028() throws Exception {
@@ -651,7 +651,7 @@ public abstract class BaseTestCell {
         Cell cell = wb.createSheet("Sheet1").createRow(0).createCell(0);
         cell.setCellStyle(style);
         int i1 = cell.getCellStyle().getIndex();
-        cell.setCellType(CellType.BLANK);
+        cell.setBlank();
         int i2 = cell.getCellStyle().getIndex();
         assertEquals(i1, i2);
         wb.close();
@@ -1219,7 +1219,7 @@ public abstract class BaseTestCell {
 
 
     @Test
-    public void setCellType_BLANK_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() {
+    public void setBlank_removesArrayFormula_ifCellIsPartOfAnArrayFormulaGroupContainingOnlyThisCell() {
         Cell cell = getInstance();
 
         cell.getSheet().setArrayFormula("1", CellRangeAddress.valueOf("A1"));
@@ -1227,18 +1227,18 @@ public abstract class BaseTestCell {
         assertTrue(cell.isPartOfArrayFormulaGroup());
         assertEquals("1", cell.getCellFormula());
 
-        cell.setCellType(CellType.BLANK);
+        cell.setBlank();
 
         assertEquals(CellType.BLANK, cell.getCellType());
         assertFalse(cell.isPartOfArrayFormulaGroup());
     }
 
     @Test(expected = IllegalStateException.class)
-    public void setCellType_BLANK_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
+    public void setBlank_throwsISE_ifCellIsPartOfAnArrayFormulaGroupContainingOtherCells() {
         Cell cell = getInstance();
         cell.getSheet().setArrayFormula("1", CellRangeAddress.valueOf("A1:B1"));
         cell.setCellValue("foo");
-        cell.setCellType(CellType.BLANK);
+        cell.setBlank();
     }
 
     @Test(expected = IllegalStateException.class)