Skip to content
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

Inconsistency regarding exceptions #417

Open
TobiasKiecker opened this issue Sep 2, 2024 · 0 comments
Open

Inconsistency regarding exceptions #417

TobiasKiecker opened this issue Sep 2, 2024 · 0 comments

Comments

@TobiasKiecker
Copy link

I noticed a general lack of consistency regarding documentation, code and exceptions.
Particularly, I noticed two examples:

  1. in AbstractRenderer
    the method setDefaultItemLabelFont(Font font, boolean notify)
    is missing a null check for the parameter font like the method setDefaultItemLabelFont(Font font) has, and the doc of both suggests.

proposed code:

    public void setDefaultItemLabelFont(Font font, boolean notify) {
        Args.nullNotPermitted(font, "font");
        this.defaultItemLabelFont = font;
        if (notify) {
            fireChangeEvent();
        }
    }
  1. in CustomPieURLGenerator
    the method getURLCount(int plotIndex) needs a check of the boundaries for the provided index, similar to what getURL(Comparable<?> key, int plotIndex) has. Instead, the exception that may arise from calling_urlMaps.get(plotIndex)_ could be documented.

proposed code:

    public int getURLCount(int plotIndex) {
        int count = 0;
        if (plotIndex >= 0 && plotIndex < urlMaps.size()) {
            Map<Comparable<?>, String> map = urlMaps.get(plotIndex);
            if (map != null) {
                count = map.size();
            }
        }
        return count;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant