Lei Rui created IOTDB-5433:
------------------------------
Summary: IndexOutOfBoundsException: ExactOrderStatistics
constructs an empty ArrayList and then sets it
Key: IOTDB-5433
URL: https://issues.apache.org/jira/browse/IOTDB-5433
Project: Apache IoTDB
Issue Type: Bug
Reporter: Lei Rui
For example:
{code:java}
public static double getMad(LongArrayList nums) {
if (nums.isEmpty()) {
throw new NoSuchElementException();
} else {
double median = getMedian(nums);
DoubleArrayList dal = new DoubleArrayList();
for (int i = 0; i < nums.size(); ++i) {
dal.set(i, Math.abs(nums.get(i) - median));
}
return getMedian(dal);
}
}
{code}
"DoubleArrayList dal = new DoubleArrayList();" will construct an empty list,
and dal.set(...) will throw IndexOutOfBoundsException.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)