-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[BUG] NPE when minBound/maxBound is not set before being called #3604
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingv2.1.0Issues and PRs related to version 2.1.0Issues and PRs related to version 2.1.0v3.0.0Issues and PRs related to version 3.0.0Issues and PRs related to version 3.0.0
Description
Describe the bug
A NullPointerException occurs when the methods minBound() and maxBound
Lines 228 to 236 in 8844f05
| /** 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
Lines 154 to 160 in 8844f05
| 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingv2.1.0Issues and PRs related to version 2.1.0Issues and PRs related to version 2.1.0v3.0.0Issues and PRs related to version 3.0.0Issues and PRs related to version 3.0.0