[Fb-contrib-commit] SF.net SVN: fb-contrib: [637] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-09-08 23:18:49
|
Revision: 637 http://svn.sourceforge.net/fb-contrib/?rev=637&view=rev Author: dbrosius Date: 2006-09-08 16:18:40 -0700 (Fri, 08 Sep 2006) Log Message: ----------- if a localvariable table exists, and exception variable cannot be found in the table, then the catch block is empty, so ignore. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2006-09-07 22:24:54 UTC (rev 636) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2006-09-08 23:18:40 UTC (rev 637) @@ -183,7 +183,8 @@ try { CatchInfo catchInfo = it.next(); if (pc == catchInfo.getStart()) { - updateExceptionRegister(catchInfo, seen, pc); + if (!updateExceptionRegister(catchInfo, seen, pc)) + it.remove(); break; } else if (pc > catchInfo.getFinish()) { it.remove(); @@ -268,7 +269,18 @@ } } - private void updateExceptionRegister(CatchInfo ci, int seen, int pc) { + /** + * looks to update the catchinfo block with the register used for the + * exception variable. If their is a local variable table, but the local + * variable can't be found return false, signifying an empty catch block. + * + * @param ci the catchinfo record for the catch starting at this pc + * @param seen the opcode of the currently visited instruction + * @param pc the current pc + * + * @return whether the catch block is empty + */ + private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); @@ -281,10 +293,20 @@ if (finish < ci.getFinish()) ci.setFinish(finish); } + else + return false; } } + return true; } + /** + * add a catch block info record for the catch block that is guessed to be + * in the range of start to finish + * + * @param start the handler pc + * @param finish the guessed end of the catch block + */ private void addCatchBlock(int start, int finish) { CatchInfo ci = new CatchInfo(start, finish); catchInfos.add(ci); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |