RFR: JDK-8265078: jpackage tests on Windows leave large temp files [v2]
Kevin Rushforth
kcr at openjdk.java.net
Tue Apr 13 21:14:00 UTC 2021
On Tue, 13 Apr 2021 21:05:26 GMT, Andy Herrick <herrick at openjdk.org> wrote:
>> two changes:
>> One to jpackage, when recursively removing directory, when IOException occurs, record it and continue (deleting as much as possible) before throwing the exception.
>> The other to tests, when running jpackage via ProcessBuilder.execute(), set the "TMP" environment variable to the current value of System Property "java.io.tmpdir". This causes the sub-process (jpackage) to output tmp files to the tmp file location used by the test. (So the test harness can clean up after test exits).
>
> Andy Herrick has updated the pull request incrementally with one additional commit since the last revision:
>
> JDK-8265078: jpackage tests on Windows leave large temp files
Are you sure you need an `AtomicReference` to set the exception? I don't see any use of multiple threads, but I might be missing something. If you do need it, you need to fix the order of arguments.
src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java line 96:
> 94: Files.delete(dir);
> 95: } catch (IOException ex) {
> 96: exception.compareAndSet(ex, null);
The arguments are backwards. The first argument is the one used for comparison, and if the current reference is equal to the first, it is set to the second value.
-------------
Changes requested by kcr (Author).
PR: https://git.openjdk.java.net/jdk/pull/3473
More information about the core-libs-dev
mailing list