File tree 2 files changed +6
-11
lines changed
src/test/java/com/github/pjfanning/xlsx
2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ public static SXSSFWorkbook copyToSXSSF(final InputStream inputStream) throws Ex
42
42
*/
43
43
}
44
44
} catch (Exception e ) {
45
- sxssfWorkbook .dispose ();
45
+ // since POI 5.3.0, you no longer need to call dispose() on SXSSFWorkbook
46
+ sxssfWorkbook .close ();
46
47
throw e ;
47
48
}
48
49
return sxssfWorkbook ;
Original file line number Diff line number Diff line change @@ -1573,12 +1573,9 @@ public void copyToSXSSF() throws Exception {
1573
1573
InputStream inputStream = new FileInputStream ("src/test/resources/stream_reader_test.xlsx" );
1574
1574
UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream .builder ().get ()
1575
1575
) {
1576
- SXSSFWorkbook wbOutput = CopyToSXSSFUtil . copyToSXSSF ( inputStream );
1577
- try {
1576
+ // since POI 5.3.0, you no longer need to call dispose() on SXSSFWorkbook
1577
+ try ( SXSSFWorkbook wbOutput = CopyToSXSSFUtil . copyToSXSSF ( inputStream )) {
1578
1578
wbOutput .write (bos );
1579
- } finally {
1580
- wbOutput .close ();
1581
- wbOutput .dispose ();
1582
1579
}
1583
1580
1584
1581
try (XSSFWorkbook xssfWorkbook = new XSSFWorkbook (bos .toInputStream ())) {
@@ -1624,12 +1621,9 @@ public void copyToSXSSFWithHyperlinks() throws Exception {
1624
1621
InputStream inputStream = new FileInputStream ("src/test/resources/59775.xlsx" );
1625
1622
UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream .builder ().get ()
1626
1623
) {
1627
- SXSSFWorkbook wbOutput = CopyToSXSSFUtil . copyToSXSSF ( inputStream );
1628
- try {
1624
+ // since POI 5.3.0, you no longer need to call dispose() on SXSSFWorkbook
1625
+ try ( SXSSFWorkbook wbOutput = CopyToSXSSFUtil . copyToSXSSF ( inputStream )) {
1629
1626
wbOutput .write (bos );
1630
- } finally {
1631
- wbOutput .close ();
1632
- wbOutput .dispose ();
1633
1627
}
1634
1628
1635
1629
try (XSSFWorkbook xssfWorkbook = new XSSFWorkbook (bos .toInputStream ())) {
You can’t perform that action at this time.
0 commit comments