https://bz.apache.org/bugzilla/show_bug.cgi?id=68652
Bug ID: 68652
Summary: Creating XSSFWorkbook with path argument in
constructor cause unexpected and not transparent
source file modification.
Product: POI
Version: 5.2.3-FINAL
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
I am using XSSFWorkbook for parsing xlsx files (only reading data).
For XSSFWorkbook creation I am using following constructor:
XSSFWorkbook(String path)
After testing my solution I discovered that there is some unexpected
non-transparent undesired behavior:
after closing workbook (I am using try with resources construction) source file
is rewritten updated by its compressed version; this is unexpected for me since
file is opened only for reading data.
Using following workaround changes this behavior:
static Workbook getWorkbook(String fullFileName) throws IOException {
try {
return new XSSFWorkbook(OPCPackage.open(fullFileName,
PackageAccess.READ));
} catch (InvalidFormatException e) {
throw new IOException(e.toString(), e);
}
}
Library version used in my solution is 5.2.5 (not present in version dropdown).
--
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]