On Tue, 26 Mar 2024 16:31:06 GMT, Martin Balao <mba...@openjdk.org> wrote:
> Hi @mpdonova , > > Thanks for contributing this fix. I've seen in java.nio.file.Files::find doc > an implementation note saying that it should be used in a try-with-resource > fashion to close the stream and any open directories. Should we consider this? > > One more question. The ".orElse(path).getParent()" code path, what case is it > intended for? I wonder in which cases this is expected to succeed. > > Martin.- I think adding the try-with-resources is a good idea. Always better to close things that potentially leave them open. The `orElse(path).getParent()` was to return a default path that was then used higher-up on the call stack to check for the existence of the library. Looking at it again, that seemed redundant, since this change also looks for the existence of the library, so I refactored the code a little bit for the new `findNssLibrary()` method to return the path to the library or throw a SkippedException. I think this is a cleaner way to do it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/18488#issuecomment-2021101482