[exo-jcr-commits] exo-jcr SVN: r5706 - core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/utils.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Feb 29 01:57:09 EST 2012
Author: tolusha
Date: 2012-02-29 01:57:09 -0500 (Wed, 29 Feb 2012)
New Revision: 5706
Modified:
core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/utils/JDBCUtils.java
Log:
EXOJCR-1762: auto-repair for VS and Lock inconsistency
Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/utils/JDBCUtils.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/utils/JDBCUtils.java 2012-02-29 06:53:12 UTC (rev 5705)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/utils/JDBCUtils.java 2012-02-29 06:57:09 UTC (rev 5706)
@@ -86,28 +86,7 @@
}
finally
{
- if (trs != null)
- {
- try
- {
- trs.close();
- }
- catch (SQLException e)
- {
- LOG.error("Can't close the ResultSet: " + e.getMessage());
- }
- }
- if (stmt != null)
- {
- try
- {
- stmt.close();
- }
- catch (SQLException e)
- {
- LOG.error("Can't close the Statement: " + e.getMessage());
- }
- }
+ freeResources(trs, stmt, null);
}
}
@@ -190,4 +169,47 @@
return resource.split(SQL_DELIMITER);
}
}
+
+ /**
+ * Closes database related resources.
+ */
+ public static void freeResources(ResultSet resultSet, Statement statement, Connection conn)
+ {
+ if (resultSet != null)
+ {
+ try
+ {
+ resultSet.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ if (statement != null)
+ {
+ try
+ {
+ statement.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ if (conn != null)
+ {
+ try
+ {
+ conn.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+ }
+
}
More information about the exo-jcr-commits
mailing list