[Fb-contrib-commit] SF.net SVN: fb-contrib:[1738] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2013-01-30 06:53:37
|
Revision: 1738
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1738&view=rev
Author: dbrosius
Date: 2013-01-30 06:53:29 +0000 (Wed, 30 Jan 2013)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples/LO_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/build.xml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.9.0" />
+ <property name="fb-contrib.version" value="4.8.2" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/htdocs/index.shtml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -68,8 +68,8 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.1 available for download
- <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.1.jar/download">here</a>.</p>
+ <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.2 available for download
+ <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.2.jar/download">here</a>.</p>
</div>
<hr/>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/htdocs/repository.html 2013-01-30 06:53:29 UTC (rev 1738)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>4.8.1</td></tr>
+ <tr><td><b>Version:</b></td><td>4.8.2</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/pom.xml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.9.0</version>
+ <version>4.8.2</version>
<parent>
<groupId>org.sonatype.oss</groupId>
Modified: trunk/fb-contrib/samples/LO_Sample.java
===================================================================
--- trunk/fb-contrib/samples/LO_Sample.java 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/samples/LO_Sample.java 2013-01-30 06:53:29 UTC (rev 1738)
@@ -1,3 +1,5 @@
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -4,19 +6,20 @@
import java.io.InputStream;
import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggerFactory;
@SuppressWarnings("all")
-public class LO_Sample
+public class LO_Sample
{
private static Logger l1 = Logger.getLogger(String.class);
private static Logger l2 = Logger.getLogger("com.foo.LO_Sample");
-
+
public LO_Sample(Logger l3)
{
-
+
}
-
+
public void testStutter() throws IOException
{
InputStream is = null;
@@ -34,4 +37,18 @@
is.close();
}
}
+
+ public class Inner
+ {
+ public void fpUseAnon() {
+ ActionListener l = new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ae)
+ {
+ Logger.getLogger(Inner.class).error("fp");
+ Logger.getLogger(LO_Sample.class).error("not fp");
+ }
+ };
+ }
+ }
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-01-30 06:53:29 UTC (rev 1738)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2013 Dave Brosius
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -42,11 +42,11 @@
public class LoggerOddities extends BytecodeScanningDetector {
private static JavaClass THROWABLE_CLASS;
private static Set<String> loggerMethods;
-
+
static {
try {
THROWABLE_CLASS = Repository.lookupClass("java/lang/Throwable");
-
+
loggerMethods = new HashSet<String>();
loggerMethods.add("trace");
loggerMethods.add("debug");
@@ -61,7 +61,7 @@
private final BugReporter bugReporter;
private OpcodeStack stack;
private String clsName;
-
+
/**
* constructs a LO detector given the reporter to report bugs on.
@@ -70,12 +70,12 @@
public LoggerOddities(final BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
-
-
+
+
/**
* implements the visitor to discover what the class name is if it is a normal class,
* or the owning class, if the class is an anonymous class.
- *
+ *
* @param classContext the context object of the currently parsed class
*/
@Override
@@ -100,10 +100,10 @@
stack = null;
}
}
-
+
/**
* implements the visitor to reset the stack
- *
+ *
* @param obj the context object of the currently parsed code block
*/
@Override
@@ -127,17 +127,17 @@
}
super.visitCode(obj);
}
-
+
/**
* implements the visitor to look for calls to Logger.getLogger with the wrong class name
- *
+ *
* @param seen the opcode of the currently parsed instruction
*/
@Override
public void sawOpcode(int seen) {
String ldcClassName = null;
int exMessageReg = -1;
-
+
try {
if ((seen == LDC) || (seen == LDC_W)) {
Constant c = getConstantRefOperand();
@@ -148,13 +148,13 @@
} else if (seen == INVOKESTATIC) {
String callingClsName = getClassConstantOperand();
String mthName = getNameConstantOperand();
-
+
String loggingClassName = null;
if ("org/slf4j/LoggerFactory".equals(callingClsName)
&& "getLogger".equals(mthName)) {
String signature = getSigConstantOperand();
-
+
if ("(Ljava/lang/Class;)Lorg/slf4j/Logger;".equals(signature)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
@@ -168,11 +168,11 @@
loggingClassName = loggingClassName.replace('.', '/');
}
}
- }
+ }
} else if ("org/apache/log4j/Logger".equals(callingClsName)
&& "getLogger".equals(mthName)) {
String signature = getSigConstantOperand();
-
+
if ("(Ljava/lang/Class;)Lorg/apache/log4j/Logger;".equals(signature)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
@@ -198,7 +198,7 @@
} 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);
@@ -212,16 +212,27 @@
loggingClassName = loggingClassName.replace('.', '/');
}
}
- }
+ }
}
if (loggingClassName != null) {
if (stack.getStackDepth() > 0) {
if (!loggingClassName.equals(clsName)) {
- bugReporter.reportBug(new BugInstance(this, "LO_SUSPECT_LOG_CLASS", (callingClsName.indexOf('$') >= 0) ? LOW_PRIORITY : NORMAL_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this));
+ boolean isPrefix = clsName.startsWith(loggingClassName);
+ boolean isAnonClassPrefix;
+ if (isPrefix) {
+ String anonClass = clsName.substring(loggingClassName.length());
+ isAnonClassPrefix = anonClass.matches("(\\$\\d+)+");
+ } else {
+ isAnonClassPrefix = false;
+ }
+
+ if (!isAnonClassPrefix) {
+ bugReporter.reportBug(new BugInstance(this, "LO_SUSPECT_LOG_CLASS", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
}
}
}
@@ -244,7 +255,7 @@
if (stack.getStackDepth() >= 2) {
OpcodeStack.Item exItem = stack.getStackItem(0);
OpcodeStack.Item msgItem = stack.getStackItem(1);
-
+
Integer exReg = (Integer)msgItem.getUserValue();
if (exReg != null) {
if (exReg.intValue() == exItem.getRegisterNumber()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|