https://bz.apache.org/bugzilla/show_bug.cgi?id=66407
Bug ID: 66407
Summary: java.lang.NoSuchMethodError: 'byte[]
org.apache.commons.io.IOUtils.byteArray(int)'
Product: POI
Version: 5.2.2-FINAL
Hardware: PC
Status: NEW
Severity: regression
Priority: P2
Component: POIFS
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
The IOUtils.byteArray() method is not found by FileMagic.valueOf()
It is missing from the POI's embedded IOUtils class
(but it exists in the "outer" official commons-io's IOUtils class :
https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/IOUtils.html#byteArray-int-
)
I cannot open an XLSX workbook using either WorkbookFactory.create() or
OPCPackage.open.
Here are the stacktraces below (with POI 5.2.3). I had to downgrade to 4.1.2
(as a workaround).
########## using WorkbookFactory.create ##########
java.lang.NoSuchMethodError: 'byte[]
org.apache.commons.io.IOUtils.byteArray(int)'
at
org.apache.commons.io.output.AbstractByteArrayOutputStream.needNewBuffer(AbstractByteArrayOutputStream.java:104)
at
org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:51)
at org.apache.poi.util.IOUtils.peekFirstNBytes(IOUtils.java:139)
at
org.apache.poi.poifs.filesystem.FileMagic.valueOf(FileMagic.java:209)
at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:222)
at
org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:185)
########## using OPCPackage.open ##########
java.lang.NoSuchMethodError: 'byte[]
org.apache.commons.io.IOUtils.byteArray(int)'
at
org.apache.commons.io.output.AbstractByteArrayOutputStream.needNewBuffer(AbstractByteArrayOutputStream.java:104)
at
org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream.<init>(UnsynchronizedByteArrayOutputStream.java:51)
at org.apache.poi.util.IOUtils.peekFirstNBytes(IOUtils.java:139)
at
org.apache.poi.poifs.filesystem.FileMagic.valueOf(FileMagic.java:209)
at
org.apache.poi.openxml4j.opc.internal.ZipHelper.verifyZipHeader(ZipHelper.java:143)
at
org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipFile(ZipHelper.java:201)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:166)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:285)
########## my java runtime on windows 10 ##########
$ java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
Some source files links :
POI
https://github.com/apache/poi/blob/35fda27eea50ca00a6e91550716f3e25fa1dfd36/poi/src/main/java/org/apache/poi/poifs/filesystem/FileMagic.java#L209
https://github.com/apache/poi/blob/35fda27eea50ca00a6e91550716f3e25fa1dfd36/poi/src/main/java/org/apache/poi/util/IOUtils.java#L139
COMMONS-IO
https://github.com/apache/commons-io/blob/8985de8fe74f6622a419b37a6eed0dbc484dc128/src/main/java/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.java#L51
https://github.com/apache/commons-io/blob/8985de8fe74f6622a419b37a6eed0dbc484dc128/src/main/java/org/apache/commons/io/output/AbstractByteArrayOutputStream.java#L104
Thank you
Regards
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]