提交 ec66b936 authored 作者: Thomas Mueller's avatar Thomas Mueller

Views: in some situations, an ArrayIndexOutOfBoundsException was thrown when…

Views: in some situations, an ArrayIndexOutOfBoundsException was thrown when using the same view concurrently.
上级 b6db8379
...@@ -107,9 +107,7 @@ public class ViewIndex extends BaseIndex { ...@@ -107,9 +107,7 @@ public class ViewIndex extends BaseIndex {
} }
} }
Query query = (Query) session.prepare(querySQL, true); Query query = (Query) session.prepare(querySQL, true);
if (masks == null) { if (masks != null) {
columns = new Column[0];
} else {
IntArray paramIndex = new IntArray(); IntArray paramIndex = new IntArray();
for (int i = 0; i < masks.length; i++) { for (int i = 0; i < masks.length; i++) {
int mask = masks[i]; int mask = masks[i];
...@@ -119,11 +117,8 @@ public class ViewIndex extends BaseIndex { ...@@ -119,11 +117,8 @@ public class ViewIndex extends BaseIndex {
paramIndex.add(i); paramIndex.add(i);
} }
int len = paramIndex.size(); int len = paramIndex.size();
columns = new Column[len];
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
int idx = paramIndex.get(i); int idx = paramIndex.get(i);
Column col = table.getColumn(idx);
columns[i] = col;
int mask = masks[idx]; int mask = masks[idx];
int nextParamIndex = query.getParameters().size() + view.getParameterOffset(); int nextParamIndex = query.getParameters().size() + view.getParameterOffset();
if ((mask & IndexCondition.EQUALITY) != 0) { if ((mask & IndexCondition.EQUALITY) != 0) {
......
...@@ -84,7 +84,7 @@ public class TestView extends TestBase { ...@@ -84,7 +84,7 @@ public class TestView extends TestBase {
s.execute("select * from t" + (i + 1)); s.execute("select * from t" + (i + 1));
ResultSet rs = s.executeQuery("select count(*) from t" + (i + 1) + " where id=2"); ResultSet rs = s.executeQuery("select count(*) from t" + (i + 1) + " where id=2");
assertTrue(rs.next()); assertTrue(rs.next());
assertEquals(rs.getInt(1), 1); assertEquals(1, rs.getInt(1));
} }
conn.close(); conn.close();
conn = getConnection("view"); conn = getConnection("view");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论