提交 7a35f760 authored 作者: noelgrandin's avatar noelgrandin

use eclipse's null analysis to fix some potential null accesses

上级 36c367e7
......@@ -323,8 +323,12 @@ public class TestXA extends TestBase {
JdbcUtils.closeSilently(stat2);
JdbcUtils.closeSilently(conn1);
JdbcUtils.closeSilently(conn2);
xaConn1.close();
xaConn2.close();
if (xaConn1 != null) {
xaConn1.close();
}
if (xaConn2 != null) {
xaConn2.close();
}
}
}
......
......@@ -307,11 +307,9 @@ public class TestRecover {
}
private static boolean testConsistency() {
FileOutputStream out = null;
PrintWriter p = null;
try {
out = new FileOutputStream(TEST_DIRECTORY + "/result.txt");
p = new PrintWriter(out);
p = new PrintWriter(new FileOutputStream(TEST_DIRECTORY + "/result.txt"));
p.println("Results");
p.flush();
} catch (Throwable t) {
......@@ -338,9 +336,11 @@ public class TestRecover {
t2.printStackTrace(p);
}
}
p.flush();
p.close();
IOUtils.closeSilently(out);
if (p != null) {
p.flush();
p.close();
IOUtils.closeSilently(p);
}
}
}
......
......@@ -564,15 +564,19 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
conn.close();
FileUtils.delete(getBaseDir() + "/pageStore.sql");
} catch (Exception e) {
try {
stat.execute("shutdown immediately");
} catch (SQLException e2) {
// ignore
if (stat != null) {
try {
stat.execute("shutdown immediately");
} catch (SQLException e2) {
// ignore
}
}
try {
conn.close();
} catch (SQLException e2) {
// ignore
if (conn != null) {
try {
conn.close();
} catch (SQLException e2) {
// ignore
}
}
throw new RuntimeException("count: " + count, e);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论