String mode) throws SvcLogicException {
DbLibService dbSvc = getDbLibService();
-
+ PreparedStatement fetchGraphStmt = null;
Connection dbConn = null;
SvcLogicGraph retval = null;
ResultSet results = null;
try {
dbConn = ((DBResourceManager) dbSvc).getConnection();
- PreparedStatement fetchGraphStmt;
+
ArrayList<String> args = new ArrayList<String>();
args.add(module);
} catch (Exception e) {
throw new ConfigurationException("Graph processing failed", e);
} finally {
+ try {
+ if (fetchGraphStmt != null) {
+ fetchGraphStmt.close();
+ }
+ } catch (SQLException e) {
+ LOG.info(e.getMessage());
+ }
if (results != null) {
try {
results.close();
}
Connection dbConn = null;
-
+ PreparedStatement storeGraphStmt = null;
try {
dbConn = ((DBResourceManager) dbSvc).getConnection();
boolean oldAutoCommit = dbConn.getAutoCommit();
dbConn.setAutoCommit(false);
- PreparedStatement storeGraphStmt = dbConn
+ storeGraphStmt = dbConn
.prepareStatement(storeGraphSql);
storeGraphStmt.setString(1, graph.getModule());
storeGraphStmt.setString(2, graph.getRpc());
} catch (Exception e) {
throw new SvcLogicException("Could not write object to database", e);
} finally {
+ try {
+ if (storeGraphStmt != null) {
+ storeGraphStmt.close();
+ }
+ } catch (SQLException e) {
+ LOG.info(e.getMessage());
+ }
try {
if (dbConn != null && !dbConn.isClosed()) {
dbConn.close();
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
File recordFile = new File(fileName);
PrintWriter recPrinter = null;
+ FileWriter fileWriter = null;
Date now = new Date();
TimeZone tz = TimeZone.getTimeZone("UTC");
try
{
- recPrinter = new PrintWriter(new FileWriter(recordFile, true));
+ recPrinter = new PrintWriter(fileWriter = new FileWriter(recordFile, true));
recPrinter.println(record);
}
catch (Exception e)
{
recPrinter.close();
}
+ if (fileWriter != null)
+ {
+ try {
+ fileWriter.close();
+ } catch (IOException e) {
+
+ }
+ }
}