https://bz.apache.org/bugzilla/show_bug.cgi?id=63029

            Bug ID: 63029
           Summary: Potentially clobbers files on close
           Product: POI
           Version: 4.0.x-dev
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: OPC
          Assignee: dev@poi.apache.org
          Reporter: a.doerf...@e-sign.com
  Target Milestone: ---

I read an XLSX file this way:
                workBookPackage = OPCPackage.open(path.toFile(),
PackageAccess.READ);
                workBook = new XSSFWorkbook(workBookPackage);

I'm using this method, as the documentation says that "Creating a XSSFWorkbook
from a file-backed OPC Package has a lower memoryfootprint than an InputStream
backed one."

Now my application got interrupted, and this resulted in a zero byte XLSX file.
Unfortunately, I don't have the complete stack trace anymore, but I got a
`java.nio.channels.ClosedByInterruptException` from FileHelper.copyFile().

Looking at ZipPackage.closeImpl(), it looks like it *always*, and
unconditionally clobbers the original file, even if I had used
PackageAccess.READ to open the package.

The other issue is, that closeImpl() does not even try to use an atomic move to
make replacing the original file saver.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to