Bug 65304

Summary: Add commons-io as a dependency
Product: POI Reporter: Andreas Beeker <kiwiwings>
Component: POI OverallAssignee: POI Developers List <dev>
Severity: enhancement    
Priority: P2    
Version: 5.0.x-dev   
Target Milestone: ---   
Hardware: All   
OS: All   

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