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

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

上级 36c367e7
......@@ -323,10 +323,14 @@ public class TestXA extends TestBase {
JdbcUtils.closeSilently(stat2);
JdbcUtils.closeSilently(conn1);
JdbcUtils.closeSilently(conn2);
if (xaConn1 != null) {
xaConn1.close();
}
if (xaConn2 != null) {
xaConn2.close();
}
}
}
private XADataSource createXADatasource(boolean useOneDatabase, String url) {
JdbcDataSource ds = new JdbcDataSource();
......
......@@ -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);
}
}
if (p != null) {
p.flush();
p.close();
IOUtils.closeSilently(out);
IOUtils.closeSilently(p);
}
}
}
......
......@@ -564,16 +564,20 @@ public class TestPageStore extends TestBase implements DatabaseEventListener {
conn.close();
FileUtils.delete(getBaseDir() + "/pageStore.sql");
} catch (Exception e) {
if (stat != null) {
try {
stat.execute("shutdown immediately");
} catch (SQLException e2) {
// ignore
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e2) {
// ignore
}
}
throw new RuntimeException("count: " + count, e);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论