* setCellValue(boolean) straight afterwards. This method only exists to give
* the cell a somewhat reasonable value until the setCellValue() call (if at all).
* TODO - perhaps a method like setCellTypeAndValue(int, Object) should be introduced to avoid this
+ * @throws IllegalStateException if cell type cannot be converted to boolean
*/
private boolean convertCellValueToBoolean() {
case BLANK:
return false;
}
- throw new RuntimeException("Unexpected cell type (" + _cellType + ")");
+ throw new IllegalStateException("Unexpected cell type (" + _cellType + ")");
}
+
private String convertCellValueToString() {
switch (_cellType) {
}
}
}
+
//COPIED FROM https://svn.apache.org/repos/asf/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java since the functions are declared private there
/**
* Used to help format error messages
*/
- private static RuntimeException typeMismatch(CellType expectedTypeCode, CellType actualTypeCode, boolean isFormulaCell) {
+ private static IllegalStateException typeMismatch(CellType expectedTypeCode, CellType actualTypeCode, boolean isFormulaCell) {
String msg = "Cannot get a " + expectedTypeCode + " value from a " + actualTypeCode
+ " " + (isFormulaCell ? "formula " : "") + "cell";
return new IllegalStateException(msg);
case ERROR:
case BLANK:
return false;
- default: throw new RuntimeException("Unexpected cell type (" + cellType + ")");
+ default:
+ throw new IllegalStateException("Unexpected cell type (" + cellType + ")");
}
}
* setCellValue(boolean) straight afterwards. This method only exists to give
* the cell a somewhat reasonable value until the setCellValue() call (if at all).
* TODO - perhaps a method like setCellTypeAndValue(CellType, Object) should be introduced to avoid this
+ *
+ * @throws IllegalStateException if cell type cannot be converted to boolean
*/
private boolean convertCellValueToBoolean() {
CellType cellType = getCellType();
return false;
default:
- throw new RuntimeException("Unexpected cell type (" + cellType + ")");
+ throw new IllegalStateException("Unexpected cell type (" + cellType + ")");
}
}