Browse Source

declare methods throw runtime exceptions for IDE hints

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1760798 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_15_FINAL^2
Javen O'Neal 7 years ago
parent
commit
c9f8d51f5c
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java

+ 7
- 4
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java View File

@@ -827,7 +827,7 @@ public final class XSSFCell implements Cell {
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} isn't {@link CellType#ERROR}
* @see FormulaError
*/
public String getErrorCellString() {
public String getErrorCellString() throws IllegalStateException {
CellType cellType = getBaseCellType(true);
if(cellType != CellType.ERROR) throw typeMismatch(CellType.ERROR, cellType, false);

@@ -845,13 +845,16 @@ public final class XSSFCell implements Cell {
* @see FormulaError
*/
@Override
public byte getErrorCellValue() {
public byte getErrorCellValue() throws IllegalStateException {
String code = getErrorCellString();
if (code == null) {
return 0;
}

return FormulaError.forString(code).getCode();
try {
return FormulaError.forString(code).getCode();
} catch (final IllegalArgumentException e) {
throw new IllegalStateException("Unexpected error code", e);
}
}

/**

Loading…
Cancel
Save