我用静态代码分析器扫描了我的代码,得到了未发布的资源:数据库错误。我正在关闭以下所有db连接,这是我的代码的快照。
public String methodInDAO(Bean bean) throws SQLException ,Exception
{
Session session = null;
Connection connection = null;
ResultSet resultSet1 = null;
CallableStatement callableStatement = null;
try {
connection = dataSource.getConnection();
callableStatement = connection.prepareCall(query);
resultSet1 = callableStatement.execute();
//code operations
} finally {
if(null != callableStatement)
callableStatement.close();
resultSet1 = null;
callableStatement = null;
if(null != connection)
connection.close();
if (null != session)
session.close();
}
return returnOutput;
}所有抛出的异常都在服务层处理。有人能建议哪里没有发布数据源吗?
发布于 2014-10-20 12:46:39
https://stackoverflow.com/questions/26466009
复制相似问题