Method com.hysoft.cache.mgmt.bulkload.DomLoad.getTotalNum(long, String) may fail to clean up java.sql.Statement
This method may fail to clean up (close, dispose of) a stream, database object, or other resource requiring an explicit cleanup operation.
In general, if a method opens a stream or other resource, the method should use a try/finally block to ensure that the stream or resource is cleaned up before the method returns.
This bug pattern is essentially the same as the OS_OPEN_STREAM and ODR_OPEN_DATABASE_RESOURCE bug patterns, but is based on a different (and hopefully better) static analysis technique. We are interested is getting feedback about the usefulness of this bug pattern. To send feedback, either:
In particular, the false-positive suppression heuristics for this bug pattern have not been extensively tuned, so reports about false positives are helpful to us.
See Weimer and Necula, Finding and Preventing Run-Time Error Handling Mistakes, for a description of the analysis technique.
解决办法:
try{
....
} catch (Exception e) {
LOG.info(e);
e.printStackTrace();
} finally {
try {
if (resultSet != null) {
resultSet.close();
}
} catch (SQLException e) {
LOG.info(e);
e.printStackTrace();
}
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
LOG.info(e);
e.printStackTrace();
}
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
LOG.info(e);
e.printStackTrace();
}
}
分享到:
相关推荐
[21天学通Java.6(第5版)].Rogers.Cadenhead&Laura;.Lemay.扫描版[21天学通Java.6(第5版)].Rogers.Cadenhead&Laura;.Lemay.扫描版[21天学通Java.6(第5版)].Rogers.Cadenhead&Laura;.Lemay.扫描版
Apress.Pro.SQL.Server.2008.Policy.Based.Management.May.2010.rar
下完这两个文件后改名为Core.JavaServer.Faces.Second.Edition.May.2007.part1.rar和Core.JavaServer.Faces.Second.Edition.May.2007.part2.rar放在一起解压
下完这两个文件后改名为Core.JavaServer.Faces.Second.Edition.May.2007.part1.rar和Core.JavaServer.Faces.Second.Edition.May.2007.part2.rar放在一起解压
Sams.Teach.Yourself.SQL.in.24.Hours.5th.Edition.May.2011.pdf This book is dedicated to my parents, Thomas and Karlyn Stephens, who always taught me that I can achieve anything if determined. This book...
Apress.Beginning.SQL.Server.2012.for.Developers.3rd.Edition.May.2012
* Executes the given SQL statement, which may be an <code>INSERT, * <code>UPDATE, or <code>DELETE</code> statement or an SQL * statement that returns nothing, such as an SQL DDL statement. 执行给定...
SOA.Using.Java.Web.Services.May.2007.pdf
Addison.Wesley.Java.Concurrency.in.Practice.May.2006.pdf 最新的java多线程书籍,英文版
Pragmatic.SQL.Antipatterns.May.2010.pdf
Apress.Accelerated.SQL.Server.2008.May.2008
Addison.Wesley.Java.Concurrency.in.Practice.May.2006
OCA.Oracle.Database.11g.SQL.Fundamentals.I.Exam.Guide.Exam.1Z0-051.May.2008.eBook-DDU
Addison.Wesley.Java.Concurrency.in.Practice.May.2006
Oracle.Database.11g.SQL.Fundamentals.I.Exam.Guide.Exam.1Z0-051.May.2008.rar DBA必读 别说你不知道
McGraw.Hill.Osborne.Media.OCA.Oracle.Database.11g.SQL.Fundamentals.I.Exam.Guide.Exam.1Z0-051.May.2008.eBook-DDU
Prentice.Hall.SOA.Using.Java.Web.Services.May.2007
Sams.Agile.Java.Development.with.Spring.Hibernate.and.Eclipse.May.2006
THIS book covers the Java™ Native Interface (JNI). It will be useful to you if you are interested in any of the following: • integrating a Java application with legacy code written in languages such...