[Fb-contrib-commit] SF.net SVN: fb-contrib: [668] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-10-10 23:37:09
|
Revision: 668 http://svn.sourceforge.net/fb-contrib/?rev=668&view=rev Author: dbrosius Date: 2006-10-10 16:37:05 -0700 (Tue, 10 Oct 2006) Log Message: ----------- don't report LEST if the exception that is thrown was compiled with a jdk less than version 1.4 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-10-10 06:01:42 UTC (rev 667) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2006-10-10 23:37:05 UTC (rev 668) @@ -84,8 +84,7 @@ @Override public void visitClassContext(ClassContext classContext) { try { - int majorVersion = classContext.getJavaClass().getMajor(); - if ((throwableClass != null) && (majorVersion >= Constants.MAJOR_1_4)) { + if ((throwableClass != null) && (!isPre14Class(classContext.getJavaClass()))) { stack = new OpcodeStack(); catchInfos = new HashSet<CatchInfo>(); exReg = new HashMap<Integer, Boolean>(); @@ -217,10 +216,13 @@ OpcodeStack.Item itm = stack.getStackItem(0); if ((itm.getRegisterNumber() != catchInfo.getRegister()) && (itm.getUserValue() == null)) { - bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + if (!isPre14Class(itm.getJavaClass())) + { + bugReporter.reportBug(new BugInstance(this, "LEST_LOST_EXCEPTION_STACK_TRACE", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } it.remove(); break; } @@ -257,6 +259,16 @@ } } + /** returns whether the class in question was compiled with a jdk less than 1.4 + * + * @param exClass the class to check + * @return whether the class is compiled with a jdk less than 1.4 + */ + private boolean isPre14Class(JavaClass cls) + { + return cls.getMajor() < Constants.MAJOR_1_4; + } + private void removePreviousHandlers(int pc) { //This unnecessarily squashes some nested catch blocks, but better than false positives This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |