-
-
Notifications
You must be signed in to change notification settings - Fork 567
Description
TextTitle throws NullPointerException fo rnull parameters:
` public TextTitle(String text, Font font, Paint paint,
RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
RectangleInsets padding) {
super(position, horizontalAlignment, verticalAlignment, padding);
if (text == null) {
throw new NullPointerException("Null 'text' argument.");
}
if (font == null) {
throw new NullPointerException("Null 'font' argument.");
}
if (paint == null) {
throw new NullPointerException("Null 'paint' argument.");
}
this.text = text;
this.font = font;
this.paint = paint;
// the textAlignment and the horizontalAlignment are separate things,
// but it makes sense for the default textAlignment to match the
// title's horizontal alignment...
this.textAlignment = horizontalAlignment;
this.backgroundPaint = null;
this.content = null;
this.toolTipText = null;
this.urlText = null;
}`
Other classes throw IllegalArgumentException. For example:
public TextLine(String text, Font font, Paint paint) { if (text == null) { throw new IllegalArgumentException("Null 'text' argument."); } if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.fragments = new java.util.ArrayList<>(); final TextFragment fragment = new TextFragment(text, font, paint); this.fragments.add(fragment); }
Another example:
public TextFragment(String text, Font font, Paint paint, float baselineOffset) { if (text == null) { throw new IllegalArgumentException("Null 'text' argument."); } if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.text = text; this.font = font; this.paint = paint; this.baselineOffset = baselineOffset; }