Commit 2eb5afd0 authored by prane's avatar prane

added finally block to close connections

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187723 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 764b435b
...@@ -574,22 +574,36 @@ public class StockAllocVerifyWiz extends ValidatorEJB implements StockAllocVerif ...@@ -574,22 +574,36 @@ public class StockAllocVerifyWiz extends ValidatorEJB implements StockAllocVerif
System.out.println("StockAllocVerifyWiz.itemChanged():catchBlock" + e.getMessage()); System.out.println("StockAllocVerifyWiz.itemChanged():catchBlock" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} finally { } finally{
try { try
if (rs != null) { {
rs.close(); if (conn != null)
rs = null; {
} if(rs != null)
if (pstmt != null) { {
pstmt.close(); rs.close();
pstmt = null; rs = null;
} }
if (!conn.isClosed() && conn != null) { if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
conn.close(); conn.close();
conn = null; conn = null;
} }
} catch (Exception e) { } catch (Exception e)
System.out.println("StockAllocVerifyWiz.itemChanged():finally block"); {
e.printStackTrace(); e.printStackTrace();
} }
} }
......
...@@ -173,6 +173,28 @@ public class StockAllocVerifyWizBean extends ValidatorEJB { ...@@ -173,6 +173,28 @@ public class StockAllocVerifyWizBean extends ValidatorEJB {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
}finally{
try
{
if (conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
} catch (Exception e)
{
e.printStackTrace();
}
} }
return retHtmlData; return retHtmlData;
...@@ -192,7 +214,7 @@ public class StockAllocVerifyWizBean extends ValidatorEJB { ...@@ -192,7 +214,7 @@ public class StockAllocVerifyWizBean extends ValidatorEJB {
String lotNo = ""; String lotNo = "";
String lotSl = ""; String lotSl = "";
String xmlData = ""; String xmlData = "";
int formNo = 2; int formNo = 2;
ConnDriver connDriver = null; ConnDriver connDriver = null;
int row = 0; int row = 0;
SimpleDateFormat sdf = null; SimpleDateFormat sdf = null;
...@@ -545,6 +567,28 @@ public class StockAllocVerifyWizBean extends ValidatorEJB { ...@@ -545,6 +567,28 @@ public class StockAllocVerifyWizBean extends ValidatorEJB {
e.printStackTrace(); e.printStackTrace();
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
}finally{
try
{
if (conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
} catch (Exception e)
{
e.printStackTrace();
}
} }
return retHtmlData; return retHtmlData;
......
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