diff --git a/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java b/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java index 2c71372ee9..67beb21207 100644 --- a/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java +++ b/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java @@ -1037,11 +1037,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord { final UnsynchronizedByteArrayOutputStream buffer = UnsynchronizedByteArrayOutputStream.builder().get(); void addBytes(byte[] data) { - try { - buffer.write(data); - } catch (IOException e) { - throw new IllegalStateException("Couldn't get data from drawing/continue records", e); - } + buffer.write(data); } @Override diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java b/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java index 12854be920..8d07fc4d0e 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestDrawingAggregate.java @@ -118,11 +118,7 @@ class TestDrawingAggregate { UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get(); for (RecordBase rb : aggRecords) { Record r = (org.apache.poi.hssf.record.Record) rb; - try { - out.write(r.serialize()); - } catch (IOException e) { - throw new RuntimeException(e); - } + out.write(r.serialize()); } return out.toByteArray(); } @@ -263,11 +259,7 @@ class TestDrawingAggregate { UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get(); for (RecordBase rb : records) { Record r = (org.apache.poi.hssf.record.Record) rb; - try { - out.write(r.serialize()); - } catch (IOException e) { - throw new RuntimeException(e); - } + out.write(r.serialize()); } return out.toByteArray(); } diff --git a/poi/src/test/java/org/apache/poi/hssf/model/TestEscherRecordFactory.java b/poi/src/test/java/org/apache/poi/hssf/model/TestEscherRecordFactory.java index 091802098c..f641b6eeb3 100644 --- a/poi/src/test/java/org/apache/poi/hssf/model/TestEscherRecordFactory.java +++ b/poi/src/test/java/org/apache/poi/hssf/model/TestEscherRecordFactory.java @@ -42,11 +42,7 @@ class TestEscherRecordFactory { UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get(); for (RecordBase rb : records) { Record r = (org.apache.poi.hssf.record.Record) rb; - try { - out.write(r.serialize()); - } catch (IOException e) { - throw new RuntimeException(e); - } + out.write(r.serialize()); } return out.toByteArray(); } diff --git a/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactory.java b/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactory.java index a44cce0e42..fb3f44eb6c 100644 --- a/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactory.java +++ b/poi/src/test/java/org/apache/poi/hssf/record/TestRecordFactory.java @@ -211,11 +211,7 @@ final class TestRecordFactory { }; UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get(); for (org.apache.poi.hssf.record.Record rec : recs) { - try { - baos.write(rec.serialize()); - } catch (IOException e) { - throw new RuntimeException(e); - } + baos.write(rec.serialize()); } //simulate the bad padding at the end of the workbook stream in attachment 23483 of bug 46987 baos.write(0x00);