aboutsummaryrefslogtreecommitdiffstats
path: root/poi-scratchpad
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-09-14 01:12:38 +0000
committerPJ Fanning <fanningpj@apache.org>2022-09-14 01:12:38 +0000
commit59b16f025bf98cd411482243aa3601bdb8dbc722 (patch)
tree77217494fa4a69d40358ef3b5c1d21c2c10d40be /poi-scratchpad
parent34601b5377387e293868937bfa8f7e4cb4d45573 (diff)
downloadpoi-59b16f025bf98cd411482243aa3601bdb8dbc722.tar.gz
poi-59b16f025bf98cd411482243aa3601bdb8dbc722.zip
try to use IllegalStateException instead of RuntimeException
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1904050 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad')
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java9
-rw-r--r--poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java4
2 files changed, 9 insertions, 4 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java
index e764e78a1e..6afb53cdd3 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusImage.java
@@ -447,6 +447,11 @@ public class HemfPlusImage {
return new Rectangle2D.Double(1,1,1,1);
}
+ /**
+ * @param continuedObjectData list of object data
+ * @return byte array
+ * @throws IllegalStateException if the data cannot be read
+ */
public byte[] getRawData(List<? extends EmfPlusObjectData> continuedObjectData) {
try (UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()) {
bos.write(getImageData());
@@ -457,7 +462,7 @@ public class HemfPlusImage {
}
return bos.toByteArray();
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
@@ -491,7 +496,7 @@ public class HemfPlusImage {
private HemfPlusGDIImageRenderer getGDIRenderer() {
if (getImageDataType() != EmfPlusImageDataType.BITMAP || getBitmapType() != EmfPlusBitmapDataType.PIXEL) {
- throw new RuntimeException("image data is not a GDI image");
+ throw new IllegalStateException("image data is not a GDI image");
}
HemfPlusGDIImageRenderer renderer = new HemfPlusGDIImageRenderer();
renderer.setWidth(getBitmapWidth());
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java
index 42dd6e44e6..2f6085f391 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPen.java
@@ -474,7 +474,7 @@ public class HemfPlusPen {
// A 32-bit unsigned integer that specifies the number of elements in the DashedLineData field.
int dashesSize = leis.readInt();
if (dashesSize < 0 || dashesSize > 1000) {
- throw new RuntimeException("Invalid dash data size");
+ throw new IllegalStateException("Invalid dash data size");
}
// An array of DashedLineDataSize floating-point values that specify the lengths of the dashes and spaces in a dashed line.
@@ -499,7 +499,7 @@ public class HemfPlusPen {
// A 32-bit unsigned integer that specifies the number of elements in the CompoundLineData field.
int compoundSize = leis.readInt();
if (compoundSize < 0 || compoundSize > 1000) {
- throw new RuntimeException("Invalid compound line data size");
+ throw new IllegalStateException("Invalid compound line data size");
}
// An array of CompoundLineDataSize floating-point values that specify the compound line of a pen.