RFR: 8370467: BorderFactory.createBevelBorder and createSoftBevelBorder throws NPE for null highlight and shadow [v8]

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Nov 12 12:29:29 UTC 2025


On Wed, 12 Nov 2025 11:53:47 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Code fix only
>>  - Code fix only
>
> src/java.desktop/share/classes/javax/swing/border/BevelBorder.java line 99:
> 
>> 97:     public BevelBorder(int bevelType, Color highlight, Color shadow) {
>> 98:          this(bevelType, (highlight != null) ? highlight.brighter() : null,
>> 99:               highlight, shadow, (shadow != null) ? shadow.brighter() : null);
> 
> Suggestion:
> 
>         this(bevelType, (highlight != null) ? highlight.brighter() : null,
>              highlight, shadow, (shadow != null) ? shadow.brighter() : null);
> 
> Fix the indentation.
> 
> In fact, I suggest wrapping the parameters and having highlight and shadow on one line, I think this will improve readability.
> 
> 
> Suggestion:
> 
>         this(bevelType,
>              (highlight != null) ? highlight.brighter() : null, highlight,
>              shadow, (shadow != null) ? shadow.brighter() : null);
> 
> This way both highlight and shadow colors are logically grouped.

ok

> test/jdk/javax/swing/border/TestBevelBorderParam.java line 60:
> 
>> 58:             str.append("BevelBorder constructor throws NPE for null highlight and shadow");
>> 59:         }
>> 60:         if (failure) {
> 
> You don't need the `failure` variable. If `str` is not empty, throw the exception.

ok

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27949#discussion_r2518107416
PR Review Comment: https://git.openjdk.org/jdk/pull/27949#discussion_r2518107738


More information about the client-libs-dev mailing list