IDEMPIERE-2555 Fact Reconciliation statement leak

This commit is contained in:
Carlos Ruiz 2015-04-01 09:40:13 -05:00
parent 2dfefe0ecd
commit 7b07b58314
1 changed files with 13 additions and 14 deletions

View File

@ -17,7 +17,6 @@
package org.compiere.process; package org.compiere.process;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.logging.Level; import java.util.logging.Level;
@ -118,7 +117,6 @@ public class FactReconcile extends SvrProcess
if (log.isLoggable(Level.INFO)) log.info("AD_PInstance_ID= " + getAD_PInstance_ID()); if (log.isLoggable(Level.INFO)) log.info("AD_PInstance_ID= " + getAD_PInstance_ID());
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null;
int count; int count;
int unmatched; int unmatched;
@ -144,6 +142,7 @@ public class FactReconcile extends SvrProcess
pstmt.setInt(1, seq.getAD_Sequence_ID()); pstmt.setInt(1, seq.getAD_Sequence_ID());
pstmt.setInt(2, account.get_ID()); pstmt.setInt(2, account.get_ID());
count = pstmt.executeUpdate(); count = pstmt.executeUpdate();
DB.close(pstmt); pstmt = null;
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Inserted " + count + " new facts into Fact_Reconciliation"); if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Inserted " + count + " new facts into Fact_Reconciliation");
// set the matchcode based on the rule found in AD_Rule // set the matchcode based on the rule found in AD_Rule
@ -160,6 +159,7 @@ public class FactReconcile extends SvrProcess
pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt = DB.prepareStatement(sql, get_TrxName());
pstmt.setInt(1, account.get_ID()); pstmt.setInt(1, account.get_ID());
count = pstmt.executeUpdate(); count = pstmt.executeUpdate();
DB.close(pstmt); pstmt = null;
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Updated " + count + " match codes."); if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Updated " + count + " match codes.");
@ -180,7 +180,6 @@ public class FactReconcile extends SvrProcess
unmatched = pstmt.executeUpdate(); unmatched = pstmt.executeUpdate();
if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Cleared match codes from " + unmatched + " unreconciled facts."); if (log.isLoggable(Level.FINE))log.log(Level.FINE, "Cleared match codes from " + unmatched + " unreconciled facts.");
} }
catch (SQLException e) catch (SQLException e)
{ {
@ -189,8 +188,8 @@ public class FactReconcile extends SvrProcess
} }
finally finally
{ {
DB.close(rs, pstmt); DB.close(pstmt);
rs = null; pstmt = null; pstmt = null;
} }
return "Matched " + (count-unmatched) + " facts"; return "Matched " + (count-unmatched) + " facts";