Commit 17808fb6 authored by jshaikh's avatar jshaikh

issues related to dirty connection in PaymentExpPaid and StockValAdjTran

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@199061 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 926ad4a1
...@@ -1269,7 +1269,7 @@ conn = getConnection(); ...@@ -1269,7 +1269,7 @@ conn = getConnection();
String lotSl = ""; String lotSl = "";
String errCode = ""; String errCode = "";
Statement stmt; Statement stmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
...@@ -1290,6 +1290,14 @@ conn = getConnection(); ...@@ -1290,6 +1290,14 @@ conn = getConnection();
{ {
type = rs.getString(1); type = rs.getString(1);
} }
//Added by Jaffar on 02-04-19
if (rs != null )
{
rs.close();
rs = null;
}
if (type.equalsIgnoreCase("L")) // List Price if (type.equalsIgnoreCase("L")) // List Price
{ {
...@@ -1304,6 +1312,12 @@ conn = getConnection(); ...@@ -1304,6 +1312,12 @@ conn = getConnection();
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
} }
//Added by Jaffar on 02-04-19
if (rs != null )
{
rs.close();
rs = null;
}
} }
else if (type.equalsIgnoreCase("D")) // Despatch else if (type.equalsIgnoreCase("D")) // Despatch
/* Selecting rate from pricelist for L, if not found picking up from batch */ /* Selecting rate from pricelist for L, if not found picking up from batch */
...@@ -1330,6 +1344,12 @@ conn = getConnection(); ...@@ -1330,6 +1344,12 @@ conn = getConnection();
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
} }
//Added by Jaffar on 02-04-19
if (rs != null )
{
rs.close();
rs = null;
}
} }
catch(SQLException ie) catch(SQLException ie)
{ {
...@@ -1353,6 +1373,12 @@ conn = getConnection(); ...@@ -1353,6 +1373,12 @@ conn = getConnection();
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
} }
//Added by Jaffar on 02-04-19
if (rs != null )
{
rs.close();
rs = null;
}
} }
else if (type.equalsIgnoreCase("M") || type.equalsIgnoreCase("N")) // Discount Price else if (type.equalsIgnoreCase("M") || type.equalsIgnoreCase("N")) // Discount Price
{ {
...@@ -1366,6 +1392,12 @@ conn = getConnection(); ...@@ -1366,6 +1392,12 @@ conn = getConnection();
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
} }
//Added by Jaffar on 02-04-19
if (rs != null )
{
rs.close();
rs = null;
}
} }
else if (type.equalsIgnoreCase("I")) // Inventory else if (type.equalsIgnoreCase("I")) // Inventory
{ {
...@@ -1384,6 +1416,12 @@ conn = getConnection(); ...@@ -1384,6 +1416,12 @@ conn = getConnection();
{ {
rate = rs.getDouble(1); rate = rs.getDouble(1);
} }
//Added by Jaffar on 02-04-19
if (rs != null )
{
rs.close();
rs = null;
}
} }
else else
{ {
...@@ -1397,12 +1435,23 @@ conn = getConnection(); ...@@ -1397,12 +1435,23 @@ conn = getConnection();
{ {
return -1; return -1;
} }
//Added by Jaffar on 02-04-19
if (rs != null )
{
rs.close();
rs = null;
}
} }
} }
if (rs != null) /*if (rs != null)
{ {
rs.close(); rs.close();
} }*/
//Added by Jaffar on 02-04-19
rs.close();
rs = null;
stmt.close();
stmt = null;
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -1410,6 +1459,25 @@ conn = getConnection(); ...@@ -1410,6 +1459,25 @@ conn = getConnection();
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
//Added by Jaffar S. on 02-04-19
finally {
try {
if (connectionObject != null) {
if (rs != null) {
rs.close();
rs = null;
}
if (stmt != null) {
stmt.close();
stmt = null;
}
connectionObject.close();
connectionObject = null;
}
} catch (Exception d) {
d.printStackTrace();
}
}
return rate; return rate;
......
...@@ -129,7 +129,7 @@ conn = getConnection(); ...@@ -129,7 +129,7 @@ conn = getConnection();
errCode = e.getMessage(); errCode = e.getMessage();
throw new ITMException(e); throw new ITMException(e);
} }
finally /*finally
{ {
try try
{ {
...@@ -137,7 +137,27 @@ conn = getConnection(); ...@@ -137,7 +137,27 @@ conn = getConnection();
conn.close(); conn.close();
} }
catch(Exception e){} catch(Exception e){}
} }*/
//Added by Jaffar S. on 02-04-19
finally {
try {
System.out.println("Closing Connection......");
if (conn != null) {
if (rs != null) {
rs.close();
rs = null;
}
if (stmt != null) {
stmt.close();
stmt = null;
}
conn.close();
conn = null;
}
} catch (Exception d) {
d.printStackTrace();
}
}
return retString; return retString;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment