aboutsummaryrefslogtreecommitdiffstats
path: root/poi-scratchpad/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'poi-scratchpad/src/test')
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hdgf/dev/TestVSDDumper.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hemf/usermodel/TestHemfPicture.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hmef/TestHMEFMessage.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hmef/dev/TestHMEFDumper.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/HSLFTestDataSamples.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWrite.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWriteSanity.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSLWTListing.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestMovieShape.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestOleEmbedding.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestAnimationInfoAtom.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCString.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestColorSchemeAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000Atom.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCurrentUserAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentEncryption.java8
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExControl.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlink.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlinkAtom.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExMediaAtom.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExObjListAtom.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjAtom.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjStg.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExVideoContainer.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestFontCollection.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersAtom.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersContainer.java8
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfo.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestNotesAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlideAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlidePersistAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestStyleTextPropAtom.java10
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextBytesAtom.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextCharsAtom.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextHeaderAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextRulerAtom.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java6
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestUserEditAtom.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestHSLFSlideShow.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestPictures.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestRichTextRun.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestExtractEmbeddedMSG.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileWithAttachmentsRead.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFixedSizedProperties.java4
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestCase.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestDataSamples.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hwpf/dev/TestHWPFLister.java2
-rw-r--r--poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java2
54 files changed, 101 insertions, 101 deletions
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hdgf/dev/TestVSDDumper.java b/poi-scratchpad/src/test/java/org/apache/poi/hdgf/dev/TestVSDDumper.java
index 6a1a830a0b..a192125081 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hdgf/dev/TestVSDDumper.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hdgf/dev/TestVSDDumper.java
@@ -33,7 +33,7 @@ public class TestVSDDumper {
@Test
void main() {
PrintStream oldStdOut = System.out;
- System.setOut(new NullPrintStream());
+ System.setOut(NullPrintStream.INSTANCE);
try {
File file = POIDataSamples.getDiagramInstance().getFile("Test_Visio-Some_Random_Text.vsd");
String[] args = { file.getAbsolutePath() };
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hemf/usermodel/TestHemfPicture.java b/poi-scratchpad/src/test/java/org/apache/poi/hemf/usermodel/TestHemfPicture.java
index 1fbc303d78..22740b0cf6 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hemf/usermodel/TestHemfPicture.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hemf/usermodel/TestHemfPicture.java
@@ -221,7 +221,7 @@ public class TestHemfPicture {
@Test
void testInfiniteLoopOnByteArray() throws Exception {
try (InputStream is = ss_samples.openResourceAsStream("61294.emf")) {
- UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream.builder().get();
IOUtils.copy(is, bos);
HemfPicture pic = new HemfPicture(bos.toInputStream());
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hmef/TestHMEFMessage.java b/poi-scratchpad/src/test/java/org/apache/poi/hmef/TestHMEFMessage.java
index 5717e5157d..5a12ac6426 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hmef/TestHMEFMessage.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hmef/TestHMEFMessage.java
@@ -169,7 +169,7 @@ public final class TestHMEFMessage {
@Test
void testNoData() throws Exception {
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
// Header
LittleEndian.putInt(HMEFMessage.HEADER_SIGNATURE, out);
@@ -184,7 +184,7 @@ public final class TestHMEFMessage {
@Test
void testInvalidLevel() throws Exception {
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
// Header
LittleEndian.putInt(HMEFMessage.HEADER_SIGNATURE, out);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hmef/dev/TestHMEFDumper.java b/poi-scratchpad/src/test/java/org/apache/poi/hmef/dev/TestHMEFDumper.java
index 49ef65cb83..df27e801a6 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hmef/dev/TestHMEFDumper.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hmef/dev/TestHMEFDumper.java
@@ -52,7 +52,7 @@ public class TestHMEFDumper {
private static void doMain(String... args) throws Exception {
PrintStream ps = System.out;
try {
- System.setOut(new NullPrintStream());
+ System.setOut(NullPrintStream.INSTANCE);
HMEFDumper.main(args);
} finally {
System.setOut(ps);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java b/poi-scratchpad/src/test/java/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java
index 81912bbba5..9f41088668 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hmef/extractor/TestHMEFContentsExtractor.java
@@ -62,7 +62,7 @@ public class TestHMEFContentsExtractor {
POIDataSamples samples = POIDataSamples.getHMEFInstance();
File winmailTNEFFile = samples.getFile("quick-winmail.dat");
HMEFContentsExtractor extractor = new HMEFContentsExtractor(winmailTNEFFile);
- try (UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream()) {
+ try (UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get()) {
extractor.extractMessageBody(out);
assertTrue(out.size() > 0);
byte[] expectedMagic = new byte[]{'{', '\\', 'r', 't', 'f'};
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/HSLFTestDataSamples.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/HSLFTestDataSamples.java
index 881d543b0d..39d5a32482 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/HSLFTestDataSamples.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/HSLFTestDataSamples.java
@@ -54,7 +54,7 @@ public class HSLFTestDataSamples {
* Useful for verifying that the serialisation round trip
*/
public static HSLFSlideShowImpl writeOutAndReadBack(HSLFSlideShowImpl original) {
- try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
+ try (UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get()) {
original.write(baos);
try (InputStream is = baos.toInputStream()) {
return new HSLFSlideShowImpl(is);
@@ -70,7 +70,7 @@ public class HSLFTestDataSamples {
* Useful for verifying that the serialisation round trip
*/
public static HSLFSlideShow writeOutAndReadBack(HSLFSlideShow original) {
- try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream(4096)) {
+ try (UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().setBufferSize(4096).get()) {
original.write(baos);
return new HSLFSlideShow(baos.toInputStream());
} catch (IOException e) {
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWrite.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWrite.java
index 687888a69a..48e2666aa1 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWrite.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWrite.java
@@ -55,7 +55,7 @@ public final class TestReWrite {
HSLFSlideShowImpl hss = new HSLFSlideShowImpl(pfs)) {
// Write out to a byte array, and to a temp file
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
hss.write(baos);
final File file = TempFile.createTempFile("TestHSLF", ".ppt");
@@ -95,7 +95,7 @@ public final class TestReWrite {
assertNotNull(pfsC.getRoot().getEntry("Macros"));
// Write out normally, will loose the macro stream
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
hssC.write(baos);
try (POIFSFileSystem pfsNew = new POIFSFileSystem(baos.toInputStream())) {
assertFalse(pfsNew.getRoot().hasEntry("Macros"));
@@ -134,7 +134,7 @@ public final class TestReWrite {
assertDoesNotThrow(ss::getNotes);
// Now write out to a byte array
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
hss.write(baos);
// Use POIFS to query that lot
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWriteSanity.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWriteSanity.java
index b2991c1533..dbf1866da2 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWriteSanity.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestReWriteSanity.java
@@ -18,7 +18,6 @@
package org.apache.poi.hslf;
-import static org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM;
import static org.apache.poi.POITestCase.assertContains;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -26,6 +25,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.output.CountingOutputStream;
+import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import org.apache.poi.POIDataSamples;
import org.apache.poi.hslf.record.CurrentUserAtom;
@@ -64,7 +64,7 @@ public final class TestReWriteSanity {
@Test
void testUserEditAtomsRight() throws Exception {
// Write out to a byte array
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ss.write(baos);
// Create a new one from that
@@ -78,7 +78,7 @@ public final class TestReWriteSanity {
ue.put(0, 0); // Will show 0 if first
int lastUEPos = -1;
- CountingOutputStream cos = new CountingOutputStream(NULL_OUTPUT_STREAM);
+ CountingOutputStream cos = new CountingOutputStream(NullOutputStream.INSTANCE);
for (final Record rec : r) {
int pos = cos.getCount();
if (rec instanceof PersistPtrHolder) {
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java
index 4a0036b010..0ce99759c1 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java
@@ -79,7 +79,7 @@ public abstract class BaseTestPPTIterating {
IOUtils.setByteArrayMaxOverride(5*1024*1024);
// redirect standard out during the test to avoid spamming the console with output
- System.setOut(new NullPrintStream());
+ System.setOut(NullPrintStream.INSTANCE);
}
@AfterEach
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSLWTListing.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSLWTListing.java
index 3ac7adb84d..b828d4745d 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSLWTListing.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSLWTListing.java
@@ -34,7 +34,7 @@ public class TestSLWTListing extends BaseTestPPTIterating {
@BeforeAll
public static void muteStdErr() {
oldStdErr = System.err;
- System.setErr(new NullPrintStream());
+ System.setErr(NullPrintStream.INSTANCE);
}
@AfterAll
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestMovieShape.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestMovieShape.java
index 336f6bc4f2..982c870043 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestMovieShape.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestMovieShape.java
@@ -57,7 +57,7 @@ public final class TestMovieShape {
shape.setAutoPlay(false);
assertFalse(shape.isAutoPlay());
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
ppt.write(out);
ppt = new HSLFSlideShow(out.toInputStream());
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestOleEmbedding.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestOleEmbedding.java
index 1a443d1e18..059fffa299 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestOleEmbedding.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestOleEmbedding.java
@@ -145,7 +145,7 @@ public final class TestOleEmbedding {
slide2.addShape(oleShape2);
oleShape2.setAnchor(new Rectangle2D.Double(100,100,100,100));
- UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream.builder().get();
ppt.write(bos);
ppt = new HSLFSlideShow(bos.toInputStream());
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestAnimationInfoAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestAnimationInfoAtom.java
index dac20b569b..afb18e09fa 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestAnimationInfoAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestAnimationInfoAtom.java
@@ -65,7 +65,7 @@ public final class TestAnimationInfoAtom {
@Test
void testWrite() throws Exception {
AnimationInfoAtom record = new AnimationInfoAtom(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
byte[] b = baos.toByteArray();
@@ -81,7 +81,7 @@ public final class TestAnimationInfoAtom {
record.setFlag(AnimationInfoAtom.Play, true);
record.setFlag(AnimationInfoAtom.Synchronous, true);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
byte[] b = baos.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCString.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCString.java
index 57af6afcb5..db7e206541 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCString.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCString.java
@@ -70,13 +70,13 @@ public final class TestCString {
@Test
void testWrite() throws Exception {
CString ca = new CString(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ca.writeOut(baos);
byte[] b = baos.toByteArray();
assertArrayEquals(data_a, b);
CString cb = new CString(data_b, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baosB = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baosB = UnsynchronizedByteArrayOutputStream.builder().get();
cb.writeOut(baosB);
b = baosB.toByteArray();
assertArrayEquals(data_b, b);
@@ -99,7 +99,7 @@ public final class TestCString {
}
assertFalse(equals, "Arrays should not be equals");
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ca.writeOut(baos);
byte[] b = baos.toByteArray();
assertArrayEquals(data_b, b);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestColorSchemeAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestColorSchemeAtom.java
index 03d657a42f..d465118a33 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestColorSchemeAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestColorSchemeAtom.java
@@ -81,7 +81,7 @@ public final class TestColorSchemeAtom {
@Test
void testWrite() throws Exception {
ColorSchemeAtom csa = new ColorSchemeAtom(data_a,0,data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
csa.writeOut(baos);
byte[] b = baos.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000.java
index 32213d0e4d..3c94ef7319 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000.java
@@ -144,7 +144,7 @@ public final class TestComment2000 {
@Test
void testWrite() throws Exception {
Comment2000 ca = new Comment2000(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ca.writeOut(baos);
byte[] b = baos.toByteArray();
assertArrayEquals(data_a, b);
@@ -196,8 +196,8 @@ public final class TestComment2000 {
assertFalse(equals, "Arrays should not be equals");
// Check bytes are now the same
- UnsynchronizedByteArrayOutputStream baosa = new UnsynchronizedByteArrayOutputStream();
- UnsynchronizedByteArrayOutputStream baosn = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baosa = UnsynchronizedByteArrayOutputStream.builder().get();
+ UnsynchronizedByteArrayOutputStream baosn = UnsynchronizedByteArrayOutputStream.builder().get();
ca.writeOut(baosa);
cn.writeOut(baosn);
byte[] ba = baosa.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000Atom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000Atom.java
index 734f3b73ad..225d0b5e05 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000Atom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000Atom.java
@@ -106,7 +106,7 @@ public final class TestComment2000Atom {
@Test
void testWrite() throws Exception {
Comment2000Atom ca = new Comment2000Atom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ca.writeOut(baos);
byte[] b = baos.toByteArray();
assertArrayEquals(data_a, b);
@@ -127,7 +127,7 @@ public final class TestComment2000Atom {
a.setDate(date_a);
// Check it's now the same as a
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
a.writeOut(baos);
byte[] b = baos.toByteArray();
assertArrayEquals(data_a, b);
@@ -150,7 +150,7 @@ public final class TestComment2000Atom {
ca.setYOffset(0x0E);
// Check bytes are now the same
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ca.writeOut(baos);
byte[] b = baos.toByteArray();
assertArrayEquals(data_b, b);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCurrentUserAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCurrentUserAtom.java
index c8c0cc2eac..a1ee955fd3 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCurrentUserAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCurrentUserAtom.java
@@ -89,7 +89,7 @@ public final class TestCurrentUserAtom {
cu.setCurrentEditOffset(0x2942);
// Check it matches
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
cu.writeOut(baos);
byte[] out = baos.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentAtom.java
index 9cdf6f62c4..861f43ad85 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentAtom.java
@@ -81,7 +81,7 @@ public final class TestDocumentAtom {
@Test
void testWrite() throws Exception {
DocumentAtom da = new DocumentAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
da.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentEncryption.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentEncryption.java
index 26c00b64a1..926a3e3ede 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentEncryption.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentEncryption.java
@@ -87,7 +87,7 @@ public class TestDocumentEncryption {
EncryptionInfo ei = documentEncryptionAtom.getEncryptionInfo();
ei.getHeader().setKeySize(0x78);
- UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream.builder().get();
hss.write(bos);
try (POIFSFileSystem fs2 = new POIFSFileSystem(bos.toInputStream());
@@ -108,9 +108,9 @@ public class TestDocumentEncryption {
void cryptoAPIEncryption() throws Exception {
/* documents with multiple edits need to be normalized for encryption */
String pptFile = "57272_corrupted_usereditatom.ppt";
- UnsynchronizedByteArrayOutputStream encrypted = new UnsynchronizedByteArrayOutputStream();
- UnsynchronizedByteArrayOutputStream expected = new UnsynchronizedByteArrayOutputStream();
- UnsynchronizedByteArrayOutputStream actual = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream encrypted = UnsynchronizedByteArrayOutputStream.builder().get();
+ UnsynchronizedByteArrayOutputStream expected = UnsynchronizedByteArrayOutputStream.builder().get();
+ UnsynchronizedByteArrayOutputStream actual = UnsynchronizedByteArrayOutputStream.builder().get();
try {
try (POIFSFileSystem fs = new POIFSFileSystem(slTests.getFile(pptFile), true);
HSLFSlideShowImpl hss = new HSLFSlideShowImpl(fs)) {
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExControl.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExControl.java
index fc8c353e33..b8b8a44427 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExControl.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExControl.java
@@ -92,7 +92,7 @@ public final class TestExControl {
@Test
void testWrite() throws Exception {
ExControl record = new ExControl(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
@@ -115,7 +115,7 @@ public final class TestExControl {
record.setProgId("ShockwaveFlash.ShockwaveFlash.9");
record.setClipboardName("Shockwave Flash Object");
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlink.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlink.java
index d67a9db105..4eca038dcc 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlink.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlink.java
@@ -53,7 +53,7 @@ public final class TestExHyperlink {
assertEquals(expURL, exHyperlink._getDetailsA());
assertEquals(expURL, exHyperlink._getDetailsB());
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
exHyperlink.writeOut(baos);
assertArrayEquals(exHyperlinkBytes, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlinkAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlinkAtom.java
index f738f44ec8..a9d900f2c9 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlinkAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlinkAtom.java
@@ -56,7 +56,7 @@ public class TestExHyperlinkAtom {
@Test
void testWrite() throws Exception {
ExHyperlinkAtom eha = new ExHyperlinkAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
eha.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -70,7 +70,7 @@ public class TestExHyperlinkAtom {
eha.setNumber(1);
// Check it's now the same as a
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
eha.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -84,7 +84,7 @@ public class TestExHyperlinkAtom {
eha.setNumber(4);
// Check bytes are now the same
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
eha.writeOut(baos);
assertArrayEquals(data_b, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExMediaAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExMediaAtom.java
index 6d7e08c6a9..ff73e5b846 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExMediaAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExMediaAtom.java
@@ -49,7 +49,7 @@ public final class TestExMediaAtom {
@Test
void testWrite() throws Exception {
ExMediaAtom record = new ExMediaAtom(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
byte[] b = baos.toByteArray();
@@ -67,7 +67,7 @@ public final class TestExMediaAtom {
record.setFlag(HeadersFootersAtom.fHasTodayDate, false);
record.setFlag(HeadersFootersAtom.fHasFooter, false);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
byte[] b = baos.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExObjListAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExObjListAtom.java
index d8a5229aba..addc164d88 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExObjListAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExObjListAtom.java
@@ -56,7 +56,7 @@ public class TestExObjListAtom {
@Test
void testWrite() throws Exception {
ExObjListAtom eoa = new ExObjListAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
eoa.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -70,7 +70,7 @@ public class TestExObjListAtom {
eoa.setObjectIDSeed(1);
// Check it's now the same as a
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
eoa.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -84,7 +84,7 @@ public class TestExObjListAtom {
eoa.setObjectIDSeed(4);
// Check bytes are now the same
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
eoa.writeOut(baos);
assertArrayEquals(data_b, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjAtom.java
index 337f6f5307..a28be1bdef 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjAtom.java
@@ -50,7 +50,7 @@ public final class TestExOleObjAtom {
@Test
void testWrite() throws Exception {
ExOleObjAtom record = new ExOleObjAtom(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
@@ -65,7 +65,7 @@ public final class TestExOleObjAtom {
record.setObjStgDataRef(2);
record.setOptions(1283584);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjStg.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjStg.java
index f9d282a095..46d607e729 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjStg.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjStg.java
@@ -70,7 +70,7 @@ public final class TestExOleObjStg {
@Test
void testWrite() throws Exception {
ExOleObjStg record = new ExOleObjStg(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
byte[] b = baos.toByteArray();
@@ -88,7 +88,7 @@ public final class TestExOleObjStg {
assertEquals(src.getDataLength(), tgt.getDataLength());
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
tgt.writeOut(out);
byte[] b = out.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExVideoContainer.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExVideoContainer.java
index ce02202335..a4c2a31401 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExVideoContainer.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExVideoContainer.java
@@ -67,7 +67,7 @@ public final class TestExVideoContainer {
@Test
void testWrite() throws Exception {
ExVideoContainer record = new ExVideoContainer(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
@@ -78,7 +78,7 @@ public final class TestExVideoContainer {
record.getExMediaAtom().setObjectId(1);
record.getPathAtom().setText("D:\\projects\\SchulerAG\\mcom_v_1_0_4\\view\\data\\tests\\images\\cards.mpg");
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestFontCollection.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestFontCollection.java
index a15fa80016..bb7eab1dbb 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestFontCollection.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestFontCollection.java
@@ -94,7 +94,7 @@ public final class TestFontCollection {
@Test
void testWrite() throws Exception {
FontCollection fonts = new FontCollection(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
fonts.writeOut(out);
byte[] recdata = out.toByteArray();
assertArrayEquals(recdata, data);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersAtom.java
index 71ea592da2..f5cf552a5f 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersAtom.java
@@ -54,7 +54,7 @@ public final class TestHeadersFootersAtom {
@Test
void testWrite() throws Exception {
HeadersFootersAtom record = new HeadersFootersAtom(data, 0, data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
@@ -66,7 +66,7 @@ public final class TestHeadersFootersAtom {
record.setFlag(HeadersFootersAtom.fHasTodayDate, true);
record.setFlag(HeadersFootersAtom.fHasFooter, true);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersContainer.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersContainer.java
index 21d7a83d16..209409e425 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersContainer.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersContainer.java
@@ -75,7 +75,7 @@ public final class TestHeadersFootersContainer {
@Test
void testWriteSlideHeadersFootersContainer() throws Exception {
HeadersFootersContainer record = new HeadersFootersContainer(slideData, 0, slideData.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(slideData, baos.toByteArray());
}
@@ -99,7 +99,7 @@ public final class TestHeadersFootersContainer {
assertEquals(HeadersFootersContainer.FOOTERATOM, csFooter.getOptions() >> 4);
csFooter.setText("My Footer - 1");
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(slideData, baos.toByteArray());
}
@@ -128,7 +128,7 @@ public final class TestHeadersFootersContainer {
@Test
void testWriteNotesHeadersFootersContainer() throws Exception {
HeadersFootersContainer record = new HeadersFootersContainer(notesData, 0, notesData.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(notesData, baos.toByteArray());
}
@@ -160,7 +160,7 @@ public final class TestHeadersFootersContainer {
assertEquals(HeadersFootersContainer.FOOTERATOM, csFooter.getOptions() >> 4);
csFooter.setText("Note Footer");
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
record.writeOut(baos);
assertArrayEquals(notesData, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfo.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfo.java
index 3e003969a9..8845e285fa 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfo.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfo.java
@@ -56,7 +56,7 @@ public class TestInteractiveInfo {
@Test
void testWrite() throws Exception {
InteractiveInfo ii = new InteractiveInfo(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ii.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -74,7 +74,7 @@ public class TestInteractiveInfo {
ia.setHyperlinkType((byte)8);
// Check it's now the same as a
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ii.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java
index 824cfce1fd..1ef63efbde 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java
@@ -73,7 +73,7 @@ public class TestInteractiveInfoAtom {
@Test
void testWrite() throws Exception {
InteractiveInfoAtom ia = new InteractiveInfoAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ia.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -90,7 +90,7 @@ public class TestInteractiveInfoAtom {
ia.setHyperlinkType((byte)8);
// Check it's now the same as a
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ia.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -104,7 +104,7 @@ public class TestInteractiveInfoAtom {
ia.setHyperlinkID(4);
// Check bytes are now the same
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ia.writeOut(baos);
assertArrayEquals(data_b, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestNotesAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestNotesAtom.java
index 5528d26293..b6d7c644e7 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestNotesAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestNotesAtom.java
@@ -51,7 +51,7 @@ public final class TestNotesAtom {
@Test
void testWrite() throws Exception {
NotesAtom na = new NotesAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
na.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlideAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlideAtom.java
index 366f85310f..2f5dac443f 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlideAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlideAtom.java
@@ -75,7 +75,7 @@ public final class TestSlideAtom {
@Test
void testWrite() throws IOException {
SlideAtom sa = new SlideAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
sa.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlidePersistAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlidePersistAtom.java
index 4e0386d1ca..7393888034 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlidePersistAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlidePersistAtom.java
@@ -52,7 +52,7 @@ public final class TestSlidePersistAtom {
@Test
void testWrite() throws Exception {
SlidePersistAtom spa = new SlidePersistAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
spa.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestStyleTextPropAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
index 1e57798caf..e155df07b8 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
@@ -466,7 +466,7 @@ public final class TestStyleTextPropAtom {
tpc.setValue(0xFE0033FF);
// Should now be the same as data_a
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
stpa.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -615,8 +615,8 @@ public final class TestStyleTextPropAtom {
assertEquals(tpa.getValue(), tpb.getValue());
}
- UnsynchronizedByteArrayOutputStream ba = new UnsynchronizedByteArrayOutputStream();
- UnsynchronizedByteArrayOutputStream bb = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream ba = UnsynchronizedByteArrayOutputStream.builder().get();
+ UnsynchronizedByteArrayOutputStream bb = UnsynchronizedByteArrayOutputStream.builder().get();
ca.writeOut(ba);
cb.writeOut(bb);
@@ -626,7 +626,7 @@ public final class TestStyleTextPropAtom {
}
// Check byte level with b
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
stpa.writeOut(baos);
assertArrayEquals(data_b, baos.toByteArray());
}
@@ -674,7 +674,7 @@ public final class TestStyleTextPropAtom {
StyleTextPropAtom stpb = new StyleTextPropAtom(data, 0,data.length);
if(textlen != -1) stpb.setParentTextSize(textlen);
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
stpb.writeOut(out);
assertArrayEquals(expected, out.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextBytesAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextBytesAtom.java
index d50fc18a92..a39f4d3c42 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextBytesAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextBytesAtom.java
@@ -64,7 +64,7 @@ public final class TestTextBytesAtom {
TextBytesAtom tba = new TextBytesAtom(data,0,data.length);
tba.setText(alt_text.getBytes(StandardCharsets.ISO_8859_1));
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
tba.writeOut(baos);
assertArrayEquals(alt_data, baos.toByteArray());
}
@@ -72,7 +72,7 @@ public final class TestTextBytesAtom {
@Test
void testWrite() throws Exception {
TextBytesAtom tba = new TextBytesAtom(data,0,data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
tba.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextCharsAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextCharsAtom.java
index d2357a8fdc..d1b79f2234 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextCharsAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextCharsAtom.java
@@ -59,7 +59,7 @@ public final class TestTextCharsAtom {
TextCharsAtom tca = new TextCharsAtom(data,0,data.length);
tca.setText(alt_text);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
tca.writeOut(baos);
assertArrayEquals(alt_data, baos.toByteArray());
}
@@ -67,7 +67,7 @@ public final class TestTextCharsAtom {
@Test
void testWrite() throws Exception {
TextCharsAtom tca = new TextCharsAtom(data,0,data.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
tca.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
@@ -81,7 +81,7 @@ public final class TestTextCharsAtom {
assertEquals(data_text, tca.getText());
// Check it's now like data
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
tca.writeOut(baos);
assertArrayEquals(data, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextHeaderAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextHeaderAtom.java
index 22bce9375b..213db5f080 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextHeaderAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextHeaderAtom.java
@@ -53,7 +53,7 @@ public final class TestTextHeaderAtom {
@Test
void testWrite() throws Exception {
TextHeaderAtom tha = new TextHeaderAtom(notes_data,0,12);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
tha.writeOut(baos);
assertArrayEquals(notes_data, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextRulerAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextRulerAtom.java
index e1a08b6e09..c9067d594e 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextRulerAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextRulerAtom.java
@@ -61,7 +61,7 @@ public final class TestTextRulerAtom {
@Test
void testWriteRuler() throws Exception {
TextRulerAtom ruler = new TextRulerAtom(data_1, 0, data_1.length);
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
ruler.writeOut(out);
byte[] result = out.toByteArray();
@@ -72,7 +72,7 @@ public final class TestTextRulerAtom {
void testRead2() throws Exception {
TextRulerAtom ruler = TextRulerAtom.getParagraphInstance();
ruler.setParagraphIndent((short)249, (short)321);
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
ruler.writeOut(out);
byte[] result = out.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
index c3cd26d1ce..8902d31882 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
@@ -53,7 +53,7 @@ public final class TestTextSpecInfoAtom {
@Test
void testWrite() throws Exception {
TextSpecInfoAtom spec = new TextSpecInfoAtom(data_1, 0, data_1.length);
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
spec.writeOut(out);
assertArrayEquals(data_1, out.toByteArray());
}
@@ -69,7 +69,7 @@ public final class TestTextSpecInfoAtom {
assertEquals(32, run[0].getLength());
//serialize and read again
- UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = UnsynchronizedByteArrayOutputStream.builder().get();
spec.writeOut(out);
byte[] result = out.toByteArray();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java
index 4671e7a8aa..488e5172ad 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java
@@ -57,7 +57,7 @@ public final class TestTxInteractiveInfoAtom {
@Test
void testWrite() throws Exception {
TxInteractiveInfoAtom atom = new TxInteractiveInfoAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
atom.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -72,7 +72,7 @@ public final class TestTxInteractiveInfoAtom {
ia.setEndIndex(56);
// Check it's now the same as a
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ia.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
@@ -87,7 +87,7 @@ public final class TestTxInteractiveInfoAtom {
ia.setEndIndex(78);
// Check bytes are now the same
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
ia.writeOut(baos);
assertArrayEquals(data_b, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestUserEditAtom.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestUserEditAtom.java
index a7defb0e38..be72848ee4 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestUserEditAtom.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestUserEditAtom.java
@@ -56,7 +56,7 @@ public final class TestUserEditAtom {
@Test
void testWrite() throws Exception {
UserEditAtom uea = new UserEditAtom(data_a, 0, data_a.length);
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
uea.writeOut(baos);
assertArrayEquals(data_a, baos.toByteArray());
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestHSLFSlideShow.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestHSLFSlideShow.java
index 343c1117d9..bfadc5e474 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestHSLFSlideShow.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestHSLFSlideShow.java
@@ -40,7 +40,7 @@ public class TestHSLFSlideShow extends BaseTestSlideShow<HSLFShape, HSLFTextPara
@Override
public HSLFSlideShow reopen(SlideShow<HSLFShape, HSLFTextParagraph> show) throws IOException {
- try (UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()) {
+ try (UnsynchronizedByteArrayOutputStream bos = UnsynchronizedByteArrayOutputStream.builder().get()) {
show.write(bos);
try (InputStream is = bos.toInputStream()) {
return new HSLFSlideShow(is);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestPictures.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestPictures.java
index ebda0b8afa..2b90916775 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestPictures.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestPictures.java
@@ -17,7 +17,6 @@
package org.apache.poi.hslf.usermodel;
-import static org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM;
import static org.apache.poi.hslf.HSLFTestDataSamples.getSlideShow;
import static org.apache.poi.hslf.HSLFTestDataSamples.writeOutAndReadBack;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
@@ -38,6 +37,7 @@ import java.util.List;
import javax.imageio.ImageIO;
import org.apache.commons.io.output.CountingOutputStream;
+import org.apache.commons.io.output.NullOutputStream;
import org.apache.poi.POIDataSamples;
import org.apache.poi.ddf.EscherBSERecord;
import org.apache.poi.ddf.EscherContainerRecord;
@@ -315,7 +315,7 @@ public final class TestPictures {
assertEquals(PictureType.WMF, pdata.getType());
//add a new picture, it should be correctly appended to the Pictures stream
- CountingOutputStream out = new CountingOutputStream(NULL_OUTPUT_STREAM);
+ CountingOutputStream out = new CountingOutputStream(NullOutputStream.INSTANCE);
for (HSLFPictureData p : pictures) p.write(out);
int streamSize = out.getCount();
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestRichTextRun.java b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestRichTextRun.java
index 87fb7e0033..08d0e0e8bf 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestRichTextRun.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestRichTextRun.java
@@ -409,7 +409,7 @@ public final class TestRichTextRun {
// Now write out the slideshow
byte[] raw_ss;
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
s.write(baos);
try (POIFSFileSystem fs = new POIFSFileSystem(baos.toInputStream());
InputStream is = fs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT)) {
@@ -424,7 +424,7 @@ public final class TestRichTextRun {
}
private byte[] writeRecord( org.apache.poi.hslf.record.Record r) throws IOException {
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
r.writeOut(baos);
return baos.toByteArray();
}
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestExtractEmbeddedMSG.java b/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestExtractEmbeddedMSG.java
index c5395232dc..b7613be2da 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestExtractEmbeddedMSG.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestExtractEmbeddedMSG.java
@@ -81,7 +81,7 @@ public class TestExtractEmbeddedMSG {
testFixedAndVariableLengthPropertiesOfAttachedMSG(attachedMsg);
// rebuild top level message from embedded message
try (POIFSFileSystem extractedAttachedMsg = rebuildFromAttached(attachedMsg)) {
- try (UnsynchronizedByteArrayOutputStream extractedAttachedMsgOut = new UnsynchronizedByteArrayOutputStream()) {
+ try (UnsynchronizedByteArrayOutputStream extractedAttachedMsgOut = UnsynchronizedByteArrayOutputStream.builder().get()) {
extractedAttachedMsg.writeFilesystem(extractedAttachedMsgOut);
MAPIMessage extractedMsgTopLevel = new MAPIMessage(extractedAttachedMsgOut.toInputStream());
// test properties of rebuilt embedded message
@@ -171,7 +171,7 @@ public class TestExtractEmbeddedMSG {
MAPIType type = Types.getById(iType);
if (type != null && type != Types.UNKNOWN) {
MAPIProperty mprop = MAPIProperty.createCustom(chunk.getChunkId(), type, chunk.getEntryName());
- UnsynchronizedByteArrayOutputStream data = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream data = UnsynchronizedByteArrayOutputStream.builder().get();
chunk.writeValue(data);
PropertyValue pval = new PropertyValue(mprop, MessagePropertiesChunk.PROPERTIES_FLAG_READABLE
| MessagePropertiesChunk.PROPERTIES_FLAG_WRITEABLE, data.toByteArray(), type);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileWithAttachmentsRead.java b/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileWithAttachmentsRead.java
index 068fa10883..28d02df0a0 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileWithAttachmentsRead.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFileWithAttachmentsRead.java
@@ -119,7 +119,7 @@ public class TestFileWithAttachmentsRead {
assertEquals("test-unicode.doc", attachment.getAttachLongFileName().getValue());
assertEquals(".doc", attachment.getAttachExtension().getValue());
assertNull(attachment.getAttachMimeTag());
- UnsynchronizedByteArrayOutputStream attachmentstream = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream attachmentstream = UnsynchronizedByteArrayOutputStream.builder().get();
attachment.getAttachData().writeValue(attachmentstream);
assertEquals(24064, attachmentstream.size());
// or compare the hashes of the attachment data
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFixedSizedProperties.java b/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFixedSizedProperties.java
index 74d6d27ec2..9d8aa55dde 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFixedSizedProperties.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestFixedSizedProperties.java
@@ -168,7 +168,7 @@ public final class TestFixedSizedProperties {
@Test
void testReadMessageDateSucceedsWithHSMFDump() {
HSMFDump dump = new HSMFDump(fsMessageSucceeds);
- assertDoesNotThrow(() -> dump.dump(new NullPrintStream()));
+ assertDoesNotThrow(() -> dump.dump(NullPrintStream.INSTANCE));
}
/**
@@ -177,7 +177,7 @@ public final class TestFixedSizedProperties {
@Test
void testReadMessageDateFailsWithHSMFDump() {
HSMFDump dump = new HSMFDump(fsMessageFails);
- assertDoesNotThrow(() -> dump.dump(new NullPrintStream()));
+ assertDoesNotThrow(() -> dump.dump(NullPrintStream.INSTANCE));
}
/**
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestCase.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestCase.java
index fba8bc97c0..9a0808d286 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestCase.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestCase.java
@@ -49,7 +49,7 @@ public abstract class HWPFTestCase {
}
public HWPFDocument writeOutAndRead(HWPFDocument doc) {
- try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
+ try (UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get()) {
doc.write(baos);
try (InputStream is = baos.toInputStream()) {
return new HWPFDocument(is);
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestDataSamples.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestDataSamples.java
index 0d6ce9bc8c..082b4866d4 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestDataSamples.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/HWPFTestDataSamples.java
@@ -48,7 +48,7 @@ public class HWPFTestDataSamples {
* Useful for verifying that the serialisation round trip
*/
public static HWPFDocument writeOutAndReadBack(HWPFDocument original) {
- try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream(4096)) {
+ try (UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().setBufferSize(4096).get()) {
original.write(baos);
return new HWPFDocument(baos.toInputStream());
} catch (IOException e) {
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/dev/TestHWPFLister.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/dev/TestHWPFLister.java
index c7cd45c1cc..2c9fc68520 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/dev/TestHWPFLister.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/dev/TestHWPFLister.java
@@ -42,7 +42,7 @@ public class TestHWPFLister {
String fileArgs = SAMPLES.getFile("SampleDoc.doc").getAbsolutePath() + args;
PrintStream oldStdOut = System.out;
- System.setOut(new NullPrintStream());
+ System.setOut(NullPrintStream.INSTANCE);
try {
assertDoesNotThrow(() -> HWPFLister.main(fileArgs.split(" ")));
diff --git a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java
index 36ad393a51..936b84317c 100644
--- a/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java
+++ b/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHWPFWrite.java
@@ -47,7 +47,7 @@ public final class TestHWPFWrite extends HWPFTestCase {
*/
@Test
void testWriteStream() throws IOException {
- UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder().get();
try (HWPFDocument doc = HWPFTestDataSamples.openSampleFile("SampleDoc.doc")) {
Range r = doc.getRange();
assertEquals("I am a test document\r", r.getParagraph(0).text());