mirror of https://github.com/apache/poi.git
purged calls to cell.setCellType(CellType.BLANK) from the project, replaced with setBlank()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1852245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d60cb3a18c
commit
19bf8b23d5
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue