Commit 25157dfa authored by arawankar's avatar arawankar

-Connection closing related changes made in below components

MiscVoucherAct.java
VouchPayAct.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@189965 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9e1a6b2e
......@@ -82,6 +82,25 @@ public class MiscVoucherAct extends ActionHandlerEJB implements MiscVoucherActLo
e.printStackTrace();
throw new ITMException(e);
}
//Modified by Anjali R. on [28/08/2018][connection was not close][start]
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception ex)
{
System.out.println("Exception in actionHandler--["+ ex.getMessage() +"]");
ex.printStackTrace();
}
}
//Modified by Anjali R. on [28/08/2018][connection was not close][End]
System.out.println("returning from actionVoucher actionHandler"+resString);
return resString;
......@@ -105,9 +124,9 @@ public class MiscVoucherAct extends ActionHandlerEJB implements MiscVoucherActLo
if (detCnt.equals("0"))
{
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END
stmt = conn.createStatement();
sundryType = genericUtility.getColumnValue("sundry_type",dom);
......
......@@ -52,6 +52,24 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
e.printStackTrace();
throw new ITMException(e);
}
//Modified by Anjali R. on [28/08/2018][connection was not close][start]
finally
{
try
{
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception ex)
{
System.out.println("Exception in actionHandler--["+ ex.getMessage() +"]");
ex.printStackTrace();
}
}
//Modified by Anjali R. on [28/08/2018][connection was not close][End]
System.out.println("returning from actionVoucher actionHandler"+resString);
return resString;
......@@ -108,10 +126,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
autoPay=rs.getString(3);
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
sql="select count(1) from misc_paydet where tran_ser= ? and vouch_no= ?";
......@@ -124,11 +154,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
refCount=rs.getInt(1);
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("conf["+conf+"] paymode["+payMode+"] refNo ["+refNo+"] refCount["+refCount+"]");
//validation if not confirmed
......@@ -212,11 +253,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
tranSerM=rs.getString("tran_ser");
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
Timestamp today = new java.sql.Timestamp(System.currentTimeMillis());
......@@ -248,8 +300,21 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
cctrCodeCfAp = cctrCodeCf;
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
rs.close()*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
//calculating discount for Voucher
if("VOUCH".equalsIgnoreCase(tranSer))
......@@ -263,8 +328,20 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
purcOrder=rs.getString("purc_order");
effDate=rs.getTimestamp("eff_date");
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
rs.close()*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
sql="select cr_term from porder where purc_order = ?";
pstmt = conn.prepareStatement(sql);
......@@ -274,8 +351,20 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
pCrTerm=rs.getString("cr_term");
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
rs.close()*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
sql="select crtermfc.fin_chg,crterm.acct_code__disc,crterm.cctr_code__disc,crterm.start_from "
......@@ -291,8 +380,20 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
cctrCodeDisc=rs.getString("cctr_code__disc");
startFrom=rs.getString("start_from");
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
rs.close()*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
ldDiscountDt = calcDiscountDate(pCrTerm,(sdf.format(refDate)),(sdf.format(effDate)),(sdf.format(billDate)),conn);
System.out.println("Test"+ldDiscountDt);
......@@ -308,8 +409,20 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
lcDiscount=rs.getDouble(1);
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
rs.close()*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
if(startFrom!=null && startFrom.trim().length()>0 )
{
......@@ -401,8 +514,20 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
chq1Str=rs.getString("chq1");
chq2Str=rs.getString("chq2");
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
rs.close()*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
if ( (chq1Str!= null && chq1Str.trim().length()>0) &&(chq2Str!= null && chq2Str.trim().length()>0) )
{
......@@ -421,8 +546,20 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
llRefNo=rs.getLong(1);
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
rs.close()*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
if (llRefNo==0)
{
......@@ -543,6 +680,13 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
try
{
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
if(rs != null)
{
rs.close();
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
if(pstmt1 != null)
{
pstmt1.close();
......@@ -643,7 +787,7 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
throw new ITMException(e);
}
return retString;
}
}
private Timestamp calcDiscountDate(String crTerm, String vouchDate, String effDate, String billDate,Connection conn) throws ITMException
{
String discountDate="",sql="",lsStart="",lsMonth="",lsOverridediscdt="";
......@@ -717,10 +861,23 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
sqlCount++;
lsOverridediscdt=checkNull(rs.getString("override_discount_date"));
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
//System.out.println("@@@@@@@@1613 lsOverridediscdt["+lsOverridediscdt+"]");//
if(sqlCount>0)
{
......@@ -745,10 +902,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
lsOverridediscdt=checkNull(rs.getString("override_discount_date"));
liDays=rs.getInt("max_day");
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
//System.out.println("@@@@@@@@1614 lsOverridediscdt["+lsOverridediscdt+"]");
if(sqlCount>0)
{
......@@ -765,10 +934,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
sqlCount++;
liDays=rs.getInt("max_day");
}
pstmt.close();
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
if(sqlCount>0)
{
......@@ -851,10 +1032,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
stanCode = checkNull(rs.getString("stan_code"));
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("StanCode from Sundry type=E>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("S".equalsIgnoreCase(sundryType)))
......@@ -867,10 +1060,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
stanCode = checkNull(rs.getString("stan_code"));
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("StanCode from Sundry type= S>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("C".equalsIgnoreCase(sundryType)))
......@@ -883,10 +1088,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
stanCode = checkNull(rs.getString("stan_code"));
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("StanCode from Sundry type=C>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("P".equalsIgnoreCase(sundryType)))
......@@ -899,10 +1116,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
empCode = checkNull(rs.getString("emp_code"));
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("empCode from Sundry type=P>>>>>>" + empCode);
......@@ -916,10 +1145,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
stanCode = checkNull(rs.getString("stan_code"));
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("StanCode from Sundry type=P>>>>>>" + stanCode);
}
......@@ -934,10 +1175,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
stanCode = checkNull(rs.getString("stan_code"));
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("StanCode from Sundry type= T>>>>>>" + stanCode);
}
else if ((sundryType != null) && (sundryType.trim().length() > 0) && ("X".equalsIgnoreCase(sundryType)))
......@@ -950,10 +1203,22 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
stanCode = checkNull(rs.getString("stan_code"));
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
rs = null;
}
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
System.out.println("StanCode from Sundry type= X>>>>>>" + stanCode);
}
......@@ -968,14 +1233,27 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
{
try
{
if(pstmt!=null)
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][Start]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt!= null)
{
pstmt.close();
pstmt = null;
}
/*if(pstmt!=null)
{
pstmt.close();pstmt=null;
}
if(rs!=null)
{
rs.close();rs=null;
}
}*/
//Modified by Anjali R. on[28/08/2018][Handle resource leak issue][End]
}
catch(Exception ex)
{
......
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