Closed
Description
The following program causes a null pointer exception to be thrown. I would expect it to complete successfully and output false
.
import edu.stanford.nlp.util.Interval;
import edu.stanford.nlp.util.IntervalTree;
public class Main {
public static void main(String[] args) {
var tree = new IntervalTree<Integer, Interval<Integer>>();
tree.add(Interval.toInterval(0, 1));
tree.add(Interval.toInterval(2, 5));
tree.remove(Interval.toInterval(2, 5));
System.out.println(tree.overlaps(Interval.toInterval(2, 3)));
}
}
Exception in thread "main" java.lang.NullPointerException: Cannot read field "value" because "anotherInteger" is null
at java.base/java.lang.Integer.compareTo(Integer.java:1466)
at java.base/java.lang.Integer.compareTo(Integer.java:72)
at edu.stanford.nlp.util.Interval.max(Interval.java:424)
at edu.stanford.nlp.util.IntervalTree.remove(IntervalTree.java:284)
at edu.stanford.nlp.util.IntervalTree.remove(IntervalTree.java:214)
at test.Main.main(Main.java:13)
Metadata
Metadata
Assignees
Labels
No labels