提交 b45115c6 authored 作者: Noel Grandin's avatar Noel Grandin

catching NullPointerException is very bad practice

and makes finding real NPE problems super hard
上级 c3b962ad
......@@ -50,6 +50,7 @@ public class RangeIndex extends BaseIndex {
long min = rangeTable.getMin(session);
long max = rangeTable.getMax(session);
long step = rangeTable.getStep(session);
if (first != null) {
try {
long v = first.getValue(0).getLong();
if (step > 0) {
......@@ -59,9 +60,11 @@ public class RangeIndex extends BaseIndex {
} else if (v > max) {
max = v;
}
} catch (Exception e) {
} catch (DbException e) {
// error when converting the value - ignore
}
}
if (last != null) {
try {
long v = last.getValue(0).getLong();
if (step > 0) {
......@@ -71,9 +74,10 @@ public class RangeIndex extends BaseIndex {
} else if (v < min) {
min -= (min - v - step - 1) / step * step;
}
} catch (Exception e) {
} catch (DbException e) {
// error when converting the value - ignore
}
}
return new RangeCursor(session, min, max, step);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论