ksfoong
asked on
warning: finally clause cannot complete normally
when i try to compile my javabean (or a ajava file), using JDK1.4++, i will have this error :
warning : finally clause cannot complete normally }^
but if i change the JDK to JDK 1.3, then i am fine with the source code. ANyone can tell me what happend?
warning : finally clause cannot complete normally }^
but if i change the JDK to JDK 1.3, then i am fine with the source code. ANyone can tell me what happend?
Hi,
Its seems that some where the braces is not closed as expected. Since your code works fine with JDK 1.3 I think it is better you post the source code. Object is right just post your code we want to see the close look of it.
Thx,
Karc
Its seems that some where the braces is not closed as expected. Since your code works fine with JDK 1.3 I think it is better you post the source code. Object is right just post your code we want to see the close look of it.
Thx,
Karc
ASKER
...
...
public class DayschServlet extends com.comex.cardpro.servlet. ActionBase HttpServle t {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
OB_CP_DAYSCH aOB_CP_DAYSCH = new OB_CP_DAYSCH(request);
String action = request.getParameter("acti on1");
if (request.getParameter("act ion1") != null) {
processAction(request, action.trim(), aOB_CP_DAYSCH);
request.setAttribute("OB_C P_DAYSCH", aOB_CP_DAYSCH);
}
RequestDispatcher rd =
getServletContext().getReq uestDispat cher(
request.getParameter("resu ltPage").t rim());
rd.forward(request, response);
} catch (DBException ex) {
Logger.error(this.getClass (), "Error performing doPost", ex);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (ServletException ex) {
Logger.error(this.getClass (), "Error performing doPost", ex);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (DBE_RecordAlreadyExistsEx ception e1) {
Logger.error(this.getClass (), "record has existed,add error", e1);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (DBE_RecordNotFoundExcepti on e2) {
Logger.error(this.getClass (), "Error finding Holidy", e2);
RequestDispatcher rd =
getServletContext().getReq uestDispat cher(
request.getParameter("resu ltPage").t rim());
rd.forward(request, response);
return;
} catch (DBE_Exception e3) {
Logger.error(this.getClass (), "DBE_Exception", e3);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (Exception e) {
Logger.error(this.getClass (), "error performing action", e);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} finally {
Logger.error(this.getClass (),"------ some exception take place-----");
return;
}
}
.............
.............
...........
Any idea??
...
public class DayschServlet extends com.comex.cardpro.servlet.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
OB_CP_DAYSCH aOB_CP_DAYSCH = new OB_CP_DAYSCH(request);
String action = request.getParameter("acti
if (request.getParameter("act
processAction(request, action.trim(), aOB_CP_DAYSCH);
request.setAttribute("OB_C
}
RequestDispatcher rd =
getServletContext().getReq
request.getParameter("resu
rd.forward(request, response);
} catch (DBException ex) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (ServletException ex) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (DBE_RecordAlreadyExistsEx
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (DBE_RecordNotFoundExcepti
Logger.error(this.getClass
RequestDispatcher rd =
getServletContext().getReq
request.getParameter("resu
rd.forward(request, response);
return;
} catch (DBE_Exception e3) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (Exception e) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} finally {
Logger.error(this.getClass
return;
}
}
.............
.............
...........
Any idea??
ASKER
this is another one:
..
..
...
....
public DBI_Base performAction() {
DBConnectionPool myPool = null;
DBConnection myConnection = null;
OBScrCMAP3200Deposit obR = (OBScrCMAP3200Deposit) dbiObj;
OBScrCMAP3200DepositList ob = new OBScrCMAP3200DepositList() ;
ob.DS_BRANCH_ID(obR.DS_BRA NCH_ID());
ob.DS_BATCH_NO(obR.DS_BATC H_NO());
ob.DS_BATCH_YDDD(obR.DS_BA TCH_YDDD() );
try {
myPool = DBConnectionPool.getInstan ce(Connect ionMgr.DBN AME);
myConnection = myPool.getConnection();
myConnection.setAutoCommit (false);
OB_CP_DEPSLO obDep = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDep = new DB_CP_DEPSLO(myConnection, request);
obDep.DS_BRANCH_ID(obR.DS_ BRANCH_ID( ));
obDep.DS_BATCH_NO(obR.DS_B ATCH_NO()) ;
obDep.DS_BATCH_YDDD(obR.DS _BATCH_YDD D());
obDep.DS_REF_NO(obR.DS_REF _NO());
obDep.DS_SEQ_NO(obR.DS_SEQ _NO());
if (dbDep.doFind(obDep)) {
ob.setDepositExist(true);
//delete deposit
OB_CP_DEPSLO obDepD = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDepD = new DB_CP_DEPSLO(myConnection, request);
obDepD.DS_BRANCH_ID(obR.DS _BRANCH_ID ());
obDepD.DS_BATCH_NO(obR.DS_ BATCH_NO() );
obDepD.DS_BATCH_YDDD(obR.D S_BATCH_YD DD());
obDepD.DS_REF_NO(obR.DS_RE F_NO());
obDepD.DS_SEQ_NO(obR.DS_SE Q_NO());
dbDepD.doDelete(obDepD);
Logger.debug(this.getClass (), "delete deposit ok ");
//myConnection.commit();
//reduce the no of slip in the cp_depslo table
/*BigDecimal currRecord =
BatchFunction.getTotalBatc hRec(
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass (), "be currRecord="+currRecord);
currRecord = currRecord.subtract(new BigDecimal(1));
Logger.debug(this.getClass (), "af currRecord="+currRecord);
BigDecimal currDepositAmt =
BatchFunction.getCurrBatch Amt(
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass (), "be currDepositAmt="+currDepos itAmt);
currDepositAmt = currDepositAmt.subtract(ob R.DS_TOTAL _AMT());
Logger.debug(this.getClass (), "af currDepositAmt="+currDepos itAmt);
//BigDecimal seqNo = DepositFunction.getSeqNo(o bR.SS_BRAN CH_ID(),ob R.SS_BATCH _YDDD(),ob R.SS_BATCH _NO(),obR. SS_DEPOSIT _NO());
OB_CP_BATCHF obBat = new OB_CP_BATCHF();
DB_CP_BATCHF dbBat = new DB_CP_BATCHF(myConnection, request);
obBat.BA_BRANCH_ID(obR.DS_ BRANCH_ID( ));
obBat.BA_BATCH_YDDD(obR.DS _BATCH_YDD D());
obBat.BA_BATCH_NO(obR.DS_B ATCH_NO()) ;
obBat.BA_NO_TRXN(currRecor d);
obBat.BA_BATCH_AMT(currDep ositAmt);
dbBat.doUpdate(obBat);
Logger.debug(this.getClass (), "update CP_BATCHF ok");*/
//check BA_TALLY_CODE
/*BigDecimal totalRec = BatchFunction.getTotalBatc hRec(reque st,obR.DS_ BRANCH_ID( ),obR.DS_B ATCH_NO(), obR.DS_BAT CH_YDDD()) ;
ArrayList listCount = ob.list(obR.DS_BRANCH_ID() ,obR.DS_BA TCH_NO(),o bR.DS_BATC H_YDDD());
int currentRecNo = listCount.size();
BigDecimal recLeft = totalRec.subtract(new BigDecimal(currentRecNo));
BigDecimal trxCurrCode = BatchFunction.getTrxCurren cyCode(req uest,obR.D S_BRANCH_I D(),obR.DS _BATCH_NO( ),obR.DS_B ATCH_YDDD( ));
BigDecimal currExponent = DBHelper.retriveExponent(r equest,trx CurrCode);
BigDecimal batchAmt = BatchFunction.getCurrBatch Amt(reques t,obR.DS_B RANCH_ID() ,obR.DS_BA TCH_NO(),o bR.DS_BATC H_YDDD());
BigDecimal currBatchDepositAmt = BatchFunction.currBatchDep ositAmt(re quest,obR. DS_BRANCH_ ID(),obR.D S_BATCH_NO (),obR.DS_ BATCH_YDDD ());
String BA_TALLY_CODE="N";
if(recLeft.intValue() == 0 && batchAmt.intValue()==currB atchDeposi tAmt.intVa lue()) BA_TALLY_CODE="Y";
Logger.debug(this.getClass (),"BA_TAL LY_CODE:"+ BA_TALLY_C ODE);
OB_CP_BATCHF aOB_CP_BATCHF = new OB_CP_BATCHF();
DB_CP_BATCHF aDB_CP_BATCHF = new DB_CP_BATCHF(request);
aOB_CP_BATCHF.BA_BRANCH_ID (obR.DS_BR ANCH_ID()) ;
aOB_CP_BATCHF.BA_BATCH_YDD D(obR.DS_B ATCH_YDDD( ));
aOB_CP_BATCHF.BA_BATCH_NO( obR.DS_BAT CH_NO());
aDB_CP_BATCHF.doFindByKey( aOB_CP_BAT CHF);
OB_CP_BATCHF bOB_CP_BATCHF = new OB_CP_BATCHF();
bOB_CP_BATCHF.BA_BRANCH_ID (obR.DS_BR ANCH_ID()) ;
bOB_CP_BATCHF.BA_BATCH_YDD D(obR.DS_B ATCH_YDDD( ));
bOB_CP_BATCHF.BA_BATCH_NO( obR.DS_BAT CH_NO());
bOB_CP_BATCHF.BA_TALLY_COD E(BA_TALLY _CODE);
aDB_CP_BATCHF.doUpdate(bOB _CP_BATCHF );*/
Logger.debug(this.getClass (),"CP_BAT CHF update ok");
} else {
ob.setError("CMAP3200.BATC H.NOTFOUND ");
ob.setDepositExist(false);
}
myConnection.commit();
} catch (Exception ex) {
Logger.error(this.getClass (), "Problem deleting deposit", ex);
ob.setError("CMAP3200.DEPO SIT.DELETE ");
try {
myConnection.rollback();
Logger.info(this.getClass( ), "connection rolled back");
} catch (Exception rolEx) {
Logger.error(
this.getClass(),
"Problem doing roll back ",
rolEx);
}
} finally {
if (myPool != null) {
myPool.release(myConnectio n);
}
return ob;
}
}
}
.........
...........
..
..
...
....
public DBI_Base performAction() {
DBConnectionPool myPool = null;
DBConnection myConnection = null;
OBScrCMAP3200Deposit obR = (OBScrCMAP3200Deposit) dbiObj;
OBScrCMAP3200DepositList ob = new OBScrCMAP3200DepositList()
ob.DS_BRANCH_ID(obR.DS_BRA
ob.DS_BATCH_NO(obR.DS_BATC
ob.DS_BATCH_YDDD(obR.DS_BA
try {
myPool = DBConnectionPool.getInstan
myConnection = myPool.getConnection();
myConnection.setAutoCommit
OB_CP_DEPSLO obDep = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDep = new DB_CP_DEPSLO(myConnection,
obDep.DS_BRANCH_ID(obR.DS_
obDep.DS_BATCH_NO(obR.DS_B
obDep.DS_BATCH_YDDD(obR.DS
obDep.DS_REF_NO(obR.DS_REF
obDep.DS_SEQ_NO(obR.DS_SEQ
if (dbDep.doFind(obDep)) {
ob.setDepositExist(true);
//delete deposit
OB_CP_DEPSLO obDepD = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDepD = new DB_CP_DEPSLO(myConnection,
obDepD.DS_BRANCH_ID(obR.DS
obDepD.DS_BATCH_NO(obR.DS_
obDepD.DS_BATCH_YDDD(obR.D
obDepD.DS_REF_NO(obR.DS_RE
obDepD.DS_SEQ_NO(obR.DS_SE
dbDepD.doDelete(obDepD);
Logger.debug(this.getClass
//myConnection.commit();
//reduce the no of slip in the cp_depslo table
/*BigDecimal currRecord =
BatchFunction.getTotalBatc
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass
currRecord = currRecord.subtract(new BigDecimal(1));
Logger.debug(this.getClass
BigDecimal currDepositAmt =
BatchFunction.getCurrBatch
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass
currDepositAmt = currDepositAmt.subtract(ob
Logger.debug(this.getClass
//BigDecimal seqNo = DepositFunction.getSeqNo(o
OB_CP_BATCHF obBat = new OB_CP_BATCHF();
DB_CP_BATCHF dbBat = new DB_CP_BATCHF(myConnection,
obBat.BA_BRANCH_ID(obR.DS_
obBat.BA_BATCH_YDDD(obR.DS
obBat.BA_BATCH_NO(obR.DS_B
obBat.BA_NO_TRXN(currRecor
obBat.BA_BATCH_AMT(currDep
dbBat.doUpdate(obBat);
Logger.debug(this.getClass
//check BA_TALLY_CODE
/*BigDecimal totalRec = BatchFunction.getTotalBatc
ArrayList listCount = ob.list(obR.DS_BRANCH_ID()
int currentRecNo = listCount.size();
BigDecimal recLeft = totalRec.subtract(new BigDecimal(currentRecNo));
BigDecimal trxCurrCode = BatchFunction.getTrxCurren
BigDecimal currExponent = DBHelper.retriveExponent(r
BigDecimal batchAmt = BatchFunction.getCurrBatch
BigDecimal currBatchDepositAmt = BatchFunction.currBatchDep
String BA_TALLY_CODE="N";
if(recLeft.intValue() == 0 && batchAmt.intValue()==currB
Logger.debug(this.getClass
OB_CP_BATCHF aOB_CP_BATCHF = new OB_CP_BATCHF();
DB_CP_BATCHF aDB_CP_BATCHF = new DB_CP_BATCHF(request);
aOB_CP_BATCHF.BA_BRANCH_ID
aOB_CP_BATCHF.BA_BATCH_YDD
aOB_CP_BATCHF.BA_BATCH_NO(
aDB_CP_BATCHF.doFindByKey(
OB_CP_BATCHF bOB_CP_BATCHF = new OB_CP_BATCHF();
bOB_CP_BATCHF.BA_BRANCH_ID
bOB_CP_BATCHF.BA_BATCH_YDD
bOB_CP_BATCHF.BA_BATCH_NO(
bOB_CP_BATCHF.BA_TALLY_COD
aDB_CP_BATCHF.doUpdate(bOB
Logger.debug(this.getClass
} else {
ob.setError("CMAP3200.BATC
ob.setDepositExist(false);
}
myConnection.commit();
} catch (Exception ex) {
Logger.error(this.getClass
ob.setError("CMAP3200.DEPO
try {
myConnection.rollback();
Logger.info(this.getClass(
} catch (Exception rolEx) {
Logger.error(
this.getClass(),
"Problem doing roll back ",
rolEx);
}
} finally {
if (myPool != null) {
myPool.release(myConnectio
}
return ob;
}
}
}
.........
...........
Hi,
One closing brace is missing. Please close it at the appro. place. Most prob. the most last closing brace is missing.
Thx
One closing brace is missing. Please close it at the appro. place. Most prob. the most last closing brace is missing.
Thx
Hi,
For second posted code one brace is extra. Remove the extra brace.
Thx
For second posted code one brace is extra. Remove the extra brace.
Thx
Hi,
The possible correction is the following.
public class DayschServlet extends com.comex.cardpro.servlet. ActionBase HttpServle t {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
OB_CP_DAYSCH aOB_CP_DAYSCH = new OB_CP_DAYSCH(request);
String action = request.getParameter("acti on1");
if (request.getParameter("act ion1") != null) {
processAction(request, action.trim(), aOB_CP_DAYSCH);
request.setAttribute("OB_C P_DAYSCH", aOB_CP_DAYSCH);
}
RequestDispatcher rd =
getServletContext().getReq uestDispat cher(
request.getParameter("resu ltPage").t rim());
rd.forward(request, response);
} catch (DBException ex) {
Logger.error(this.getClass (), "Error performing doPost", ex);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (ServletException ex) {
Logger.error(this.getClass (), "Error performing doPost", ex);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (DBE_RecordAlreadyExistsEx ception e1) {
Logger.error(this.getClass (), "record has existed,add error", e1);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (DBE_RecordNotFoundExcepti on e2) {
Logger.error(this.getClass (), "Error finding Holidy", e2);
RequestDispatcher rd =
getServletContext().getReq uestDispat cher(
request.getParameter("resu ltPage").t rim());
rd.forward(request, response);
return;
} catch (DBE_Exception e3) {
Logger.error(this.getClass (), "DBE_Exception", e3);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} catch (Exception e) {
Logger.error(this.getClass (), "error performing action", e);
request.setAttribute("info ", Encode.GToI("ϵͳ³ö´í£¬ÇëÍ ¨ÖªÏµÍ³¹ÜÀ íÔ± £¡"));
RequestDispatcher rd =
getServletContext().getReq uestDispat cher("/jsp /main/errI nfo.jsp");
rd.forward(request, response);
return;
} finally {
Logger.error(this.getClass (),"------ some exception take place-----");
return;
}
}
}
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----
public DBI_Base performAction() {
DBConnectionPool myPool = null;
DBConnection myConnection = null;
OBScrCMAP3200Deposit obR = (OBScrCMAP3200Deposit) dbiObj;
OBScrCMAP3200DepositList ob = new OBScrCMAP3200DepositList() ;
ob.DS_BRANCH_ID(obR.DS_BRA NCH_ID());
ob.DS_BATCH_NO(obR.DS_BATC H_NO());
ob.DS_BATCH_YDDD(obR.DS_BA TCH_YDDD() );
try {
myPool = DBConnectionPool.getInstan ce(Connect ionMgr.DBN AME);
myConnection = myPool.getConnection();
myConnection.setAutoCommit (false);
OB_CP_DEPSLO obDep = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDep = new DB_CP_DEPSLO(myConnection, request);
obDep.DS_BRANCH_ID(obR.DS_ BRANCH_ID( ));
obDep.DS_BATCH_NO(obR.DS_B ATCH_NO()) ;
obDep.DS_BATCH_YDDD(obR.DS _BATCH_YDD D());
obDep.DS_REF_NO(obR.DS_REF _NO());
obDep.DS_SEQ_NO(obR.DS_SEQ _NO());
if (dbDep.doFind(obDep)) {
ob.setDepositExist(true);
//delete deposit
OB_CP_DEPSLO obDepD = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDepD = new DB_CP_DEPSLO(myConnection, request);
obDepD.DS_BRANCH_ID(obR.DS _BRANCH_ID ());
obDepD.DS_BATCH_NO(obR.DS_ BATCH_NO() );
obDepD.DS_BATCH_YDDD(obR.D S_BATCH_YD DD());
obDepD.DS_REF_NO(obR.DS_RE F_NO());
obDepD.DS_SEQ_NO(obR.DS_SE Q_NO());
dbDepD.doDelete(obDepD);
Logger.debug(this.getClass (), "delete deposit ok ");
//myConnection.commit();
//reduce the no of slip in the cp_depslo table
/*BigDecimal currRecord =
BatchFunction.getTotalBatc hRec(
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass (), "be currRecord="+currRecord);
currRecord = currRecord.subtract(new BigDecimal(1));
Logger.debug(this.getClass (), "af currRecord="+currRecord);
BigDecimal currDepositAmt =
BatchFunction.getCurrBatch Amt(
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass (), "be currDepositAmt="+currDepos itAmt);
currDepositAmt = currDepositAmt.subtract(ob R.DS_TOTAL _AMT());
Logger.debug(this.getClass (), "af currDepositAmt="+currDepos itAmt);
//BigDecimal seqNo = DepositFunction.getSeqNo(o bR.SS_BRAN CH_ID(),ob R.SS_BATCH _YDDD(),ob R.SS_BATCH _NO(),obR. SS_DEPOSIT _NO());
OB_CP_BATCHF obBat = new OB_CP_BATCHF();
DB_CP_BATCHF dbBat = new DB_CP_BATCHF(myConnection, request);
obBat.BA_BRANCH_ID(obR.DS_ BRANCH_ID( ));
obBat.BA_BATCH_YDDD(obR.DS _BATCH_YDD D());
obBat.BA_BATCH_NO(obR.DS_B ATCH_NO()) ;
obBat.BA_NO_TRXN(currRecor d);
obBat.BA_BATCH_AMT(currDep ositAmt);
dbBat.doUpdate(obBat);
Logger.debug(this.getClass (), "update CP_BATCHF ok");*/
//check BA_TALLY_CODE
/*BigDecimal totalRec = BatchFunction.getTotalBatc hRec(reque st,obR.DS_ BRANCH_ID( ),obR.DS_B ATCH_NO(), obR.DS_BAT CH_YDDD()) ;
ArrayList listCount = ob.list(obR.DS_BRANCH_ID() ,obR.DS_BA TCH_NO(),o bR.DS_BATC H_YDDD());
int currentRecNo = listCount.size();
BigDecimal recLeft = totalRec.subtract(new BigDecimal(currentRecNo));
BigDecimal trxCurrCode = BatchFunction.getTrxCurren cyCode(req uest,obR.D S_BRANCH_I D(),obR.DS _BATCH_NO( ),obR.DS_B ATCH_YDDD( ));
BigDecimal currExponent = DBHelper.retriveExponent(r equest,trx CurrCode);
BigDecimal batchAmt = BatchFunction.getCurrBatch Amt(reques t,obR.DS_B RANCH_ID() ,obR.DS_BA TCH_NO(),o bR.DS_BATC H_YDDD());
BigDecimal currBatchDepositAmt = BatchFunction.currBatchDep ositAmt(re quest,obR. DS_BRANCH_ ID(),obR.D S_BATCH_NO (),obR.DS_ BATCH_YDDD ());
String BA_TALLY_CODE="N";
if(recLeft.intValue() == 0 && batchAmt.intValue()==currB atchDeposi tAmt.intVa lue()) BA_TALLY_CODE="Y";
Logger.debug(this.getClass (),"BA_TAL LY_CODE:"+ BA_TALLY_C ODE);
OB_CP_BATCHF aOB_CP_BATCHF = new OB_CP_BATCHF();
DB_CP_BATCHF aDB_CP_BATCHF = new DB_CP_BATCHF(request);
aOB_CP_BATCHF.BA_BRANCH_ID (obR.DS_BR ANCH_ID()) ;
aOB_CP_BATCHF.BA_BATCH_YDD D(obR.DS_B ATCH_YDDD( ));
aOB_CP_BATCHF.BA_BATCH_NO( obR.DS_BAT CH_NO());
aDB_CP_BATCHF.doFindByKey( aOB_CP_BAT CHF);
OB_CP_BATCHF bOB_CP_BATCHF = new OB_CP_BATCHF();
bOB_CP_BATCHF.BA_BRANCH_ID (obR.DS_BR ANCH_ID()) ;
bOB_CP_BATCHF.BA_BATCH_YDD D(obR.DS_B ATCH_YDDD( ));
bOB_CP_BATCHF.BA_BATCH_NO( obR.DS_BAT CH_NO());
bOB_CP_BATCHF.BA_TALLY_COD E(BA_TALLY _CODE);
aDB_CP_BATCHF.doUpdate(bOB _CP_BATCHF );*/
Logger.debug(this.getClass (),"CP_BAT CHF update ok");
} else {
ob.setError("CMAP3200.BATC H.NOTFOUND ");
ob.setDepositExist(false);
}
myConnection.commit();
} catch (Exception ex) {
Logger.error(this.getClass (), "Problem deleting deposit", ex);
ob.setError("CMAP3200.DEPO SIT.DELETE ");
try {
myConnection.rollback();
Logger.info(this.getClass( ), "connection rolled back");
} catch (Exception rolEx) {
Logger.error(
this.getClass(),
"Problem doing roll back ",
rolEx);
}
} finally {
if (myPool != null) {
myPool.release(myConnectio n);
}
return ob;
}
}
The possible correction is the following.
public class DayschServlet extends com.comex.cardpro.servlet.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
OB_CP_DAYSCH aOB_CP_DAYSCH = new OB_CP_DAYSCH(request);
String action = request.getParameter("acti
if (request.getParameter("act
processAction(request, action.trim(), aOB_CP_DAYSCH);
request.setAttribute("OB_C
}
RequestDispatcher rd =
getServletContext().getReq
request.getParameter("resu
rd.forward(request, response);
} catch (DBException ex) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (ServletException ex) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (DBE_RecordAlreadyExistsEx
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (DBE_RecordNotFoundExcepti
Logger.error(this.getClass
RequestDispatcher rd =
getServletContext().getReq
request.getParameter("resu
rd.forward(request, response);
return;
} catch (DBE_Exception e3) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} catch (Exception e) {
Logger.error(this.getClass
request.setAttribute("info
RequestDispatcher rd =
getServletContext().getReq
rd.forward(request, response);
return;
} finally {
Logger.error(this.getClass
return;
}
}
}
--------------------------
public DBI_Base performAction() {
DBConnectionPool myPool = null;
DBConnection myConnection = null;
OBScrCMAP3200Deposit obR = (OBScrCMAP3200Deposit) dbiObj;
OBScrCMAP3200DepositList ob = new OBScrCMAP3200DepositList()
ob.DS_BRANCH_ID(obR.DS_BRA
ob.DS_BATCH_NO(obR.DS_BATC
ob.DS_BATCH_YDDD(obR.DS_BA
try {
myPool = DBConnectionPool.getInstan
myConnection = myPool.getConnection();
myConnection.setAutoCommit
OB_CP_DEPSLO obDep = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDep = new DB_CP_DEPSLO(myConnection,
obDep.DS_BRANCH_ID(obR.DS_
obDep.DS_BATCH_NO(obR.DS_B
obDep.DS_BATCH_YDDD(obR.DS
obDep.DS_REF_NO(obR.DS_REF
obDep.DS_SEQ_NO(obR.DS_SEQ
if (dbDep.doFind(obDep)) {
ob.setDepositExist(true);
//delete deposit
OB_CP_DEPSLO obDepD = new OB_CP_DEPSLO();
DB_CP_DEPSLO dbDepD = new DB_CP_DEPSLO(myConnection,
obDepD.DS_BRANCH_ID(obR.DS
obDepD.DS_BATCH_NO(obR.DS_
obDepD.DS_BATCH_YDDD(obR.D
obDepD.DS_REF_NO(obR.DS_RE
obDepD.DS_SEQ_NO(obR.DS_SE
dbDepD.doDelete(obDepD);
Logger.debug(this.getClass
//myConnection.commit();
//reduce the no of slip in the cp_depslo table
/*BigDecimal currRecord =
BatchFunction.getTotalBatc
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass
currRecord = currRecord.subtract(new BigDecimal(1));
Logger.debug(this.getClass
BigDecimal currDepositAmt =
BatchFunction.getCurrBatch
request,
obR.DS_BRANCH_ID(),
obR.DS_BATCH_NO(),
obR.DS_BATCH_YDDD());
Logger.debug(this.getClass
currDepositAmt = currDepositAmt.subtract(ob
Logger.debug(this.getClass
//BigDecimal seqNo = DepositFunction.getSeqNo(o
OB_CP_BATCHF obBat = new OB_CP_BATCHF();
DB_CP_BATCHF dbBat = new DB_CP_BATCHF(myConnection,
obBat.BA_BRANCH_ID(obR.DS_
obBat.BA_BATCH_YDDD(obR.DS
obBat.BA_BATCH_NO(obR.DS_B
obBat.BA_NO_TRXN(currRecor
obBat.BA_BATCH_AMT(currDep
dbBat.doUpdate(obBat);
Logger.debug(this.getClass
//check BA_TALLY_CODE
/*BigDecimal totalRec = BatchFunction.getTotalBatc
ArrayList listCount = ob.list(obR.DS_BRANCH_ID()
int currentRecNo = listCount.size();
BigDecimal recLeft = totalRec.subtract(new BigDecimal(currentRecNo));
BigDecimal trxCurrCode = BatchFunction.getTrxCurren
BigDecimal currExponent = DBHelper.retriveExponent(r
BigDecimal batchAmt = BatchFunction.getCurrBatch
BigDecimal currBatchDepositAmt = BatchFunction.currBatchDep
String BA_TALLY_CODE="N";
if(recLeft.intValue() == 0 && batchAmt.intValue()==currB
Logger.debug(this.getClass
OB_CP_BATCHF aOB_CP_BATCHF = new OB_CP_BATCHF();
DB_CP_BATCHF aDB_CP_BATCHF = new DB_CP_BATCHF(request);
aOB_CP_BATCHF.BA_BRANCH_ID
aOB_CP_BATCHF.BA_BATCH_YDD
aOB_CP_BATCHF.BA_BATCH_NO(
aDB_CP_BATCHF.doFindByKey(
OB_CP_BATCHF bOB_CP_BATCHF = new OB_CP_BATCHF();
bOB_CP_BATCHF.BA_BRANCH_ID
bOB_CP_BATCHF.BA_BATCH_YDD
bOB_CP_BATCHF.BA_BATCH_NO(
bOB_CP_BATCHF.BA_TALLY_COD
aDB_CP_BATCHF.doUpdate(bOB
Logger.debug(this.getClass
} else {
ob.setError("CMAP3200.BATC
ob.setDepositExist(false);
}
myConnection.commit();
} catch (Exception ex) {
Logger.error(this.getClass
ob.setError("CMAP3200.DEPO
try {
myConnection.rollback();
Logger.info(this.getClass(
} catch (Exception rolEx) {
Logger.error(
this.getClass(),
"Problem doing roll back ",
rolEx);
}
} finally {
if (myPool != null) {
myPool.release(myConnectio
}
return ob;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
KarcOrigin, tq for your sharp eye-sighting..
But i think is the miss-out when i paste the code in here. Let's assume that the code ("{") is ok, because it can compile in JDK 1.3. No error. I think there must be some other errors... that cause this "warning: finally clause cannot complete normally "
Object, get rid of the finally block? Ha. i think that's a best suggestion to avoid this "warning" message.. :-)
But do you know what happend or why this happend? I mean the code is complie ok in JDK 1.3 but not in JDK 1.4. Have you guys face this kind of problem before?
But i think is the miss-out when i paste the code in here. Let's assume that the code ("{") is ok, because it can compile in JDK 1.3. No error. I think there must be some other errors... that cause this "warning: finally clause cannot complete normally "
Object, get rid of the finally block? Ha. i think that's a best suggestion to avoid this "warning" message.. :-)
But do you know what happend or why this happend? I mean the code is complie ok in JDK 1.3 but not in JDK 1.4. Have you guys face this kind of problem before?
You didn't show us the import lines in your code.
What type is " Logger" ?
Since JDK1.4++ we have
java.util.logging.Logger
What type is " Logger" ?
Since JDK1.4++ we have
java.util.logging.Logger
> i think that's a best suggestion to avoid this "warning" message.. :-)
it is one solution.
Also can't see what the point of that finally block is as it will get executed regardless of whether an exception is thrown or not so the log meesages does not appear valid.
it is one solution.
Also can't see what the point of that finally block is as it will get executed regardless of whether an exception is thrown or not so the log meesages does not appear valid.
getting rid of the return in the finally block could also possibly fix it.
you should never return from within a finally block. Reason being that an exception may have been thrown that will get lost.
IMO, it's jdk default encoding/locale issue. your jdk1.3 is localized to one language and jdk1.4 is localized to another language that falsely identifies some character as one of '{}()'
ASKER
ken, rrz@871311, that make sense.
Let me re-compile the whole package, and let me observe is that the only reason that the JDK's logger cause me error.
I am using customise Log4J in my sistem.
let me get bcakt o you.
Let me re-compile the whole package, and let me observe is that the only reason that the JDK's logger cause me error.
I am using customise Log4J in my sistem.
let me get bcakt o you.
ASKER
ken,, rrz, same error.
are you all faced this kind of problem?
are you all faced this kind of problem?
Its got nothing to do with the encoding or locale.
Remove the return statement in your finally block, and try compiling.
Remove the return statement in your finally block, and try compiling.
object is right on the return statement in finally block, have a look at this:
http://sharon.cselt.it/projects/jade/jade-develop-archive/0103.html
BTW, this is a warning message, not an error condition, your programs are compiled fine. they can be used and will excuted as it was with jdk1.3
http://sharon.cselt.it/projects/jade/jade-develop-archive/0103.html
BTW, this is a warning message, not an error condition, your programs are compiled fine. they can be used and will excuted as it was with jdk1.3
ASKER
ken, the link you posted didn't say much on how " Diego Alonso " sovle the same problem i do. I am earger to know what is happening..
OK. Object, i have change the coding. To transfer the return from the finally { } block to outside. And no error prompt out. :-) But my design is no matter what happend, i want the message to get return to the calling program. That's why i put it in the finally block. As i remember, finally {} block will execute no matter what happend to the program. right?
OK. Object, i have change the coding. To transfer the return from the finally { } block to outside. And no error prompt out. :-) But my design is no matter what happend, i want the message to get return to the calling program. That's why i put it in the finally block. As i remember, finally {} block will execute no matter what happend to the program. right?
> I am earger to know what is happening..
I explained above. What exactly don't you understand.
> i want the message to get return to the calling program.
what message?
> As i remember, finally {} block will execute no matter what happend to the program. right?
correct.
That does not however mean that you need to add a return in finally to ensure your method returns. Your method will return fine without it.
In fact as I mentioned earlier you should *never* return from a finally block.
>> the link you posted didn't say much on how " Diego Alonso " sovle the same problem i do.
what you get is just a *warning* message, if you *believe* what you did in jdk1.3 was correct, then you can simply ignore the warning. as I said above, you code will run as it was in jdk1.3.
what you get is just a *warning* message, if you *believe* what you did in jdk1.3 was correct, then you can simply ignore the warning. as I said above, you code will run as it was in jdk1.3.
I'd think fixing that cause of the warning would be more approprite than just ignoring it.
your return in finally block is a void return anyways...!!! i.e. that return is not returning any value to the calling method/program....
even if you remove that return from the finally block.. the running thread ( which is deamon most probably) will return back to the calling location......for the simple reason that the metod call is finished...
So All in all you do not need that return in that finally block...
and its a JDK directive not to use return in finally block..
https://jjguidelines.dev.java.net/book/html/apas04.html#JAC_062
even if you remove that return from the finally block.. the running thread ( which is deamon most probably) will return back to the calling location......for the simple reason that the metod call is finished...
So All in all you do not need that return in that finally block...
and its a JDK directive not to use return in finally block..
https://jjguidelines.dev.java.net/book/html/apas04.html#JAC_062
I guess what ksfoong meant was he want to method to return instead of throw exception. And indeed, the return in finally block does it.
I absolutely agree on those conventions. The convention said do not return from try block as well (same level of no return in finally block), but yet a lot of people returning from try block. I have come across it in sun's code. :-)
I absolutely agree on those conventions. The convention said do not return from try block as well (same level of no return in finally block), but yet a lot of people returning from try block. I have come across it in sun's code. :-)
> I guess what ksfoong meant was he want to method to return instead of throw exception.
> And indeed, the return in finally block does it.
Absolutely not. If you want to return instead of throwing the exception then you should catch the exception.
Repeating you should not return from a finally block.
> The convention said do not return from try block as well (same level of no return in finally block)
Thats for unrelated reasons.
> And indeed, the return in finally block does it.
Absolutely not. If you want to return instead of throwing the exception then you should catch the exception.
Repeating you should not return from a finally block.
> The convention said do not return from try block as well (same level of no return in finally block)
Thats for unrelated reasons.
>> Absolutely not.
why not?
>> If you want to return instead of throwing the exception then you should catch the exception.
that everybody know.
>> Repeating you should not return from a finally block.
the same result as catch the exception and ignore it, what to lose?
why not?
>> If you want to return instead of throwing the exception then you should catch the exception.
that everybody know.
>> Repeating you should not return from a finally block.
the same result as catch the exception and ignore it, what to lose?
thanks for closing question :)
can u post your code.