You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2025/09/29 10:23:24 UTC
Re: [PR] Improves resource management in `AbstractOriginTest` [commons-io]
ppkarwasz commented on PR #789:
URL: https://github.com/apache/commons-io/pull/789#issuecomment-3346176993
@garydgregory,
Since making `AbstractOrigin` `Closeable` turned out not to make sense, I’ve repurposed this PR to focus on fixing resource management in the tests.
Previously, `AbstractOriginTest` had to forcibly close resources in an `@AfterAll` method. With the refactoring, tests now:
* Allocate only the resources they actually need (e.g., `originRw` is no longer created unnecessarily).
* Are self-contained: they either close the origin directly (when no resource is returned) or use try-with-resources to close the wrapped origin.
This should prevent resource leaks, particularly with `originRw`, which often points to a file in a temporary folder. On Windows, if this resource is not closed, JUnit 5 will fail to remove the temporary folder.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org