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

[BUG] NPE when minBound/maxBound is not set before being called #3604

Closed
GeorgeAp opened this issue Jun 16, 2022 · 0 comments
Closed

[BUG] NPE when minBound/maxBound is not set before being called #3604

GeorgeAp opened this issue Jun 16, 2022 · 0 comments
Labels
bug Something isn't working v2.1.0 Issues and PRs related to version 2.1.0 v3.0.0 Issues and PRs related to version 3.0.0

Comments

@GeorgeAp
Copy link
Contributor

Describe the bug
A NullPointerException occurs when the methods minBound() and maxBound

/** Get the current minimum bound that is set on this builder. */
public double minBound() {
return extendedBounds.getMin();
}
/** Get the current maximum bound that is set on this builder. */
public double maxBound() {
return extendedBounds.getMax();
}

are called before they are set in DoubleBounds

public Double getMin() {
return min;
}
public Double getMax() {
return max;
}

To Reproduce
A unit test that does not set the min and max values, example for the minBound:

public void testNPE() {
        HistogramAggregationBuilder factory = new HistogramAggregationBuilder("foo");

        try {
            factory.minBound();
        }
        catch (Exception e) {
            assertThat(e, instanceOf(NullPointerException.class));
        }
    }

Expected behavior
It should return null

Host/Environment (please complete the following information):

  • Java version : 11
  • OS: Ubuntu
  • Version 20.04.4 LTS
@GeorgeAp GeorgeAp added bug Something isn't working untriaged labels Jun 16, 2022
@reta reta added v2.1.0 Issues and PRs related to version 2.1.0 v3.0.0 Issues and PRs related to version 3.0.0 and removed untriaged labels Jun 16, 2022
@reta reta closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v2.1.0 Issues and PRs related to version 2.1.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

No branches or pull requests

2 participants