RFR: 8274893: Update java.desktop classes to use try-with-resources
Sergey Bylokhov
serb at openjdk.java.net
Tue Oct 12 06:18:51 UTC 2021
On Tue, 5 Oct 2021 08:13:53 GMT, Andrey Turbanov <duke at openjdk.java.net> wrote:
> 8274893: Update java.desktop classes to use try-with-resources
src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java line 587:
> 585: // Pending: verify character encoding spec for gconf
> 586: StringBuilder sb = new StringBuilder();
> 587: try (Reader reader = new InputStreamReader(url.openStream(), ISO_8859_1)) {
I did not check all code but look like in some places the close method was missed when a few streams were wrapped.
Looks like in this place, the "url.openStream()" may be leaked if the constructor of InputStreamReader will throw an exception. Please check other places for similar issues.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5817
More information about the client-libs-dev
mailing list