<Swing Dev> RFR: 8049301: Suspicious use of string identity checks in JComponent.setUIProperty [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.java.net
Fri Jul 30 10:39:00 UTC 2021
On Fri, 30 Jul 2021 09:32:10 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:
>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Prevent NPE
>
> src/java.desktop/share/classes/javax/swing/JComponent.java line 4194:
>
>> 4192: */
>> 4193: void setUIProperty(String propertyName, Object value) {
>> 4194: if (propertyName.equals("opaque")) {
>
> This will throw an NPE if `propertyName` is `null`, which didn't happened before the fix.
>
>> this method could be rewritten to use strings in switch.
>
> Probably we might still want to use switch, it will handle the NPE case as before the fix.
>
> Did you run CI tests after the fix?
I have taken care of NPE..I am not sure of switch which probably might be a hindrance in backporting if needed to earlier release trains.
CI is also run..link in JBS.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4943
More information about the swing-dev
mailing list