Bug 65304 - Add commons-io as a dependency
Summary: Add commons-io as a dependency
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 5.0.x-dev
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2021-05-14 00:32 UTC by Andreas Beeker
Modified: 2021-05-14 00:38 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Beeker 2021-05-14 00:32:41 UTC
Historically several classes from Commons-IO have been embedded into POI.
Additionally Commons-IO provides a ByteArrayOutputStream which is based on a list instead of reallocating whole memory chunks.

As a base measurement, I've used the build times on my PC, which are about 3% faster now (before 577 sec / after 561 sec). Arguably the tests use a lot of byte juggling and reloading of documents and hence it probably will have less of an effect on production code.

Although we have the usual suspects on stackoverflow, who still have problems with collecting the dependencies in the area of dependency managers, one more dependency - which is kind of a standard dependency - doesn't hurt in my point of view.

I've mass-replaced the java.io.ByteArrayOutputStream with the unsynchronized commons counterpart and then went through all the files to check, if .toInputStream() can be used instead of new ByteArrayInputStream(...toByteArray()).

I had to exclude the HWPF classes, as those have java.io.BAOS in their API.

Additionally I've cleaned up the usage of AutoClosables and a few incorrect tests, which haven't updated the test objects after reloading the documents.
Comment 1 Andreas Beeker 2021-05-14 00:38:54 UTC
Applied via r1889871