[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 4893524: Swing drop targets should call close() on transferred readers and streams
From:       Alexey Ivanov <aivanov () openjdk ! org>
Date:       2023-07-31 9:55:53
Message-ID: tuzEApuXeqyT3PStMCsgff7oPv_8RuYDKvakwlR2TQY=.26b9aaac-8878-438e-80d8-1430744457db () github ! com
[Download RAW message or body]

On Wed, 26 Jul 2023 07:15:56 GMT, Prasanta Sadhukhan <psadhukhan@openjdk.org> wrote:

> The issue here is a Reader(stream) is requested to handle a drop, via  \
> DataFlavor.getReaderForText(), and then the reader is completely read, but it isn't \
> closed. It should be closed as soon as possible to release some native resources. \
> Fix is made to close the stream after it is being used

Shall we also update the copyright year in `BasicTextUI`?

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.

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

PR Review: https://git.openjdk.org/jdk/pull/15033#pullrequestreview-1554394185
PR Review Comment: https://git.openjdk.org/jdk/pull/15033#discussion_r1279064741


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic