RFR: 2415: Update GitCommits::close to make sure it terminates all processes when an exception is thrown

Erik Joelsson erikj at openjdk.org
Thu Nov 21 21:44:26 UTC 2024


On Thu, 21 Nov 2024 18:16:45 GMT, Zhao Song <zsong at openjdk.org> wrote:

> As Pavel pointed out in the pull request of [SKARA-2410](https://bugs.openjdk.org/browse/SKARA-2410)(https://github.com/openjdk/skara/pull/1697), with current implementation , GitCommits::close may have created multiple processes and only destroy one of them.
> 
> As Erik and Pavel suggested, we should make sure close() is called on each process.

vcs/src/main/java/org/openjdk/skara/vcs/git/GitCommits.java line 147:

> 145:             } catch (Exception e) {
> 146:                 if (runtimeException == null) {
> 147:                     runtimeException = new RuntimeException(e);

This converts an IOException to a RuntimeException, which I don't think is ideal. I would suggest just saving the first exception, which should be either a RuntimeException or IOException, and then add any additional exceptions to the suppressed set on the saved exception.

-------------

PR Review Comment: https://git.openjdk.org/skara/pull/1699#discussion_r1852944281


More information about the skara-dev mailing list