6201035: Document NPE for passing null insets to constructors and methods of several javax.swing.border.* classes

Reviewed-by: tr, prr, aivanov, serb
This commit is contained in:
Prasanta Sadhukhan 2022-11-23 03:20:30 +00:00
parent faf48e61be
commit 412b43658a
10 changed files with 27 additions and 1 deletions

@ -84,7 +84,9 @@ public abstract class AbstractBorder implements Border, Serializable
* 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;

@ -142,6 +142,8 @@ public class BevelBorder extends AbstractBorder
* 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);

@ -137,6 +137,8 @@ public class CompoundBorder extends AbstractBorder {
* 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;

@ -83,6 +83,8 @@ public class EmptyBorder extends AbstractBorder implements Serializable
/**
* 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) {
@ -102,6 +104,8 @@ public class EmptyBorder extends AbstractBorder implements Serializable
* 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;

@ -210,6 +210,8 @@ public class EtchedBorder extends AbstractBorder
*
* @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);

@ -219,6 +219,8 @@ public class LineBorder extends AbstractBorder
*
* @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);

@ -75,6 +75,8 @@ public class MatteBorder extends EmptyBorder
* 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) {
@ -99,6 +101,8 @@ public class MatteBorder extends EmptyBorder
* 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) {
@ -166,6 +170,8 @@ public class MatteBorder extends EmptyBorder
* 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) {

@ -152,6 +152,8 @@ public class SoftBevelBorder extends BevelBorder
* 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);

@ -374,6 +374,8 @@ public class TitledBorder extends AbstractBorder
* 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();

@ -172,6 +172,8 @@ public class BorderUIResource implements Border, UIResource, Serializable
/**
* 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) {