[Fb-contrib-commit] SF.net SVN: fb-contrib:[1580] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-07-16 04:29:18
|
Revision: 1580
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1580&view=rev
Author: dbrosius
Date: 2010-07-16 04:29:12 +0000 (Fri, 16 Jul 2010)
Log Message:
-----------
don't report WEM for UnsupportedOperationException
Modified Paths:
--------------
trunk/fb-contrib/samples/WEM_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
Modified: trunk/fb-contrib/samples/WEM_Sample.java
===================================================================
--- trunk/fb-contrib/samples/WEM_Sample.java 2010-07-16 04:17:14 UTC (rev 1579)
+++ trunk/fb-contrib/samples/WEM_Sample.java 2010-07-16 04:29:12 UTC (rev 1580)
@@ -17,5 +17,9 @@
{
throw new RuntimeException("Wow");
}
-
+
+ public void fpunimpled()
+ {
+ throw new UnsupportedOperationException("fpunimpled is unimpled");
+ }
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2010-07-16 04:17:14 UTC (rev 1579)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2010-07-16 04:29:12 UTC (rev 1580)
@@ -19,6 +19,8 @@
package com.mebigfatguy.fbcontrib.detect;
import java.util.BitSet;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.bcel.Constants;
import org.apache.bcel.Repository;
@@ -37,15 +39,19 @@
public class WeakExceptionMessaging extends BytecodeScanningDetector {
private static JavaClass exceptionClass;
+ private static final Set<String> ignorableExceptionTypes = new HashSet<String>();
+
static {
try {
exceptionClass = Repository.lookupClass("java/lang/Exception");
} catch (ClassNotFoundException cnfe) {
exceptionClass = null;
}
+
+ ignorableExceptionTypes.add("java.lang.UnsupportedOperationException");
}
- private BugReporter bugReporter;
+ private final BugReporter bugReporter;
private OpcodeStack stack;
/**
@@ -116,10 +122,13 @@
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
if (item.getUserValue() != null) {
- bugReporter.reportBug(new BugInstance(this, "WEM_WEAK_EXCEPTION_MESSAGING", LOW_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this));
+ JavaClass exClass = item.getJavaClass();
+ if ((exClass == null) || !ignorableExceptionTypes.contains(item.getJavaClass().getClassName())) {
+ bugReporter.reportBug(new BugInstance(this, "WEM_WEAK_EXCEPTION_MESSAGING", LOW_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
}
}
} else if ((seen == LDC) || (seen == LDC_W)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|