IDEMPIERE-2544:to more warning compiler hidden good warning
leak resource
This commit is contained in:
parent
d3107ced16
commit
1cac3f646f
|
@ -353,8 +353,9 @@ public class ReplicationLocal extends SvrProcess
|
||||||
// no keys - search for parents
|
// no keys - search for parents
|
||||||
if (list.size() == 0)
|
if (list.size() == 0)
|
||||||
{
|
{
|
||||||
DB.close(rs);
|
DB.close(rs, pstmt);
|
||||||
rs = null;
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
sql = "SELECT ColumnName FROM AD_Column "
|
sql = "SELECT ColumnName FROM AD_Column "
|
||||||
+ "WHERE AD_Table_ID=?"
|
+ "WHERE AD_Table_ID=?"
|
||||||
+ " AND IsParent='Y'";
|
+ " AND IsParent='Y'";
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.compiere.impexp;
|
package org.compiere.impexp;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.compiere.model.MBankStatementLoader;
|
import org.compiere.model.MBankStatementLoader;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -71,6 +72,13 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im
|
||||||
{
|
{
|
||||||
m_errorMessage = new StringBuffer("ErrorReadingData");
|
m_errorMessage = new StringBuffer("ErrorReadingData");
|
||||||
m_errorDescription = new StringBuffer();
|
m_errorDescription = new StringBuffer();
|
||||||
|
}finally{
|
||||||
|
if (m_stream != null)
|
||||||
|
try {
|
||||||
|
m_stream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1625,6 +1625,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
.append("FROM C_DocType dt, C_Order o ")
|
.append("FROM C_DocType dt, C_Order o ")
|
||||||
.append("WHERE o.C_DocTypeTarget_ID=dt.C_DocType_ID")
|
.append("WHERE o.C_DocTypeTarget_ID=dt.C_DocType_ID")
|
||||||
.append(" AND o.C_Order_ID=?");
|
.append(" AND o.C_Order_ID=?");
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
pstmt.setInt(1, C_Order_ID);
|
pstmt.setInt(1, C_Order_ID);
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.compiere.process;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -51,9 +50,7 @@ public class FactReconciliation extends SvrProcess
|
||||||
*/
|
*/
|
||||||
protected String doIt()
|
protected String doIt()
|
||||||
{
|
{
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
|
||||||
|
|
||||||
String sql = "INSERT into T_Reconciliation " +
|
String sql = "INSERT into T_Reconciliation " +
|
||||||
"(AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, " +
|
"(AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, " +
|
||||||
|
@ -69,8 +66,6 @@ public class FactReconciliation extends SvrProcess
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getAD_PInstance_ID());
|
pstmt.setInt(1, getAD_PInstance_ID());
|
||||||
pstmt.setInt(2, p_Account_ID);
|
pstmt.setInt(2, p_Account_ID);
|
||||||
|
@ -88,25 +83,26 @@ public class FactReconciliation extends SvrProcess
|
||||||
" AND r.AD_PInstance_ID = t.AD_PInstance_ID) = 0 " +
|
" AND r.AD_PInstance_ID = t.AD_PInstance_ID) = 0 " +
|
||||||
"AND t.AD_PInstance_ID = ?";
|
"AND t.AD_PInstance_ID = ?";
|
||||||
|
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
DB.close(pstmt);
|
||||||
pstmt.setInt(1, getAD_PInstance_ID());
|
pstmt = null;
|
||||||
count = pstmt.executeUpdate();
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
result = Msg.getMsg(getCtx(), "@Deleted@") + ": " + count;
|
pstmt.setInt(1, getAD_PInstance_ID());
|
||||||
|
count = pstmt.executeUpdate();
|
||||||
|
result = Msg.getMsg(getCtx(), "@Deleted@") + ": " + count;
|
||||||
|
|
||||||
|
if (log.isLoggable(Level.FINE))log.log(Level.FINE, result);
|
||||||
|
|
||||||
if (log.isLoggable(Level.FINE))log.log(Level.FINE, result);
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
}
|
log.log(Level.SEVERE, sql, e);
|
||||||
catch (SQLException e)
|
return e.getLocalizedMessage();
|
||||||
{
|
}
|
||||||
log.log(Level.SEVERE, sql, e);
|
finally
|
||||||
return e.getLocalizedMessage();
|
{
|
||||||
}
|
DB.close(pstmt);
|
||||||
finally
|
pstmt = null;
|
||||||
{
|
}
|
||||||
DB.close(rs, pstmt);
|
|
||||||
rs = null; pstmt = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (log.isLoggable(Level.FINE)) log.fine((System.currentTimeMillis() - m_start) + " ms");
|
if (log.isLoggable(Level.FINE)) log.fine((System.currentTimeMillis() - m_start) + " ms");
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.compiere.tools;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -165,32 +164,15 @@ public class Strip
|
||||||
private boolean copy (File infile, File outfile)
|
private boolean copy (File infile, File outfile)
|
||||||
{
|
{
|
||||||
FileInputStream fis = null;
|
FileInputStream fis = null;
|
||||||
try
|
|
||||||
{
|
|
||||||
fis = new FileInputStream(infile);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException fnfe)
|
|
||||||
{
|
|
||||||
System.err.println(fnfe);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
FileOutputStream fos = null;
|
FileOutputStream fos = null;
|
||||||
try
|
try{
|
||||||
{
|
fis = new FileInputStream(infile);
|
||||||
fos = new FileOutputStream(outfile, false); // no append
|
fos = new FileOutputStream(outfile, false); // no append
|
||||||
}
|
|
||||||
catch (FileNotFoundException fnfe)
|
int noIn = 0;
|
||||||
{
|
int noOut = 0;
|
||||||
System.err.println(fnfe);
|
int noLines = 1;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int noIn = 0;
|
|
||||||
int noOut = 0;
|
|
||||||
int noLines = 1;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = fis.read()) != -1)
|
while ((c = fis.read()) != -1)
|
||||||
{
|
{
|
||||||
|
@ -203,15 +185,24 @@ public class Strip
|
||||||
if (c == 13) // cr
|
if (c == 13) // cr
|
||||||
noLines++;
|
noLines++;
|
||||||
}
|
}
|
||||||
fis.close();
|
System.out.println(" read: " + noIn + ", written: " + noOut + " - lines: " + noLines);
|
||||||
fos.close();
|
}catch (IOException ioe)
|
||||||
}
|
|
||||||
catch (IOException ioe)
|
|
||||||
{
|
{
|
||||||
System.err.println(ioe);
|
System.err.println(ioe);
|
||||||
return false;
|
return false;
|
||||||
|
}finally{
|
||||||
|
if (fos != null)
|
||||||
|
try {
|
||||||
|
fos.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
if (fis != null)
|
||||||
|
try {
|
||||||
|
fis.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println(" read: " + noIn + ", written: " + noOut + " - lines: " + noLines);
|
|
||||||
return true;
|
return true;
|
||||||
} // stripIt
|
} // stripIt
|
||||||
|
|
||||||
|
|
|
@ -233,20 +233,25 @@ public class PackIn {
|
||||||
ZipFile zf = new ZipFile(m_packageDirectory+File.separator+"blobs"+File.separator+fileName);
|
ZipFile zf = new ZipFile(m_packageDirectory+File.separator+"blobs"+File.separator+fileName);
|
||||||
Enumeration<?> e = zf.entries();
|
Enumeration<?> e = zf.entries();
|
||||||
ArrayList<File> files = new ArrayList<File>();
|
ArrayList<File> files = new ArrayList<File>();
|
||||||
while (e.hasMoreElements()) {
|
File[] retValue = null;
|
||||||
ZipEntry ze = (ZipEntry) e.nextElement();
|
try{
|
||||||
File file = new File(m_packageDirectory + File.separator + ze.getName());
|
while (e.hasMoreElements()) {
|
||||||
FileOutputStream fout = new FileOutputStream(file);
|
ZipEntry ze = (ZipEntry) e.nextElement();
|
||||||
InputStream in = zf.getInputStream(ze);
|
File file = new File(m_packageDirectory + File.separator + ze.getName());
|
||||||
for (int c = in.read(); c != -1; c = in.read()) {
|
FileOutputStream fout = new FileOutputStream(file);
|
||||||
fout.write(c);
|
InputStream in = zf.getInputStream(ze);
|
||||||
|
for (int c = in.read(); c != -1; c = in.read()) {
|
||||||
|
fout.write(c);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
fout.close();
|
||||||
|
files.add(file);
|
||||||
}
|
}
|
||||||
in.close();
|
retValue = new File[files.size()];
|
||||||
fout.close();
|
files.toArray(retValue);
|
||||||
files.add(file);
|
}catch (Exception ex){
|
||||||
|
zf.close();
|
||||||
}
|
}
|
||||||
File[] retValue = new File[files.size()];
|
|
||||||
files.toArray(retValue);
|
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,12 +378,23 @@ public class CSVImportAction implements EventListener<Event>
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new AdempiereException(e);
|
throw new AdempiereException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
if (in != null)
|
||||||
reader.close();
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
if (bw != null)
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bw != null)
|
||||||
|
try {
|
||||||
bw.close();
|
bw.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader != null)
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue