RFR: JDK-8297449: Update JInternalFrame Metal Border code [v2]
Harshitha Onkar
honkar at openjdk.org
Tue Nov 29 00:11:09 UTC 2022
On Mon, 28 Nov 2022 23:07:12 GMT, SWinxy <duke at openjdk.org> wrote:
>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>>
>> review changes
>
> src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java line 267:
>
>> 265: }
>> 266:
>> 267: AffineTransform at = null;
>
> Because we'd no longer be causing a `ClassCastException` from casting this to be a `Graphics2D` object, later down on line 311, if the `Graphics` object isn't a G2D type, then it will throw an NPE. I fear matrices, so I have no idea what the value of `getScaleX()` would be otherwise--replace it with zero if null?
@SWinxy Thanks for catching it. That's right, but the scale factor cannot be zero, it should probably be handled similar to `stkWidth` if **'at is null'** (at is null when g is not an instance of Graphics2D). I'll need to check the scale value to be used in this context.
Something like below.
`at != null ? at.getScaleX() : 1;`
-------------
PR: https://git.openjdk.org/jdk/pull/11305
More information about the client-libs-dev
mailing list