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

Head commit for run:
be7d467563fe84f8df23470de687739a8fd1f71e / PJ Fanning 
<[email protected]>
Close the POIFS filesystem when MAPIMessage parsing fails

MAPIMessage(File) and MAPIMessage(String) open a file-backed
POIFSFileSystem and hand it to MAPIMessage(POIFSFileSystem), which
delegates to MAPIMessage(DirectoryNode). That constructor runs
POIFSChunkParser.parse and the chunk sorters with no cleanup, so a
malformed .msg file leaked the RandomAccessFile behind the filesystem.
MAPIMessage(File) is the constructor the javadoc recommends for lower
memory use, so this is the path most likely to be hit.

MAPIMessage(POIFSFileSystem) already takes ownership of the filesystem -
close() closes it via POIDocument.close() - so it is also the right place
to close it when construction does not complete. The chunk parsing moves
into a private parseChunks method, and MAPIMessage(POIFSFileSystem) now
calls super/parseChunks directly rather than delegating, so it can wrap
the parse in a try/catch.

MAPIMessage(DirectoryNode) deliberately keeps no cleanup: it is used for
messages embedded in a filesystem owned by someone else, so closing that
filesystem there would be wrong.

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

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

With regards,
GitHub Actions via GitBox


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

Reply via email to