The GitHub Actions job "Java CI with Ant" on poi.git/leak-factory-catch-clauses 
has failed.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
b801b1e8cec5ab59208933ea9bc37efaad4c33dc / PJ Fanning 
<[email protected]>
Close file-backed resources when workbook/extractor construction fails

Three factory methods opened a file-backed resource, then only cleaned it
up for a subset of the exceptions the following call can actually throw,
leaking the underlying file handle for the rest.

HSSFWorkbookFactory.create(File, String, boolean) caught only
RuntimeException, but HSSFWorkbook(POIFSFileSystem, boolean, char[]) is
declared throws IOException, so a corrupt .xls that fails with an
IOException leaked the RandomAccessFile behind the POIFSFileSystem.

XSSFWorkbookFactory.createWorkbook(OPCPackage) had the same gap: it
caught only RuntimeException while new XSSFWorkbook(pkg) throws
IOException. Reached from create(File, String, boolean), the package is
ZipFile-backed, so the zip handle leaked.

POIXMLExtractorFactory.create(File, String) handled InvalidFormatException
and IOException but not RuntimeException. The InputStream overload
directly below it already had that arm, and it is the File variant that
actually holds a descriptor.

Each is widened to a multi-catch that reverts/closes and rethrows the
original exception unchanged. ExtractorFactory.createExtractor(File,
String) already used this catch (IOException | RuntimeException) shape.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

Report URL: https://github.com/apache/poi/actions/runs/34116631916

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to