]> source.dussan.org Git - poi.git/commitdiff
declare methods throw runtime exceptions for IDE hints
authorJaven O'Neal <onealj@apache.org>
Wed, 14 Sep 2016 21:44:06 +0000 (21:44 +0000)
committerJaven O'Neal <onealj@apache.org>
Wed, 14 Sep 2016 21:44:06 +0000 (21:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1760798 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java

index 7d2d6d25b8f700eb87fe78081d4d08ba911e3cc3..c7932d167b633ec63be7e6569a41b04b135aaf87 100644 (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);
+        }
     }
 
     /**