diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-08-22 05:39:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-22 05:39:33 +0000 |
commit | 52e25ed16777518b4c0a65c7c441c1f74f8b5965 (patch) | |
tree | ce562ae3260d6f3ac7e1a9440fb4d4b035b9ec12 /adapters | |
parent | 4d4177a26a5ccbead0da4818cbf93be6aeb39617 (diff) | |
parent | b249a2197ac91a056f24bff2b2fdfe342fdf9982 (diff) |
Merge "sonar try-with-resources"
Diffstat (limited to 'adapters')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java index 87ea49ee5e..ed64abd982 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java @@ -96,8 +96,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro LOGGER.debug("Starting migration for CloudConfig-->IdentityService"); String insert = "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`) " + "VALUES (?,?,?,?,?,?,?,?,?,?);"; - PreparedStatement ps = connection.prepareStatement(insert); - try (Statement stmt = connection.createStatement()) { + + try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) { for (CloudIdentity cloudIdentity : entities) { try (ResultSet rows = stmt.executeQuery("Select count(1) from identity_services where id='" + cloudIdentity.getId() + "'")) { int count = 0; @@ -126,8 +126,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro LOGGER.debug("Starting migration for CloudConfig-->CloudSite"); String insert = "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) " + "VALUES (?,?,?,?,?,?,?,?,?);"; - PreparedStatement ps = connection.prepareStatement(insert); - try (Statement stmt = connection.createStatement()) { + + try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) { for (CloudSite cloudSite : entities) { try (ResultSet rows = stmt.executeQuery("Select count(1) from cloud_sites where id='" + cloudSite.getId() + "'")) { int count = 0; @@ -154,8 +154,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws Exception { String insert = "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)" + " VALUES (?,?,?,?,?,?);"; - PreparedStatement ps = connection.prepareStatement(insert); - try (Statement stmt = connection.createStatement()) { + + try (Statement stmt = connection.createStatement();PreparedStatement ps = connection.prepareStatement(insert)) { for (CloudifyManager cloudifyManager : entities) { try (ResultSet rows = stmt.executeQuery("Select count(1) from cloudify_managers where id='" + cloudifyManager.getId() + "'")) { int count = 0; |