Commit 27aa42a2 authored by vvengurlekar's avatar vvengurlekar

EmpWithHeldToggle.java

PreEmpWithHeldToggle.java - changes done for finally block addition


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187151 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 37492c36
......@@ -12,6 +12,7 @@ import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import javax.ejb.Stateless;
......@@ -26,9 +27,10 @@ public class EmpWithHeldToggle extends ActionHandlerEJB implements EmpWithHeldTo
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = "";
Connection conn=null;//Modified by Ahmed on 02/07/2018[to close connection in finally block]
try
{
Connection conn=null;
//Connection conn=null; //Modified by Ahmed on 02/07/2018[to close connection in finally block]
conn = getConnection();
retString = confirm( tranId, xtraParams, forcedFlag, conn);
if(updateFlag)
......@@ -50,8 +52,21 @@ public class EmpWithHeldToggle extends ActionHandlerEJB implements EmpWithHeldTo
System.out.println("Exception :EmpWithHeldToggle :confirm():" + e.getMessage() + ":");
e.printStackTrace();
}
//Modified by Ahmed on 02/07/2018[to close connection in finally block]start
finally
{
try {
if (conn!=null)
{
conn.close();
conn=null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
//Modified by Ahmed on 02/07/2018[to close connection in finally block]end
return retString;
}
public String confirm( String tranId, String xtraParams, String forcedFlag, Connection conn) throws ITMException
......@@ -151,8 +166,14 @@ public class EmpWithHeldToggle extends ActionHandlerEJB implements EmpWithHeldTo
{
pstmt.close();
pstmt = null;
}
}
//Modified by Ahmed on 02/07/2018[to close resultset in finally block]start
if ( rs != null )
{
rs.close();
rs = null;
}
//Modified by Ahmed on 02/07/2018[to close resultset in finally block]end
}
catch(Exception e)
{
......
......@@ -3,6 +3,7 @@ import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
......@@ -23,9 +24,10 @@ public class PreEmpWithHeldToggle extends ActionHandlerEJB implements PreEmpWit
public String actionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException, ITMException
{
String retString = "";
Connection conn=null;//Modified by Ahmed on 02/07/2018[to close connection in finally block]
try
{
Connection conn=null;
//Connection conn=null; //Modified by Ahmed on 02/07/2018[to close connection in finally block]
conn = getConnection();
retString = actionHandler( tranId, xtraParams, forcedFlag, conn);
if (conn!=null)
......@@ -39,6 +41,20 @@ public class PreEmpWithHeldToggle extends ActionHandlerEJB implements PreEmpWit
System.out.println("Exception :PreEmpWithHeldToggle :confirm():" + e.getMessage() + ":");
e.printStackTrace();
}
//Modified by Ahmed on 02/07/2018[to close connection in finally block]start
finally
{
try {
if (conn!=null)
{
conn.close();
conn=null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
//Modified by Ahmed on 02/07/2018[to close connection in finally block]end
return retString;
}
......
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