summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2017-05-10 15:56:01 -0500
committerJorge Hernandez <jh1730@att.com>2017-05-10 15:56:01 -0500
commitb90795e142b490549db86a40007f3eab813bc67c (patch)
treecbc67382e6a6764394cdc215e3ec04f99fbf1ebc
parent0dfbb8790926ad24d1e124ee2acd18d108e358b5 (diff)
[POLICY-12] tackle policy-persistence/DBaudit.java
Deals with the following reports: Description Resource Path Location Type Resource leak: 'statement' is not closed at this location DbAudit.java /policy-persistence/src/main/java/org/openecomp/policy/drools/core line 135 Java Problem Description Resource Path Location Type Resource leak: 'statement' is not closed at this location DbAudit.java /policy-persistence/src/main/java/org/openecomp/policy/drools/core line 142 Java Problem Description Resource Path Location Type Resource leak: 'statement' is not closed at this location DbAudit.java /policy-persistence/src/main/java/org/openecomp/policy/drools/core line 160 Java Problem Change-Id: I16c6698ee9b659add11d3bc62abb38a3d1792049 Signed-off-by: Jorge Hernandez <jh1730@att.com>
-rw-r--r--policy-persistence/src/main/java/org/openecomp/policy/drools/core/DbAudit.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/policy-persistence/src/main/java/org/openecomp/policy/drools/core/DbAudit.java b/policy-persistence/src/main/java/org/openecomp/policy/drools/core/DbAudit.java
index 51e92aa9..f534cc22 100644
--- a/policy-persistence/src/main/java/org/openecomp/policy/drools/core/DbAudit.java
+++ b/policy-persistence/src/main/java/org/openecomp/policy/drools/core/DbAudit.java
@@ -126,6 +126,7 @@ public class DbAudit extends DroolsPDPIntegrityMonitor.AuditBase
+ " UNIQUE KEY name (name)\n"
+ ") DEFAULT CHARSET=latin1;");
statement.execute();
+ statement.close();
createTableNeeded = false;
}
@@ -136,6 +137,7 @@ public class DbAudit extends DroolsPDPIntegrityMonitor.AuditBase
("INSERT INTO Audit (name) VALUES (?)");
statement.setString(1, key);
statement.executeUpdate();
+ statement.close();
// fetch the entry from the table
phase = "fetch entry";
@@ -154,6 +156,7 @@ public class DbAudit extends DroolsPDPIntegrityMonitor.AuditBase
("DbAudit: can't find newly-created entry with key " + key);
setResponse("Can't find newly-created entry");
}
+ statement.close();
// delete entries from table
phase = "delete entry";
@@ -161,6 +164,8 @@ public class DbAudit extends DroolsPDPIntegrityMonitor.AuditBase
("DELETE FROM Audit WHERE name = ?");
statement.setString(1, key);
statement.executeUpdate();
+ statement.close();
+ statement = null;
}
catch (Exception e)
{