-
-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextTitle throws a different exception from other related classes #205
Comments
For reference,
As an aside, I see the master branch moving towards |
For a short while, I decided moving to Objects.requireNonNull was a good idea because it's the Java standard approach. However, I came back to my original thinking that IllegalArgumentException is more correct, so I intend to switch back to that. The link you posted is excellent, I hadn't seen that before. |
Fixed on the master branch. |
TextTitle throws NullPointerException fo rnull parameters:
` public TextTitle(String text, Font font, Paint paint,
RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment,
RectangleInsets padding) {
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; }
The text was updated successfully, but these errors were encountered: