RFR: 4893524: Swing drop targets should call close() on transferred readers and streams [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Aug 1 07:15:54 UTC 2023


On Mon, 31 Jul 2023 09:51:59 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use try-with-resource
>
> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java line 2613:
> 
>> 2611: 
>> 2612:                     handleReaderImport(r, c, useRead);
>> 2613:                     r.close();
> 
> Should we use try-with-resources for Reader? This will ensure the stream is closed even if `handleReaderImport` throws an exception.

Seems like good idea..Modified...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15033#discussion_r1280194991



More information about the client-libs-dev mailing list