Is it possible to put the InputStream definition into the first try block?
Something like:
public Image loadImage(final String resourceName) {
final Toolkit toolkit = Toolkit.getDefaultToolkit();
try (InputStream in =
getClass().getResourceAsStream(resourceName)) {
return toolkit.createImage(in.readAllBytes());
} catch (final Exception ignored) {
}
return null;
}
Thanks,
Alexandr.
On 8/11/2015 4:51 PM, Sergey Bylokhov wrote:
Hello.
Please review the fix for jdk9.
This is the same bug as was described in [1] and [2] but this time in
beans area.
So in the fix the usage of getResource was changed to
getResourceAsStream.
Bug: https://bugs.openjdk.java.net/browse/JDK-8131926
Webrev can be found at:
http://cr.openjdk.java.net/~serb/8131926/webrev.00
[1] https://bugs.openjdk.java.net/browse/JDK-8078658
[2] http://mail.openjdk.java.net/pipermail/awt-dev/2015-May/009431.html