mpwoodward/CFPOI — Issue #3: Excel file is not closed in case of an error
Author: mpwoodward
Created: 2012-02-29 06:50:56+00:00
State: open

In Spreadsheet.cfc/readFromFile, a FileInputStream is created before invoking workbookFactory.create(inputStream) to actually read and parse the file.

If POI throws an exception (e.g. if the file content is invalid), the input stream is not closed, causing the file to remain open and locked and will not be closed, until the garbage collector at some point in the future finalizes the input stream instance.

The solution would be to invoke inputStream.close() in a finally block:

``
``
` `
` `

` `
` `
` `
``