diff options
author | Amaresh Kumar <kamaresh@in.ibm.com> | 2018-08-31 18:04:15 +0530 |
---|---|---|
committer | Amaresh Kumar <kamaresh@in.ibm.com> | 2018-08-31 18:04:26 +0530 |
commit | f435e534f7d4653ee3cdac429acbfeec314d7ba4 (patch) | |
tree | dbfe641b7e0068448c4166f580b20d5dd482d813 /datarouter-prov/src/main/java/org | |
parent | e647d5737c2735262a9cee302eb82e83d19a27c1 (diff) |
Fixed Sonar Issues in NodeClass.java
https://sonar.onap.org/project/issues?fileUuids=AWHFaQiuEU5FCDfKtnFN&id=org.onap.dmaap.datarouter%3Aparent&open=AWHFaQp1EU5FCDfKtnb5&resolved=false&severities=BLOCKER
Issue-ID: DMAAP-683
Change-Id: I49551fc807d455d656eb84661b2507b85f681d4e
Signed-off-by: Amaresh Kumar <kamaresh@in.ibm.com>
Diffstat (limited to 'datarouter-prov/src/main/java/org')
-rwxr-xr-x | datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java index f3eb1eb6..1b368517 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java @@ -105,13 +105,14 @@ public abstract class NodeClass extends Syncable { public static void reload() {
Map<String, Integer> m = new HashMap<String, Integer>();
PreparedStatement ps = null;
+ ResultSet rs=null;
try {
DB db = new DB();
@SuppressWarnings("resource")
Connection conn = db.getConnection();
String sql = "select NODEID, NAME from NODES";
ps = conn.prepareStatement(sql);
- ResultSet rs = ps.executeQuery();
+ rs = ps.executeQuery();
while (rs.next()) {
int id = rs.getInt("NODEID");
String name = rs.getString("NAME");
@@ -127,6 +128,9 @@ public abstract class NodeClass extends Syncable { if(ps!=null){
ps.close();
}
+ if(rs!=null){
+ rs.close();
+ }
} catch (SQLException e) {
intLogger.error("PROV0005 doInsert: " + e.getMessage(),e);
|