[Fb-contrib-commit] SF.net SVN: fb-contrib:[1608] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-09-10 01:25:56
|
Revision: 1608
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1608&view=rev
Author: dbrosius
Date: 2010-09-10 01:25:50 +0000 (Fri, 10 Sep 2010)
Log Message:
-----------
add support for commons logging in LO
Modified Paths:
--------------
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2010-09-06 02:47:08 UTC (rev 1607)
+++ trunk/fb-contrib/etc/findbugs.xml 2010-09-10 01:25:50 UTC (rev 1608)
@@ -195,7 +195,7 @@
<!-- <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
- <!-- <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousNullGuard" speed="fast" hidden="true" reports="SNG_SUSPICIOUS_NULL_FIELD_GUARD,SNG_SUSPICIOUS_NULL_LOCAL_GUARD" /> -->
+ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousNullGuard" speed="fast" reports="SNG_SUSPICIOUS_NULL_FIELD_GUARD,SNG_SUSPICIOUS_NULL_LOCAL_GUARD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.MoreDumbMethods" speed="fast"
reports="MDM_RUNTIME_EXIT_OR_HALT,MDM_RUNFINALIZATION,MDM_BIGDECIMAL_EQUALS,MDM_INETADDRESS_GETLOCALHOST,MDM_PROMISCUOUS_SERVERSOCKET,MDM_RANDOM_SEED,MDM_SECURERANDOM_CTOR,MDM_SECURERANDOM_GETSEED,MDM_THREAD_PRIORITIES,MDM_THREAD_YIELD,MDM_WAIT_WITHOUT_TIMEOUT,MDM_THREAD_FAIRNESS,MDM_REENTRANTLOCK_HELDBY,MDM_STRING_BYTES_ENCODING,MDM_SETDEFAULTLOCALE" />
@@ -375,4 +375,4 @@
<BugPattern abbrev="PUS" type="PUS_POSSIBLE_UNSUSPECTED_SERIALIZATION" category="CORRECTNESS" experimental="true" />
<BugPattern abbrev="SEC" type="SEC_SIDE_EFFECT_CONSTRUCTOR" category="STYLE" experimental="true" />
<BugPattern abbrev="SGSU" type="SGSU_SUSPICIOUS_GETTER_SETTER_USE" category="CORRECTNESS" experimental="true" />
-</FindbugsPlugin>
\ No newline at end of file
+</FindbugsPlugin>
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2010-09-06 02:47:08 UTC (rev 1607)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2010-09-10 01:25:50 UTC (rev 1608)
@@ -91,7 +91,8 @@
{
String parmSig = t.getSignature();
if ("Lorg/slf4j/Logger;".equals(parmSig)
- || "Lorg/apache/log4j/Logger;".equals(parmSig)) {
+ || "Lorg/apache/log4j/Logger;".equals(parmSig)
+ || "Lorg/apache/commons/logging/Log;".equals(parmSig)) {
bugReporter.reportBug(new BugInstance(this, "LO_SUSPECT_LOG_PARAMETER", NORMAL_PRIORITY)
.addClass(this)
.addMethod(this)
@@ -136,8 +137,9 @@
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
loggingClassName = (String)item.getConstant();
- if (loggingClassName != null)
- loggingClassName = loggingClassName.replace('.', '/');
+ if (loggingClassName != null) {
+ loggingClassName = loggingClassName.replace('.', '/');
+ }
}
}
} else if ("org/apache/log4j/Logger".equals(callingClsName)
@@ -153,17 +155,37 @@
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
loggingClassName = (String)item.getConstant();
- if (loggingClassName != null)
- loggingClassName = loggingClassName.replace('.', '/');
+ if (loggingClassName != null) {
+ loggingClassName = loggingClassName.replace('.', '/');
+ }
}
} else if ("(Ljava/lang/String;Lorg/apache/log4j/spi/LoggerFactory;)Lorg/apache/log4j/Logger;".equals(signature)) {
if (stack.getStackDepth() > 1) {
OpcodeStack.Item item = stack.getStackItem(1);
loggingClassName = (String)item.getConstant();
- if (loggingClassName != null)
- loggingClassName = loggingClassName.replace('.', '/');
+ if (loggingClassName != null) {
+ loggingClassName = loggingClassName.replace('.', '/');
+ }
}
}
+ } else if ("org/apache/commons/logging/LogFactory".equals(callingClsName)
+ && "getLog".equals(mthName)) {
+ String signature = getSigConstantOperand();
+
+ if ("(Ljava/lang/Class;)Lorg/apache/commons/logging/Log;".equals(signature)) {
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ loggingClassName = (String)item.getUserValue();
+ }
+ } else if ("(Ljava/lang/String;)Lorg/apache/commons/logging/Log;".equals(signature)) {
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ loggingClassName = (String)item.getConstant();
+ if (loggingClassName != null) {
+ loggingClassName = loggingClassName.replace('.', '/');
+ }
+ }
+ }
}
if (loggingClassName != null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|