diff options
author | Arindam Mondal <arind.mondal@samsung.com> | 2018-08-21 14:15:29 +0900 |
---|---|---|
committer | ONAP <arind.mondal@samsung.com> | 2018-08-21 14:15:48 +0900 |
commit | b249a2197ac91a056f24bff2b2fdfe342fdf9982 (patch) | |
tree | 1c8210ca4a9797a86394e69bb06a2897472bbb22 /adapters/mso-openstack-adapters/src | |
parent | 8ad7083991ee9e9a0c026028cebc6ab24ca4d272 (diff) |
sonar try-with-resources
Issue-ID: SO-871
Change-Id: I151ea890755c0a9dd9e7f5df1ed807a660fb0c2f
Signed-off-by: Arindam Mondal <arind.mondal@samsung.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src')
-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 fd2ec179dc..e4d5f94346 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 @@ -72,8 +72,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; @@ -102,8 +102,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; @@ -130,8 +130,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; |