RFR(S) 8165603 - UseAppCDS.java failed to clean up files after test
Mikhailo Seledtsov
mikhailo.seledtsov at oracle.com
Wed Dec 13 01:58:09 UTC 2017
+1
Misha
On 12/12/17, 5:28 PM, David Holmes wrote:
> Looks good! Nice cleanup.
>
> Thanks,
> David
>
> On 13/12/2017 10:41 AM, Ioi Lam wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8165603
>> http://cr.openjdk.java.net/~iklam/jdk11/8165603-files-not-closed.v01/
>>
>> Summary:
>>
>> The test case opens a temp file for reading without closing it
>> explicitly. This causes
>> jtreg agentvm mode testing on Windows to complain about failing to
>> delete the temp file.
>>
>> The fix is to to put the opening of input/output streams in
>> try-resource blocks, like
>>
>> try (BufferedReader br =
>> new BufferedReader(
>> new InputStreamReader(
>> new FileInputStream(filename)))
>> ) {
>> for (; ; ) {
>> String line = br.readLine();
>> ...
>> }
>>
>> The streams will be closed when we leave the "try" block.
>>
>> Besides the test in the bug report, I fixed a few other files in
>> similar ways.
>>
>> Testing -- HotSpot tier1/tier2 tests all passed. I verified that
>> UseAppCDS.java
>> is now executed on Windows and passed.
>>
>> I plan to push into the jdk/hs repo after the jdk 10 repo fork.
>>
>> Thanks
>> - Ioi
More information about the hotspot-runtime-dev
mailing list