On Tue, 21 Nov 2023 17:59:02 GMT, Abhishek Kumar <[email protected]> wrote:

>> JProgressBar is always painted with border irrespective of the value set via 
>> the API `setBorderPainted(boolean value)` in Synth (Nimbus and GTK) LAF. 
>> Proposed fix is to add a check before painting the component.
>> 
>> CI jobs are green after the fix. Links attached to JBS.
>
> Abhishek Kumar has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Remove line break

Changes requested by aivanov (Reviewer).

test/jdk/javax/swing/JProgressBar/TestProgressBarBorder.java line 28:

> 26: import java.lang.reflect.InvocationTargetException;
> 27: import java.awt.Graphics;
> 28: import java.awt.image.BufferedImage;

IDEA at my end disagrees with the current sorting order:
Suggestion:

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

test/jdk/javax/swing/JProgressBar/TestProgressBarBorder.java line 51:

> 49: public class TestProgressBarBorder {
> 50:     public static void main(String[] args) throws 
> InvocationTargetException,
> 51:             InterruptedException {

Suggestion:

    public static void main(String[] args) throws Exception {

In a test we usually don't care about checked exception, therefore `throws 
Exception` is perfectly fine — it's what you usually see instead of the pair of 
`InvocationTargetException` and `InterruptedException` thrown by 
`invokeAndWait`.

test/jdk/javax/swing/JProgressBar/TestProgressBarBorder.java line 75:

> 73:                 ImageIO.write(withBorder, "png", new 
> File("withBorder.png"));
> 74:                 ImageIO.write(withoutBorder, "png", new 
> File("withoutBorder.png"));
> 75:             } catch (IOException e) {}

Suggestion:

            } catch (IOException ignored) {}

Naming the exception parameter `ignored` lets IDE know the exception is 
ignored, which removes the warning about *ignoring the exception*.

(I used the name `ignored` in the snippet I pasted specifically for this 
reason.)

test/jdk/javax/swing/JProgressBar/TestProgressBarBorder.java line 76:

> 74:                 ImageIO.write(withoutBorder, "png", new 
> File("withoutBorder.png"));
> 75:             } catch (IOException e) {}
> 76:             throw new RuntimeException("JProgressBar border is painted 
> when border " +

Let's add a blank line before the `throw` statement, it'll stand out better 
from the preceding code.

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

PR Review: https://git.openjdk.org/jdk/pull/16467#pullrequestreview-1742925323
PR Review Comment: https://git.openjdk.org/jdk/pull/16467#discussion_r1401072905
PR Review Comment: https://git.openjdk.org/jdk/pull/16467#discussion_r1401075040
PR Review Comment: https://git.openjdk.org/jdk/pull/16467#discussion_r1401076413
PR Review Comment: https://git.openjdk.org/jdk/pull/16467#discussion_r1401078292

Reply via email to