aboutsummaryrefslogtreecommitdiffstats
path: root/osgi
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2021-05-14 00:37:50 +0000
committerAndreas Beeker <kiwiwings@apache.org>2021-05-14 00:37:50 +0000
commit0614835c55f44ab6f3e9b0850ca51e0e53a65a49 (patch)
tree586c68c89edb0978a441facf0066ff56d84fa2c7 /osgi
parentfe753d473788fc24030d7066654c56c33fff23b5 (diff)
downloadpoi-0614835c55f44ab6f3e9b0850ca51e0e53a65a49.tar.gz
poi-0614835c55f44ab6f3e9b0850ca51e0e53a65a49.zip
#65304 - Add commons-io as a dependency
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1889871 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'osgi')
-rw-r--r--osgi/README.md1
-rw-r--r--osgi/pom.xml1
-rwxr-xr-xosgi/src/test/java/org/apache/poi/osgi/OSGiExtractorsIT.java6
-rwxr-xr-xosgi/src/test/java/org/apache/poi/osgi/OSGiSlideShowIT.java13
-rw-r--r--osgi/src/test/java/org/apache/poi/osgi/OSGiSpreadsheetIT.java13
5 files changed, 19 insertions, 15 deletions
diff --git a/osgi/README.md b/osgi/README.md
index 01bbc68f49..f241dc973b 100644
--- a/osgi/README.md
+++ b/osgi/README.md
@@ -9,6 +9,7 @@ The bundle embeds all the jars from lib/main:
- SparseBitSet
- curvesapi
- commons-math3
+- commons-io
- commons-compress
- commons-collections4
- commons-codec
diff --git a/osgi/pom.xml b/osgi/pom.xml
index 97afc8b4bb..b16e9f9302 100644
--- a/osgi/pom.xml
+++ b/osgi/pom.xml
@@ -101,6 +101,7 @@
SparseBitSet,
curvesapi,
commons-math3,
+ commons-io,
commons-compress,
commons-collections4,
commons-codec,
diff --git a/osgi/src/test/java/org/apache/poi/osgi/OSGiExtractorsIT.java b/osgi/src/test/java/org/apache/poi/osgi/OSGiExtractorsIT.java
index 8ee1258fa4..3bf58a2b61 100755
--- a/osgi/src/test/java/org/apache/poi/osgi/OSGiExtractorsIT.java
+++ b/osgi/src/test/java/org/apache/poi/osgi/OSGiExtractorsIT.java
@@ -36,7 +36,7 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
import java.awt.*;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import static org.junit.Assert.assertEquals;
@@ -57,7 +57,7 @@ public class OSGiExtractorsIT extends BaseOSGiTestCase {
box.setText("Hello, World!");
box.setAnchor(new Rectangle(36, 15, 648, 65));
- ByteArrayOutputStream out = new ByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
ppt.write(out);
return out.toByteArray();
}
@@ -66,7 +66,7 @@ public class OSGiExtractorsIT extends BaseOSGiTestCase {
Sheet s = wb.createSheet("OSGi");
s.createRow(0).createCell(0).setCellValue("Hello, World!");
- ByteArrayOutputStream out = new ByteArrayOutputStream();
+ UnsynchronizedByteArrayOutputStream out = new UnsynchronizedByteArrayOutputStream();
wb.write(out);
return out.toByteArray();
diff --git a/osgi/src/test/java/org/apache/poi/osgi/OSGiSlideShowIT.java b/osgi/src/test/java/org/apache/poi/osgi/OSGiSlideShowIT.java
index ef18f1cc95..9744c36ca9 100755
--- a/osgi/src/test/java/org/apache/poi/osgi/OSGiSlideShowIT.java
+++ b/osgi/src/test/java/org/apache/poi/osgi/OSGiSlideShowIT.java
@@ -28,7 +28,7 @@ import org.ops4j.pax.exam.spi.reactors.PerClass;
import java.awt.*;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import java.util.List;
import static org.junit.Assert.assertEquals;
@@ -75,11 +75,12 @@ public class OSGiSlideShowIT extends BaseOSGiTestCase {
}
box2.setAnchor(new Rectangle(36, 80, 648, 400));
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ppt.write(baos);
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
- ppt = SlideShowFactory.create(bais);
+ try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
+ ppt.write(baos);
+ try (InputStream bais = baos.toInputStream()) {
+ ppt = SlideShowFactory.create(bais);
+ }
+ }
assertEquals(1, ppt.getSlides().size());
slide = (Slide) ppt.getSlides().iterator().next();
assertEquals(2, slide.getShapes().size());
diff --git a/osgi/src/test/java/org/apache/poi/osgi/OSGiSpreadsheetIT.java b/osgi/src/test/java/org/apache/poi/osgi/OSGiSpreadsheetIT.java
index 0ea95602c9..618b76e36c 100644
--- a/osgi/src/test/java/org/apache/poi/osgi/OSGiSpreadsheetIT.java
+++ b/osgi/src/test/java/org/apache/poi/osgi/OSGiSpreadsheetIT.java
@@ -29,7 +29,7 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
+import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import static org.junit.Assert.assertEquals;
@@ -48,11 +48,12 @@ public class OSGiSpreadsheetIT extends BaseOSGiTestCase {
s.createRow(0).createCell(0).setCellValue("With OSGi");
s.createRow(1).createCell(0).setCellFormula("SUM(A1:B3)");
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- wb.write(baos);
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-
- wb = WorkbookFactory.create(bais);
+ try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
+ wb.write(baos);
+ try (InputStream bais = baos.toInputStream()) {
+ wb = WorkbookFactory.create(bais);
+ }
+ }
assertEquals(1, wb.getNumberOfSheets());
s = wb.getSheet("OSGi");