cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaanHoogland <...@git.apache.org>
Subject [GitHub] cloudstack pull request: asserted coverity resource leak issues
Date Fri, 17 Jul 2015 09:30:17 GMT
Github user DaanHoogland commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/599#discussion_r34874962
  
    --- Diff: framework/db/src/com/cloud/utils/db/Merovingian2.java ---
    @@ -63,9 +63,7 @@
         private Merovingian2(long msId) {
             super(MerovingianMBean.class, false);
             _msId = msId;
    -        Connection conn = null;
    -        try {
    -            conn = TransactionLegacy.getStandaloneConnectionWithException();
    +        try (Connection conn = TransactionLegacy.getStandaloneConnectionWithException();)
{
    --- End diff --
    
    ok : 
            Connection conn = null;
            try {
                conn = TransactionLegacy.getStandaloneConnectionWithException();
                conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
                conn.setAutoCommit(true);
                _concierge = new ConnectionConcierge("LockMaster", conn, true);
            } catch (SQLException e) {
                s_logger.error("Unable to get a new db connection", e);
                throw new CloudRuntimeException("Unable to initialize a connection to the
database for locking purposes", e);
            } finally {
                if (_concierge == null && conn != null) {
                    try {
                        conn.close();
                    } catch (SQLException e) {
                        s_logger.debug("closing connection failed after everything else.",
e);
                    }
                }



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message