cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 9363be3
Date Fri, 16 Oct 2015 11:55:20 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 2ce5a0c96 -> 9363be339


CLOUDSTACK-8923: Create storage network IP range failed

transaction.getConnection() was wrapped in try-with-resource.
This caused transaction to get closed even before its committed.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/79b7391c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79b7391c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79b7391c

Branch: refs/heads/master
Commit: 79b7391c22ba088a78a073471ab70af5ce9d03dc
Parents: 2ce5a0c
Author: Rajani Karuturi <rajani.karuturi@citrix.com>
Authored: Thu Oct 15 15:03:31 2015 +0530
Committer: Rajani Karuturi <rajani.karuturi@citrix.com>
Committed: Fri Oct 16 09:42:48 2015 +0530

----------------------------------------------------------------------
 .../network/StorageNetworkManagerImpl.java      | 25 ++++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79b7391c/server/src/com/cloud/network/StorageNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/StorageNetworkManagerImpl.java b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
index 76a51d9..1e6616f 100644
--- a/server/src/com/cloud/network/StorageNetworkManagerImpl.java
+++ b/server/src/com/cloud/network/StorageNetworkManagerImpl.java
@@ -104,20 +104,19 @@ public class StorageNetworkManagerImpl extends ManagerBase implements
StorageNet
         String insertSql =
             "INSERT INTO `cloud`.`op_dc_storage_network_ip_address` (range_id, ip_address,
mac_address, taken) VALUES (?, ?, (select mac_address from `cloud`.`data_center` where id=?),
?)";
         String updateSql = "UPDATE `cloud`.`data_center` set mac_address = mac_address+1
where id=?";
-        try (Connection conn = txn.getConnection();) {
-            while (startIPLong <= endIPLong) {
-                try (PreparedStatement stmt_insert = conn.prepareStatement(insertSql); )
{
-                    stmt_insert.setLong(1, rangeId);
-                    stmt_insert.setString(2, NetUtils.long2Ip(startIPLong++));
-                    stmt_insert.setLong(3, zoneId);
-                    stmt_insert.setNull(4, java.sql.Types.DATE);
-                    stmt_insert.executeUpdate();
-                }
+        Connection conn = txn.getConnection();
+        while (startIPLong <= endIPLong) {
+            try (PreparedStatement stmt_insert = conn.prepareStatement(insertSql);) {
+                stmt_insert.setLong(1, rangeId);
+                stmt_insert.setString(2, NetUtils.long2Ip(startIPLong++));
+                stmt_insert.setLong(3, zoneId);
+                stmt_insert.setNull(4, java.sql.Types.DATE);
+                stmt_insert.executeUpdate();
+            }
 
-                try (PreparedStatement stmt_update = txn.prepareStatement(updateSql);) {
-                    stmt_update.setLong(1, zoneId);
-                    stmt_update.executeUpdate();
-                }
+            try (PreparedStatement stmt_update = txn.prepareStatement(updateSql);) {
+                stmt_update.setLong(1, zoneId);
+                stmt_update.executeUpdate();
             }
         }
     }


Mime
View raw message