{"record":{"id":"6911252a22ccd494","repo":"java-native-access/jna","slug":"this-platform-is-not-supported-yet","errorCode":null,"errorMessage":"This platform is not supported, yet.","messagePattern":"This platform is not supported, yet\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"contrib/platform/src/com/sun/jna/platform/WindowUtils.java","lineNumber":634,"sourceCode":"                }\n            }\n        }\n\n        /**\n         * Obtains the set icon for the window associated with the specified\n         * window handle.\n         *\n         * @param hwnd\n         *            The concerning window handle.\n         * @return Either the window's icon or {@code null} if an error\n         *         occurred.\n         *\n         * @throws UnsupportedOperationException\n         *             Thrown if this method wasn't yet implemented for the\n         *             current platform.\n         */\n        protected BufferedImage getWindowIcon(final HWND hwnd) {\n            throw new UnsupportedOperationException(\"This platform is not supported, yet.\");\n        }\n\n        /**\n         * Detects the size of an icon.\n         *\n         * @param hIcon\n         *            The icon handle type.\n         * @return Either the requested icon's dimension or an {@link Dimension}\n         *         instance of {@code (0, 0)}.\n         *\n         * @throws UnsupportedOperationException\n         *             Thrown if this method wasn't yet implemented for the\n         *             current platform.\n         */\n        protected Dimension getIconSize(final HICON hIcon) {\n            throw new UnsupportedOperationException(\"This platform is not supported, yet.\");\n        }\n","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/java-native-access/jna/blob/d036ad9781adad4b66693e8fa7098e4ac665e0a3/contrib/platform/src/com/sun/jna/platform/WindowUtils.java#L616-L652","documentation":"W32WindowUtils (base Provider) getWindowIcon always throws UnsupportedOperationException because retrieving a window icon is only implemented for specific platforms. Any caller on a non-implemented platform gets this unconditional throw.","triggerScenarios":"Calling WindowUtils.getWindowIcon(Window) on a platform where the underlying protected getWindowIcon(HWND) was never implemented (not Windows in this provider).","commonSituations":"Code written against Windows behavior running on Linux/macOS; new JDKs where the native peer lookup fails and the unsupported base path is reached.","solutions":["Only call getWindowIcon after confirming platform support (Platform.isWindows())","Catch UnsupportedOperationException and provide a fallback icon","Implement the method in a platform-specific Provider subclass"],"exampleFix":"// before\nBufferedImage icon = WindowUtils.getWindowIcon(frame);\n// after\nBufferedImage icon = null;\ntry {\n    icon = WindowUtils.getWindowIcon(frame);\n} catch (UnsupportedOperationException e) {\n    icon = frame.getIconImage() != null\n        ? (BufferedImage) frame.getIconImage() : defaultIcon;\n}","handlingStrategy":"try-catch","validationCode":"if (!Platform.isWindows()) {\n    throw new UnsupportedOperationException(\"getWindowIcon not implemented on \" + System.getProperty(\"os.name\"));\n}","typeGuard":"boolean windowIconSupported() {\n    return Platform.isWindows();\n}","tryCatchPattern":"try {\n    icon = WindowUtils.getWindowIcon(frame);\n} catch (UnsupportedOperationException e) {\n    icon = frame.getIconImage();\n}","preventionTips":["Gate getWindowIcon behind platform checks","Fall back to Window.getIconImage() when unsupported","Track library updates for new platform implementations"],"tags":["java","windowutils","icon","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"d036ad9781adad4b66693e8fa7098e4ac665e0a3","analyzedAt":"2026-09-12T06:50:59.239Z","contentChangedAt":"2026-09-12T06:50:59.239Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}