[Fb-contrib-commit] SF.net SVN: fb-contrib: [592] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/de
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-08-08 05:39:28
|
Revision: 592 Author: dbrosius Date: 2006-08-07 22:39:19 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=592&view=rev Log Message: ----------- fix fp's due to falling to clear catchInfos on method entry 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-08-08 05:06:38 UTC (rev 591) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2006-08-08 05:39:19 UTC (rev 592) @@ -18,9 +18,11 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.ArrayList; import java.util.BitSet; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Set; import org.apache.bcel.Constants; @@ -114,12 +116,29 @@ public void visitCode(Code obj) { if (prescreen(obj, getMethod())) { stack.resetForMethodEntry(this); - exceptions = obj.getExceptionTable(); + catchInfos.clear(); + exceptions = collectExceptions(obj.getExceptionTable()); super.visitCode(obj); } } /** + * collects all the valid exception objects (ones where start and finish are before the target + * + * @param exceptions the exceptions from the class file + * @return the filtered exceptions + */ + public CodeException[] collectExceptions(CodeException[] exceptions) { + List<CodeException> filteredEx = new ArrayList<CodeException>(); + for (CodeException ce : exceptions) { + if ((ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() < ce.getHandlerPC())) { + filteredEx.add(ce); + } + } + return filteredEx.toArray(new CodeException[filteredEx.size()]); + } + + /** * implements the visitor to find throwing alternative exceptions from a catch block, without * forwarding along the original exception */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |