diff options
author | 2018-09-20 19:51:53 +0900 | |
---|---|---|
committer | 2018-09-20 20:02:02 +0900 | |
commit | 417c0ab02b909f19cea5fa947a10c2089789d363 (patch) | |
tree | f822131dd0d60b5da21555133320b827f91c26a4 /UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java | |
parent | d6680d72e53df89e607f3aa2f84e4b1a28c74a88 (diff) |
Fix try-with-resources
Issue-ID: DCAEGEN2-818
Change-Id: I7d8afc8bb78c9534671602ed37db7f6d14f5de81
Signed-off-by: arind.mondal <arind.mondal@samsung.com>
Diffstat (limited to 'UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java')
-rw-r--r-- | UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java index ca1bcc9..b63eb1e 100644 --- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java +++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/service/VESAdapterInitializer.java @@ -147,10 +147,9 @@ public class VESAdapterInitializer implements CommandLineRunner, Ordered { } public void fetchMappingFile() { - try (Connection con = DriverManager.getConnection(dBurl, user, pwd)) { + String query = "SELECT * FROM mapping_file"; + try (Connection con = DriverManager.getConnection(dBurl, user, pwd);PreparedStatement pstmt = con.prepareStatement(query);ResultSet rs = pstmt.executeQuery();) { LOGGER.info("Retrieving data from DB"); - PreparedStatement pstmt = con.prepareStatement("SELECT * FROM mapping_file"); - ResultSet rs = pstmt.executeQuery(); // parsing the column each time is a linear search int column1Pos = rs.findColumn("enterpriseid"); int column2Pos = rs.findColumn("mappingfilecontents"); |