diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java b/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
index f78d307ade..625897d532 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java
@@ -259,6 +259,8 @@ public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
case HSSFWorkbook.PICTURE_TYPE_PICT:
ftCf.setFlags(FtCfSubRecord.BITMAP_BIT);
break;
+ default:
+ throw new IllegalStateException("Invalid picture type: " + pictData.getFormat());
}
obj.addSubRecord(ftCf);
// FtPioGrbit (pictFlags)
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java
index ef1b13b22d..772ee5821d 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeFactory.java
@@ -66,6 +66,8 @@ public class HSSFShapeFactory {
case EscherTextboxRecord.RECORD_ID:
txtRecord = (TextObjectRecord) shapeToObj.get(record);
break;
+ default:
+ break;
}
}
if (isEmbeddedObject(objRecord)) {
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
index f97b23a8c0..9e339c7c1c 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java
@@ -49,6 +49,8 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
case EscherChildAnchorRecord.RECORD_ID:
anchor = new HSSFChildAnchor((EscherChildAnchorRecord) ch);
break;
+ default:
+ break;
}
}
}
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
index 9c080cac17..9844b98c51 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
@@ -1736,6 +1736,12 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
* @param format The format of the picture. One of PICTURE_TYPE_*
*
* @return the index to this picture (1 based).
+ * @see #PICTURE_TYPE_WMF
+ * @see #PICTURE_TYPE_EMF
+ * @see #PICTURE_TYPE_PICT
+ * @see #PICTURE_TYPE_PNG
+ * @see #PICTURE_TYPE_JPEG
+ * @see #PICTURE_TYPE_DIB
*/
@Override
public int addPicture(byte[] pictureData, int format)
@@ -1792,12 +1798,14 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
case PICTURE_TYPE_PNG:
blipRecord.setOptions(HSSFPictureData.MSOBI_PNG);
break;
- case HSSFWorkbook.PICTURE_TYPE_JPEG:
+ case PICTURE_TYPE_JPEG:
blipRecord.setOptions(HSSFPictureData.MSOBI_JPEG);
break;
- case HSSFWorkbook.PICTURE_TYPE_DIB:
+ case PICTURE_TYPE_DIB:
blipRecord.setOptions(HSSFPictureData.MSOBI_DIB);
break;
+ default:
+ throw new IllegalStateException("Unexpected picture format: " + format);
}
EscherBSERecord r = new EscherBSERecord();
diff --git a/src/java/org/apache/poi/ss/formula/functions/FinanceFunction.java b/src/java/org/apache/poi/ss/formula/functions/FinanceFunction.java
index ac379c840e..c34b2f6228 100644
--- a/src/java/org/apache/poi/ss/formula/functions/FinanceFunction.java
+++ b/src/java/org/apache/poi/ss/formula/functions/FinanceFunction.java
@@ -82,8 +82,9 @@ public abstract class FinanceFunction implements Function3Arg, Function4Arg {
}
return evaluate(srcRowIndex, srcColumnIndex, args[0], args[1], args[2], arg3, arg4);
}
+ default:
+ return ErrorEval.VALUE_INVALID;
}
- return ErrorEval.VALUE_INVALID;
}
protected double evaluate(double[] ds) throws EvaluationException {
diff --git a/src/java/org/apache/poi/ss/formula/functions/Offset.java b/src/java/org/apache/poi/ss/formula/functions/Offset.java
index cffa26a4c4..8877f2410f 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Offset.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Offset.java
@@ -179,10 +179,16 @@ public final class Offset implements Function {
if(!(args[4] instanceof MissingArgEval)) {
width = evaluateIntArg(args[4], srcCellRow, srcCellCol);
}
+ // fall-through to pick up height
case 4:
if(!(args[3] instanceof MissingArgEval)) {
height = evaluateIntArg(args[3], srcCellRow, srcCellCol);
}
+ break;
+ //case 3:
+ // nothing to do
+ default:
+ break;
}
// Zero height or width raises #REF! error
if(height == 0 || width == 0) {
diff --git a/src/java/org/apache/poi/util/HexDump.java b/src/java/org/apache/poi/util/HexDump.java
index d134b540f1..2e3a45f526 100644
--- a/src/java/org/apache/poi/util/HexDump.java
+++ b/src/java/org/apache/poi/util/HexDump.java
@@ -172,10 +172,13 @@ public class HexDump {
if (Character.isISOControl(charB)) return '.';
switch (charB) {
- // printable, but not compilable with current compiler encoding
- case 0xFF: case 0xDD:
- charB = '.';
- break;
+ // printable, but not compilable with current compiler encoding
+ case 0xFF:
+ case 0xDD:
+ charB = '.';
+ break;
+ default:
+ break;
}
return charB;
}
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
index 77e99d2d39..0e9e741b3b 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
@@ -110,6 +110,8 @@ public class XSLFFreeformShape extends XSLFAutoShape
numPoints++;
ctPath.addNewClose();
break;
+ default:
+ throw new IllegalStateException("Unrecognized path segment type: " + type);
}
it.next();
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
index 992dc07918..7418d7b9ad 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
@@ -213,6 +213,8 @@ public class SheetDataWriter {
_out.write("" + nval + "");
}
break;
+ default:
+ break;
}
break;
}
@@ -255,7 +257,7 @@ public class SheetDataWriter {
break;
}
default: {
- throw new RuntimeException("Huh?");
+ throw new IllegalStateException("Invalid cell type: " + cellType);
}
}
_out.write("");
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
index 2e9c842ed4..8b5dc413b1 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
@@ -505,6 +505,8 @@ public class XSSFFont implements Font {
case Font.SS_SUPER:
offsetProperty.setVal(STVerticalAlignRun.SUPERSCRIPT);
break;
+ default:
+ throw new IllegalStateException("Invalid type offset: " + offset);
}
}
}
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
index 713a7d9015..03199b330e 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
@@ -160,6 +160,8 @@ public final class FileInformationBlock implements Cloneable
case 0x0112:
assertCbRgFcLcb( "0x0112", 0x00B7, "0x00B7", _cbRgFcLcb );
break;
+ default:
+ throw new IllegalStateException("Invalid file format version number: " + getNFib());
}
}
@@ -194,6 +196,8 @@ public final class FileInformationBlock implements Cloneable
case 0x0112:
assertCswNew( "0x0112", 0x0005, "0x0005", _cswNew );
break;
+ default:
+ throw new IllegalStateException("Invalid file format version number: " + getNFib());
}
}