RFR: 8348106: Catch C++ exception in Java_sun_awt_windows_WTaskbarPeer_setOverlayIcon
Alexey Ivanov
aivanov at openjdk.org
Mon Feb 10 18:03:21 UTC 2025
On Wed, 5 Feb 2025 18:40:07 GMT, Rajat Mahajan <rmahajan at openjdk.org> wrote:
> **Issue:**
> The JNI method `Java_sun_awt_windows_WTaskbarPeer_setOverlayIcon `calls `CreateIconFromRaster `that can throw a C++ exception.
>
> The C++ exception must be caught and must not be allowed to escape the JNI method. The call to `CreateIconFromRaster `has to wrapped into a try-catch block.
>
> **Solution:**
>
> Added exception handling to make sure any exception from `CreateIconFromRaster `is handled properly.
>
> Testing done.
Changes requested by aivanov (Reviewer).
src/java.desktop/windows/native/libawt/windows/awt_Taskbar.cpp line 1:
> 1: /*
Please update the copyright year.
src/java.desktop/windows/native/libawt/windows/awt_Taskbar.cpp line 130:
> 128: {
> 129: try
> 130: {
Suggestion:
try {
I think it makes sense to use Java style and put the opening brace on the same line with `try` as this style is followed by `if`-`else` statements in the file as well as you follow Java style for the `catch` block below.
-------------
PR Review: https://git.openjdk.org/jdk/pull/23470#pullrequestreview-2606715517
PR Review Comment: https://git.openjdk.org/jdk/pull/23470#discussion_r1949617073
PR Review Comment: https://git.openjdk.org/jdk/pull/23470#discussion_r1949616538
More information about the client-libs-dev
mailing list