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
This commit is contained in:
Javen O'Neal 2016-09-14 21:44:06 +00:00
parent 91f2d5680e
commit 1de973e2a7

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} * @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} isn't {@link CellType#ERROR}
* @see FormulaError * @see FormulaError
*/ */
public String getErrorCellString() { public String getErrorCellString() throws IllegalStateException {
CellType cellType = getBaseCellType(true); CellType cellType = getBaseCellType(true);
if(cellType != CellType.ERROR) throw typeMismatch(CellType.ERROR, cellType, false); if(cellType != CellType.ERROR) throw typeMismatch(CellType.ERROR, cellType, false);
@ -845,13 +845,16 @@ public final class XSSFCell implements Cell {
* @see FormulaError * @see FormulaError
*/ */
@Override @Override
public byte getErrorCellValue() { public byte getErrorCellValue() throws IllegalStateException {
String code = getErrorCellString(); String code = getErrorCellString();
if (code == null) { if (code == null) {
return 0; return 0;
} }
try {
return FormulaError.forString(code).getCode(); return FormulaError.forString(code).getCode();
} catch (final IllegalArgumentException e) {
throw new IllegalStateException("Unexpected error code", e);
}
} }
/** /**