Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
6201035: Document NPE for passing null insets to constructors and met…
…hods of several javax.swing.border.* classes

Reviewed-by: tr, prr, aivanov, serb
  • Loading branch information
prsadhuk committed Nov 23, 2022
1 parent faf48e6 commit 412b436
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 1 deletion.
Expand Up @@ -84,7 +84,9 @@ public Insets getBorderInsets(Component c) {
* Reinitializes the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @return the <code>insets</code> object
* @return the {@code insets} object
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
insets.left = insets.top = insets.right = insets.bottom = 0;
Expand Down
Expand Up @@ -142,6 +142,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he
* Reinitialize the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
insets.set(2, 2, 2, 2);
Expand Down
Expand Up @@ -137,6 +137,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he
* Reinitialize the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
Insets nextInsets;
Expand Down
Expand Up @@ -83,6 +83,8 @@ public EmptyBorder(int top, int left, int bottom, int right) {
/**
* Creates an empty border with the specified insets.
* @param borderInsets the insets of the border
* @throws NullPointerException if the specified {@code borderInsets}
* is {@code null}
*/
@ConstructorProperties({"borderInsets"})
public EmptyBorder(Insets borderInsets) {
Expand All @@ -102,6 +104,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he
* Reinitialize the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
insets.left = left;
Expand Down
Expand Up @@ -210,6 +210,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he
*
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
insets.set(2, 2, 2, 2);
Expand Down
Expand Up @@ -219,6 +219,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he
*
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
insets.set(thickness, thickness, thickness, thickness);
Expand Down
Expand Up @@ -75,6 +75,8 @@ public MatteBorder(int top, int left, int bottom, int right, Color matteColor)
* Creates a matte border with the specified insets and color.
* @param borderInsets the insets of the border
* @param matteColor the color rendered for the border
* @throws NullPointerException if the specified {@code borderInsets}
* is {@code null}
* @since 1.3
*/
public MatteBorder(Insets borderInsets, Color matteColor) {
Expand All @@ -99,6 +101,8 @@ public MatteBorder(int top, int left, int bottom, int right, Icon tileIcon) {
* Creates a matte border with the specified insets and tile icon.
* @param borderInsets the insets of the border
* @param tileIcon the icon to be used for tiling the border
* @throws NullPointerException if the specified {@code borderInsets}
* is {@code null}
* @since 1.3
*/
public MatteBorder(Insets borderInsets, Icon tileIcon) {
Expand Down Expand Up @@ -166,6 +170,8 @@ private void paintEdge(Component c, Graphics g, int x, int y, int width, int hei
* Reinitialize the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
* @since 1.3
*/
public Insets getBorderInsets(Component c, Insets insets) {
Expand Down
Expand Up @@ -152,6 +152,8 @@ public void paintBorder(Component c, Graphics g, int x, int y, int width, int he
* Reinitialize the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
insets.set(3, 3, 3, 3);
Expand Down
Expand Up @@ -374,6 +374,8 @@ else if (border != null) {
* Reinitialize the insets parameter with this Border's current Insets.
* @param c the component for which this border insets value applies
* @param insets the object to be reinitialized
* @throws NullPointerException if the specified {@code insets}
* is {@code null}
*/
public Insets getBorderInsets(Component c, Insets insets) {
Border border = getBorder();
Expand Down
Expand Up @@ -172,6 +172,8 @@ public EmptyBorderUIResource(int top, int left, int bottom, int right) {
/**
* Constructs an {@code EmptyBorderUIResource}.
* @param insets the insets of the border
* @throws NullPointerException if the spcecified {@code insets}
* is {@code null}
*/
@ConstructorProperties({"borderInsets"})
public EmptyBorderUIResource(Insets insets) {
Expand Down

1 comment on commit 412b436

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.