We are dealing with an exception when trying to create a create an encrypted xlsx file from an unencrypted one.
Caused by: org.apache.poi.openxml4j.exceptions.OpenXML4JException: The part /xl/styles.xml failed to be saved in the stream with marshaller org.apache.poi.openxml4j.opc.internal.marshallers.DefaultMarshaller@852ef8d
at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:543) ~[poi-ooxml-4.1.2.jar:4.1.2]
I have read around that it is because one of the files involved is open more than once. That is not the case. There are say, 2 parts to the process. There's one that creates an xlsx file, then there's another that kicks in to encrypt it. I have split them apart them so that I could test them one after the other separately. Run first step, I create the xlsx file, unit test finishes, I don't run anything else. Then I run the second step on a separate test session (to make sure that there's nothing that is holding the previous file open) and I get that exception.