diff options
author | Dominik Stadler <centic@apache.org> | 2023-06-08 08:53:08 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-06-08 08:53:08 +0000 |
commit | d3e35e740a593027a1105e6509c0aadaa54399b0 (patch) | |
tree | 4f9c5b276aa7a088def6aaa7282bb37c39b16105 /poi-integration/src/test/java | |
parent | c8f9fe4c2c01aa896c80de7b43725788b4ce6c4a (diff) | |
download | poi-d3e35e740a593027a1105e6509c0aadaa54399b0.tar.gz poi-d3e35e740a593027a1105e6509c0aadaa54399b0.zip |
Remove deprecation warnings reported with newer commons-io
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1910300 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-integration/src/test/java')
5 files changed, 8 insertions, 8 deletions
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/POIFSFileHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/POIFSFileHandler.java index 5dd01bdff5..14b26c395d 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/POIFSFileHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/POIFSFileHandler.java @@ -57,7 +57,7 @@ public class POIFSFileHandler extends AbstractFileHandler { } protected void handlePOIDocument(POIDocument doc) throws Exception { - try (UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream()) { + try (UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get()) { doc.write(out); try (InputStream in = out.toInputStream(); diff --git a/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java index ec291e1c0b..305793cd1e 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java @@ -49,7 +49,7 @@ public abstract class SlideShowHandler extends POIFSFileHandler { readPictures(ss); // write out the file - UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream(); + UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get(); ss.write(out); readContent(ss); diff --git a/poi-integration/src/test/java/org/apache/poi/stress/SpreadsheetHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/SpreadsheetHandler.java index 50212654c9..1e57bb856a 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/SpreadsheetHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/SpreadsheetHandler.java @@ -61,7 +61,7 @@ public abstract class SpreadsheetHandler extends AbstractFileHandler { } private UnsynchronizedByteArrayOutputStream writeToArray(Workbook wb) throws IOException { - UnsynchronizedByteArrayOutputStream stream = new UnsynchronizedByteArrayOutputStream(); + UnsynchronizedByteArrayOutputStream stream = UnsynchronizedByteArrayOutputStream.builder().get(); wb.write(stream); return stream; } diff --git a/poi-integration/src/test/java/org/apache/poi/stress/XSSFBFileHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/XSSFBFileHandler.java index f60752d6dd..fb130b9d72 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/XSSFBFileHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/XSSFBFileHandler.java @@ -41,11 +41,11 @@ public class XSSFBFileHandler extends AbstractFileHandler { public void handleFile(InputStream stream, String path) throws Exception { byte[] bytes = IOUtils.toByteArray(stream); - try (OPCPackage opcPackage = OPCPackage.open(new UnsynchronizedByteArrayInputStream(bytes))) { + try (OPCPackage opcPackage = OPCPackage.open(UnsynchronizedByteArrayInputStream.builder().setByteArray(bytes).get())) { testOne(opcPackage); } - testNotHandledByWorkbookException(OPCPackage.open(new UnsynchronizedByteArrayInputStream(bytes))); + testNotHandledByWorkbookException(OPCPackage.open(UnsynchronizedByteArrayInputStream.builder().setByteArray(bytes).get())); } private void testNotHandledByWorkbookException(OPCPackage pkg) throws IOException { diff --git a/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java index 314d5ed985..160d7059a2 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/XSSFFileHandler.java @@ -16,7 +16,6 @@ ==================================================================== */ package org.apache.poi.stress; -import static org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM; import static org.apache.poi.xssf.XSSFTestDataSamples.getSampleFile; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -36,6 +35,7 @@ import java.util.Set; import javax.xml.transform.TransformerException; +import org.apache.commons.io.output.NullOutputStream; import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream; import org.apache.poi.EncryptedDocumentException; import org.apache.poi.examples.ss.ExcelComparator; @@ -72,7 +72,7 @@ public class XSSFFileHandler extends SpreadsheetHandler { // make sure the potentially large byte-array is freed up quickly again { - UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream(); + UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get(); IOUtils.copy(stream, out); if (pass != null) { @@ -156,7 +156,7 @@ public class XSSFFileHandler extends SpreadsheetHandler { TransformerException { for (XSSFMap map : wb.getCustomXMLMappings()) { XSSFExportToXml exporter = new XSSFExportToXml(map); - exporter.exportToXML(NULL_OUTPUT_STREAM, true); + exporter.exportToXML(NullOutputStream.INSTANCE, true); } } |