[Fb-contrib-commit] SF.net SVN: fb-contrib:[1751] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2013-10-19 23:44:11
|
Revision: 1751
http://sourceforge.net/p/fb-contrib/code/1751
Author: dbrosius
Date: 2013-10-19 23:44:05 +0000 (Sat, 19 Oct 2013)
Log Message:
-----------
version 4.8.5
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bcel.license
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples/AIOB_Sample.java
trunk/fb-contrib/samples/BAS_Sample.java
trunk/fb-contrib/samples/BED_Sample.java
trunk/fb-contrib/samples/CLI_Sample.java
trunk/fb-contrib/samples/FP_Sample.java
trunk/fb-contrib/samples/LO_Sample.java
trunk/fb-contrib/samples/PCAIL_Sample.java
trunk/fb-contrib/samples/PMB_Sample.java
trunk/fb-contrib/samples/PSC_Sample.java
trunk/fb-contrib/samples/SPP_Sample.java
trunk/fb-contrib/samples/SUA_Sample.java
trunk/fb-contrib/samples/WOC_Sample.java
trunk/fb-contrib/samples/samples.fbp
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
Added Paths:
-----------
trunk/fb-contrib/samples/SCRV_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/.classpath 2013-10-19 23:44:05 UTC (rev 1751)
@@ -4,14 +4,15 @@
<classpathentry kind="src" path="src"/>
<classpathentry excluding="lib/" kind="src" path="samples"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="samples/lib/jsp-api-2.2.1.jar"/>
- <classpathentry kind="lib" path="samples/lib/junit-4.10.jar"/>
+ <classpathentry kind="lib" path="samples/lib/junit-4.10.jar" sourcepath="/home/dave/.m2/repository/junit/junit/4.10/junit-4.10-sources.jar"/>
<classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/>
<classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
<classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="samples/lib/backport-util-concurrent-3.1.jar"/>
+ <classpathentry kind="lib" path="samples/lib/slf4j-api-1.7.5.jar"/>
+ <classpathentry kind="lib" path="samples/lib/junit.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/build.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.4" />
+ <property name="fb-contrib.version" value="4.8.5" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -40,6 +40,7 @@
<property name="servlet-api.version" value="3.0.1" />
<property name="backport-util-concurrent.version" value="3.1" />
<property name="commons-collections.version" value="3.2.1" />
+ <property name="slf4j.version" value="1.7.5" />
<property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar" />
<property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" />
@@ -48,6 +49,7 @@
<property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" />
<property name="backport-util-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-util-concurrent.version}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
<property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" />
+ <property name="slf4j-api-url" value="http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar" />
<target name="check">
<available file="${dest}/${name}-${version}.jar" property="jar-exists" />
@@ -85,6 +87,7 @@
<pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" />
<pull url="${backport-util-concurrent-url}" dest="${sampleslib.dir}" name="backport-util-concurrent" version="${backport-util-concurrent.version}" />
<pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" />
+ <pull url="${slf4j-api-url}" dest="${sampleslib.dir}" name="slf4j-api" version="${slf4j.version}" />
</target>
<target name="clean" description="removes all generated collateral">
@@ -119,7 +122,8 @@
<pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
- <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
+ <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
+ <pathelement location="${sampleslib.dir}/slf4j-api-${slf4j.version}.jar" />
</path>
<mkdir dir="${classes.dir}/com" />
<mkdir dir="${classes.dir}/com/mebigfatguy" />
@@ -182,7 +186,7 @@
<attribute name="Bundle-Vendor" value="FB-Contrib Project" />
<attribute name="Require-Bundle" value="edu.umd.cs.findbugs.plugin.eclipse" />
<attribute name="Bundle-ActivationPolicy" value="lazy" />
- <attribute name="Export-Package" value="com.mebigfatguy.fbcontrib.collect, com.mebigfatguy.fbcontrib.detect" />
+ <attribute name="Export-Package" value="com.mebigfatguy.fbcontrib.collect, com.mebigfatguy.fbcontrib.detect, com.mebigfatguy.fbcontrib.debug" />
</manifest>
</jar>
</target>
Modified: trunk/fb-contrib/etc/bcel.license
===================================================================
--- trunk/fb-contrib/etc/bcel.license 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/etc/bcel.license 2013-10-19 23:44:05 UTC (rev 1751)
@@ -187,7 +187,7 @@
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
- * Copyright [yyyy] [name of copyright owner]
+ * Copyright [2013] [Aoache BCEL]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -16,7 +16,25 @@
<!-- Detectors -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
+
+<!-- PERMANENTLY DISABLED
+ <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
+-->
+<!-- COMMENT OUT FOR RELEASE -->
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
+
+ <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.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
+
+<!-- COMMENT OUT FOR RELEASE -->
+
<Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" speed="fast" reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING,ISB_TOSTRING_APPENDING" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators" speed="slow" reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" />
@@ -30,9 +48,7 @@
<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
- <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
- 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 +89,7 @@
<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
- <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
- 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" />
@@ -132,10 +146,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast"
- reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS" />
-<!-- COMMENT OUT FOR RELEASE
+ reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF" />
+
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeletingWhileIterating" speed="fast" reports="DWI_DELETING_WHILE_ITERATING,DWI_MODIFYING_WHILE_ITERATING" />
@@ -165,7 +179,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" speed="fast" reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" reports="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" reports="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" />
@@ -176,9 +190,6 @@
<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
- <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +204,6 @@
<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
- <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +229,7 @@
<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
- <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
- 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" />
@@ -235,7 +241,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_MISMATCHED_RETURN,CU_CLONE_USABILITY_THROWS" />
-<!-- COMMENT OUT FOR RELEASE
+
+<!-- For 5.0.0
+
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
@@ -245,6 +253,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall" speed="fast" reports="NPMC_NON_PRODUCTIVE_METHOD_CALL" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds" speed="fast" reports="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS,AIOB_ARRAY_STORE_TO_NULL_REFERENCE" />
+
-->
<!-- BugPattern -->
@@ -347,6 +356,7 @@
<BugPattern abbrev="SPP" type="SPP_STRINGBUILDER_IS_MUTABLE" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_USE_GET0" category="PERFORMANCE" />
<BugPattern abbrev="SPP" type="SPP_DOUBLE_APPENDED_LITERALS" category="PERFORMANCE" />
+ <BugPattern abbrev="SPP" type="SPP_NULL_BEFORE_INSTANCEOF" category="CORRECTNESS" />
<BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" />
<BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" category="STYLE" />
<BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" />
@@ -370,10 +380,12 @@
<BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" />
<BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" />
<BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" />
- <BugPattern abbrev="LO" type="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE" category="CORRECTNESS" />
+ <BugPattern abbrev="LO" type="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_SUSPECT_LOG_PARAMETER" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_STUTTERED_MESSAGE" category="STYLE" />
+ <BugPattern abbrev="LO" type="LO_INVALID_FORMATTING_ANCHOR" category="CORRECTNESS" />
+ <BugPattern abbrev="LO" type="LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS" category="CORRECTNESS" />
<BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" />
<BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" category="PERFORMANCE" />
<BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" category="CORRECTNESS" />
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/etc/messages.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -62,8 +62,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter">
<Details>
<![CDATA[
- <p> Looks for parameters that are defined by classes, but only use methods defined by an
- implemented interface or super class. Relying on concrete classes in public signatures causes cohesion,
+ <p> Looks for parameters that are defined by classes, but where the method only use methods defined by an
+ implemented interface or super class of that class. Relying on concrete classes in public signatures causes cohesion,
and makes low impact changes more difficult.</p>
<p>It is a slow detector</p>
]]>
@@ -1350,6 +1350,9 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
+ <Details></Details>
+ </Detector>
<!-- BugPattern -->
@@ -1601,11 +1604,11 @@
</BugPattern>
<BugPattern type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN">
- <ShortDescription>Class has abnormal exit from finally block</ShortDescription>
- <LongDescription>Class {0} has abnormal exit from finally block</LongDescription>
+ <ShortDescription>Method has abnormal exit from finally block</ShortDescription>
+ <LongDescription>Method {1} has abnormal exit from finally block</LongDescription>
<Details>
<![CDATA[
- <p>This class returns or throws exceptions from a finally block. This will
+ <p>This method returns or throws exceptions from a finally block. This will
mask real program logic in the try block, and short-circuit normal method termination.
</p>
]]>
@@ -2646,6 +2649,17 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="SPP_NULL_BEFORE_INSTANCEOF">
+ <ShortDescription>Method checks a reference for null before calling instanceof</ShortDescription>
+ <LongDescription>Method {1} checks a reference for null before calling instanceof</LongDescription>
+ <Details>
+ <![CDATA[
+ This method checks a reference for null just before seeing if the reference is an instanceof some class.
+ Since instanceof will return false for null references, the null check is not needed.
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE">
<ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription>
@@ -2994,6 +3008,29 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="LO_INVALID_FORMATTING_ANCHOR">
+ <ShortDescription>Method attempts to log using numbered formatting anchors</ShortDescription>
+ <LongDescription>Method {1} attempts to log using numbered formatting anchors</LongDescription>
+ <Details>
+ <![CDATA[
+ This method attempts to use an SLF4J logger to log a parameterized expression using formatting anchors.
+ However, slf4j uses simple non numbered anchors such as {}, rather than anchors with digits in them as the
+ code uses. Thus no parameter replacement will occur.
+ ]]>
+ </Details>
+ </BugPattern>
+
+ <BugPattern type="LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS">
+ <ShortDescription>Method passes an incorrect number of parameters to an SLF4J logging statement</ShortDescription>
+ <LongDescription>Method {1} passes an incorrect number of parameters to an SLF4J logging statement</LongDescription>
+ <Details>
+ <![CDATA[
+ This method passes the wrong number of parameters to a slf4j logging method (error, warn, info, debug) based on the number of anchors {} in the
+ format string. An additional exception argument is allowed if found.
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE">
<ShortDescription>Class relies on internal api classes</ShortDescription>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/htdocs/index.shtml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -68,8 +68,8 @@
</li>
</ul>
</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>
+ <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.5 available for download
+ <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.5.jar/download">here</a>.</p>
</div>
<hr/>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/htdocs/repository.html 2013-10-19 23:44:05 UTC (rev 1751)
@@ -22,11 +22,11 @@
<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.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>4.8.2</td></tr>
+ <tr><td><b>Version:</b></td><td>4.8.5</td></tr>
</table>
</div>
-<p>fb-contrib is also now available at <a href="http://search.maven.org">search.maven.org</a></p>
+<p>fb-contrib is also now available at <a href="http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mebigfatguy.fb-contrib%22">search.maven.org</a></p>
</div>
</body>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/pom.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.8.4</version>
+ <version>4.8.5</version>
<parent>
<groupId>org.sonatype.oss</groupId>
@@ -44,6 +44,15 @@
</properties>
<timezone>+1</timezone>
</contributor>
+ <contributor>
+ <name>Trevor Pounds</name>
+ </contributor>
+ <contributor>
+ <name>Ronald Blaschke</name>
+ </contributor>
+ <contributor>
+ <name>Zenichi Amano</name>
+ </contributor>
</contributors>
<licenses>
Modified: trunk/fb-contrib/samples/AIOB_Sample.java
===================================================================
--- trunk/fb-contrib/samples/AIOB_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/AIOB_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -1,4 +1,6 @@
+import java.util.List;
+
public class AIOB_Sample
{
int[] fa = new int[4];
@@ -19,4 +21,17 @@
b[4] = 4;
fb[4] = 4;
}
+
+ public int[] fpPlusPlusNotRecognized(List<String> l) {
+ int size = 0;
+
+ for (String s : l) {
+ size++;
+ }
+
+ int[] data = new int[size];
+
+ data[0] = 0;
+ return data;
+ }
}
Modified: trunk/fb-contrib/samples/BAS_Sample.java
===================================================================
--- trunk/fb-contrib/samples/BAS_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/BAS_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -1,3 +1,4 @@
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
@@ -166,6 +167,18 @@
}
return it.next();
-
}
+
+ public List<String> testFPSynchronized(String s, String p) {
+ List<String> l = new ArrayList<String>();
+ String x = s;
+ synchronized(s) {
+ if (p != null) {
+ l.add(p);
+ return l;
+ }
+ }
+
+ return null;
+ }
}
Modified: trunk/fb-contrib/samples/BED_Sample.java
===================================================================
--- trunk/fb-contrib/samples/BED_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/BED_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -37,6 +37,11 @@
{
}
+
+ public final void badFinal() throws ClassNotFoundException
+ {
+
+ }
public static void doIt() throws SQLException, IOException
{
Modified: trunk/fb-contrib/samples/CLI_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CLI_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/CLI_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -1,4 +1,7 @@
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
@SuppressWarnings("all")
public class CLI_Sample
{
@@ -25,4 +28,17 @@
String c = parts[2];
return c + b + a;
}
+
+ class FPHander implements InvocationHandler
+ {
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ if (args[2] == null)
+ {
+ return null;
+ }
+
+ return String.valueOf(args[0]) + String.valueOf(args[1]);
+ }
+ }
}
Modified: trunk/fb-contrib/samples/FP_Sample.java
===================================================================
--- trunk/fb-contrib/samples/FP_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/FP_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -7,7 +7,7 @@
System.out.println(a);
}
- public void test2(String a) {
+ public void test2(String a){
a = "hello";
System.out.println(a);
}
@@ -20,4 +20,8 @@
b = a;
return a + b + c;
}
+
+ public void testLongDouble(int a, long b, double d, char c) {
+ }
+
}
\ No newline at end of file
Modified: trunk/fb-contrib/samples/LO_Sample.java
===================================================================
--- trunk/fb-contrib/samples/LO_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/LO_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -6,7 +6,7 @@
import java.io.InputStream;
import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LoggerFactory;
+import org.slf4j.LoggerFactory;
@SuppressWarnings("all")
@@ -14,6 +14,7 @@
{
private static Logger l1 = Logger.getLogger(String.class);
private static Logger l2 = Logger.getLogger("com.foo.LO_Sample");
+ private static final org.slf4j.Logger l3 = LoggerFactory.getLogger(LO_Sample.class);
public LO_Sample(Logger l3)
{
@@ -37,6 +38,26 @@
is.close();
}
}
+
+ public void testInvalidSLF4jParm()
+ {
+ l3.error("This is a problem {0}", "hello");
+ }
+
+ public void testWrongNumberOfParms()
+ {
+ l3.error("This is a problem {}", "hello", "hello");
+ l3.error("This is a problem {} and this {}", "hello");
+ l3.error("This is a problem {} and this {} and this {}", "hello", "world");
+ l3.error("This is a problem {} and this {} and this {} and this {}", "hello", "hello", "hello");
+ }
+
+ public void testFPWrongNumberOfParms()
+ {
+ l3.error("This is a problem {}", "hello", new IOException("Yikes"));
+ l3.error("This is a problem {} and this {} and this {} and this {}", "hello", "hello", "hello", "hello", new RuntimeException("yikes"));
+ l3.error("This is a problem {} and this {}", "hello", new RuntimeException("yikes"));
+ }
public class Inner
{
Modified: trunk/fb-contrib/samples/PCAIL_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PCAIL_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/PCAIL_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -127,6 +127,27 @@
}
}
+ public List<String> fpPreUse()
+ {
+ List<String> l = null;
+
+ while (true)
+ {
+ if (l != null)
+ {
+ return l;
+ }
+
+ l = new ArrayList<String>();
+ l.add("Foo");
+
+ for (String s : l)
+ {
+ System.out.println(s);
+ }
+ }
+ }
+
private PCAIL_Sample builder()
{
return this;
Modified: trunk/fb-contrib/samples/PMB_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PMB_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/PMB_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -7,7 +7,7 @@
{
private static Set<String> bl_data = new HashSet<String>();
private static List<String> data = new ArrayList<String>();
-
+ private static Set<String> inner_data = new HashSet<String>();
public void add(String s)
{
bl_data.add(s);
@@ -18,4 +18,14 @@
{
data.remove(s);
}
+
+ public void fpInnerDoesRemove() {
+ inner_data.add("Hello");
+ Runnable r = new Runnable() {
+ public void run() {
+ inner_data.remove("Hello");
+ }
+ };
+ r.run();
+ }
}
Modified: trunk/fb-contrib/samples/PSC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PSC_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/PSC_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -19,6 +19,13 @@
names.add(s.toString());
}
}
+
+ public void testPSCMaps(Map<String, String> input) {
+ Map<String, String> output = new HashMap<String, String>();
+ for (Map.Entry<String, String> entry : input.entrySet()) {
+ output.put(entry.getKey().intern(), entry.getValue());
+ }
+ }
public void testPSCEnumerated() {
Set<String> commonWords = new HashSet<String>();
@@ -40,6 +47,14 @@
commonWords.add("they");
commonWords.add("them");
}
+
+ public List<String> testAddAllToCtor(List<String> l) {
+ List<String> ll = new ArrayList<String>();
+ ll.addAll(l);
+
+ ll.add("FooBar");
+ return ll;
+ }
public void fpDontHaveCollectionForSizing(Iterator<Long> it) {
Deque<Long> ad = new ArrayDeque<Long>();
@@ -56,6 +71,17 @@
}
}
}
+
+ public List<String> fpAddSubCollection(Map<String, Set<String>> s)
+ {
+ List<String> l = new ArrayList<String>();
+ for (Map.Entry<String, Set<String>> entry : s.entrySet())
+ {
+ l.add(entry.getKey());
+ l.addAll(entry.getValue());
+ }
+ return l;
+ }
public void fpSwitchInLoop(Set<Integer> source) {
List<Integer> dest = new ArrayList<Integer>();
@@ -90,6 +116,32 @@
}
return l;
-
}
+
+ public List<Exception> fpPSCInCatchBlock(List<String> src) {
+ List<Exception> exceptions = new ArrayList<Exception>();
+
+ for (String s : src) {
+ try {
+ s = s.substring(1000, 1001);
+
+ } catch (IndexOutOfBoundsException e) {
+ exceptions.add(e);
+ }
+ }
+
+ List<Exception> exceptions2 = new ArrayList<Exception>();
+
+ for (String s : src) {
+ try {
+ s = s.substring(1000, 1001);
+ if (s == null)
+ return null;
+ } catch (IndexOutOfBoundsException e) {
+ exceptions2.add(e);
+ }
+ }
+
+ return exceptions;
+ }
}
Added: trunk/fb-contrib/samples/SCRV_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SCRV_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/SCRV_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -0,0 +1,45 @@
+import java.util.Comparator;
+
+public class SCRV_Sample
+{
+ public static final int T1 = 0;
+ public static final int T2 = 1;
+
+ int t = 0;
+ class SampleComparator implements Comparator<SCRV_Sample>
+ {
+ public int compare(SCRV_Sample arg0, SCRV_Sample arg1) {
+ if (arg0.t == arg1.t)
+ return 0;
+
+ return -1;
+ }
+ }
+
+ class SampleComparable implements Comparable<SCRV_Sample>
+ {
+ public int compareTo(SCRV_Sample arg0) {
+ if (t == arg0.t)
+ return 0;
+
+ return 1;
+ }
+ }
+
+ class FPComparator implements Comparable<FPComparator>
+ {
+ int i = 0;
+
+ public int compareTo(FPComparator that)
+ {
+ return i < that.i ? -1 : (i == that.i) ? 0 : 1;
+ }
+ }
+
+ class FPThrowsComparator implements Comparator<SCRV_Sample>
+ {
+ public int compare(SCRV_Sample arg0, SCRV_Sample arg1) {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
Property changes on: trunk/fb-contrib/samples/SCRV_Sample.java
___________________________________________________________________
Added: svn:eol-stype
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/fb-contrib/samples/SPP_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SPP_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/SPP_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -22,6 +22,7 @@
private static final double pi = 3.14;
private static final double e = 2.72;
public static final String FALSE_POSITIVE = "INTERN_OK_HERE".intern();
+ private static final String LIT = "lit";
static enum Flap { Smack, Jack };
@@ -118,6 +119,13 @@
sb.append("Hello").append(s).append("there");
}
+ public String testFPDoubleAppendListeralStatic()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("literal").append(LIT).append("literal");
+ return sb.toString();
+ }
+
public boolean testFPUselessTrinary(boolean a, boolean b)
{
@@ -348,4 +356,32 @@
public String testListFirst(List<String> l) {
return l.iterator().next();
}
+
+ public boolean nullAndInstanceOf(Object o) {
+ if ((o != null) && (o instanceof String))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean nullAndInstanceOf(double d1, double d2, double d3, Object o) {
+ if ((o != null) && (o instanceof String))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean fpNullAndInstanceOf(Object o) {
+ if (o != null)
+ {
+ if (o instanceof String)
+ {
+ return true;
+ }
+ return false;
+ }
+ return Math.random() > 0.5;
+ }
}
Modified: trunk/fb-contrib/samples/SUA_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SUA_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/SUA_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -74,4 +74,14 @@
System.arraycopy(src, 0, dst, 0, src.length);
return dst;
}
+
+ public double[] fpSFBug65tipOff() {
+ String[] elems = "1,2.0,3".split(",");
+ double[] result = new double[elems.length];
+ for (int i = 0; i < elems.length; i++)
+ {
+ result[i] = 0.0;
+ }
+ return result;
+ }
}
\ No newline at end of file
Modified: trunk/fb-contrib/samples/WOC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/WOC_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/WOC_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -11,106 +11,111 @@
import java.util.Set;
import java.util.Vector;
+public class WOC_Sample {
+ private final Set<String> memberSet = new HashSet<String>();
+ private Set<String> fpSet;
+ private final List<String> fpList = new ArrayList<String>();
-public class WOC_Sample
-{
- private final Set<String> memberSet = new HashSet<String>();
- private Set<String> fpSet;
- private final List<String> fpList = new ArrayList<String>();
+ public void testWOCSimple() {
+ Set<String> s = new HashSet<String>();
+ s.add("Foo");
+ memberSet.add("fee");
+ if (fpSet.retainAll(new HashSet<String>())) {
+ System.out.println("woops");
+ }
+ }
- public void testWOCSimple()
- {
- Set<String> s = new HashSet<String>();
- s.add("Foo");
- memberSet.add("fee");
- if (fpSet.retainAll(new HashSet<String>())) {
- System.out.println("woops");
- }
- }
+ public Map<String, String> testFPWOCReturn() {
+ Map<String, String> m = new HashMap<String, String>();
+ m.put("Foo", "Bar");
+ memberSet.add("fi");
+ fpSet = new HashSet<String>();
+ return m;
+ }
- public Map<String, String> testFPWOCReturn()
- {
- Map<String, String> m = new HashMap<String, String>();
- m.put("Foo", "Bar");
- memberSet.add("fi");
- fpSet = new HashSet<String>();
- return m;
- }
+ public void testFPWOCAsParm() {
+ Map<String, String> m = new HashMap<String, String>();
+ m.put("Foo", "Bar");
+ memberSet.add("fo");
+ fpSet.add("boo");
+ helper(0, m);
+ }
- public void testFPWOCAsParm()
- {
- Map<String, String> m = new HashMap<String, String>();
- m.put("Foo", "Bar");
- memberSet.add("fo");
- fpSet.add("boo");
- helper(0, m);
- }
+ public void testFPWOCCopy() {
+ Set<String> s = new LinkedHashSet<String>();
+ s.add("foo");
+ Set<String> c = s;
+ memberSet.add("fum");
+ }
- public void testFPWOCCopy()
- {
- Set<String> s = new LinkedHashSet<String>();
- s.add("foo");
- Set<String> c = s;
- memberSet.add("fum");
- }
+ public void testFPWOCInArray() {
+ Vector<Integer> v = new Vector<Integer>();
+ v.addElement(Integer.valueOf(0));
+ Object[] o = new Object[] { v };
+ }
- public void testFPWOCInArray()
- {
- Vector<Integer> v = new Vector<Integer>();
- v.addElement(Integer.valueOf(0));
- Object[] o = new Object[] { v };
- }
+ public void testFPWOCUseReturnVal() {
+ LinkedList<String> l = new LinkedList<String>();
+ l.add("Foo");
+ l.add("Bar");
- public void testFPWOCUseReturnVal()
- {
- LinkedList<String> l = new LinkedList<String>();
- l.add("Foo");
- l.add("Bar");
+ if (l.remove("Foo")) {
+ System.out.println("Dont' report");
+ }
+ }
- if (l.remove("Foo"))
- {
- System.out.println("Dont' report");
- }
- }
+ public Set<String> testFPTrinary(boolean b) {
+ Set<String> s = new HashSet<String>();
+ s.add("foo");
+ s.add("bar");
- public Set<String> testFPTrinary(boolean b)
- {
- Set<String> s = new HashSet<String>();
- s.add("foo");
- s.add("bar");
+ return b ? s : Collections.<String> emptySet();
+ }
- return b ? s : Collections.<String>emptySet();
- }
+ private void helper(int i, Map<String, String> x) {
+ }
- private void helper(int i, Map<String, String> x)
- {
- }
+ public void testFPInnerClass(final Set<String> data) {
+ ActionListener al = new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ data.add("Woot");
+ }
+ };
+ }
- public void testFPInnerClass(final Set<String> data)
- {
- ActionListener al = new ActionListener()
- {
- public void actionPerformed(ActionEvent ae)
- {
- data.add("Woot");
- }
- };
- }
+ public List<String> fpOtherInstance(WOC_Sample ws) {
+ return ws.fpList;
+ }
+
+ public String fpCheckReference(boolean b) {
+ List<String> s = null;
+
+ if (b) {
+ s = new ArrayList<String>();
+ s.add("foo");
+ }
+
+ String result;
+ if (s != null) {
+ result = "yes";
+ } else {
+ result = "no";
+ }
+
+ return result;
+ }
- public List<String> fpOtherInstance(WOC_Sample ws)
- {
- return ws.fpList;
- }
-
- public static class FpContains {
+ public static class FpContains {
private List<String> fpSet;
public FpContains() {
fpSet = new ArrayList<String>();
}
+
public void add() {
fpSet.add("Foo");
}
+
protected void contains() {
for (int i = 0; i < 10; i++) {
if (fpSet.get(i) != null) {
Modified: trunk/fb-contrib/samples/samples.fbp
===================================================================
--- trunk/fb-contrib/samples/samples.fbp 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/samples.fbp 2013-10-19 23:44:05 UTC (rev 1751)
@@ -1,12 +1,13 @@
<Project projectName="sample">
- <Jar>./.</Jar>
- <AuxClasspathEntry>././lib/jsp-api-2.2.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././lib/junit-4.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././lib/log4j-1.2.16.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././lib/servlet-api-3.0.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/commons-lang3-3.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
- <SrcDir>./.</SrcDir>
+ <Jar>././.</Jar>
+ <AuxClasspathEntry>./././lib/jsp-api-2.2.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./././lib/junit-4.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./././lib/log4j-1.2.16.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./././lib/servlet-api-3.0.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././lib/commons-lang3-3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./lib/slf4j-api-1.7.5.jar</AuxClasspathEntry>
+ <SrcDir>././.</SrcDir>
<SuppressionFilter>
<LastVersion value="-1" relOp="NEQ"/>
</SuppressionFilter>
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -21,6 +21,12 @@
import java.util.HashMap;
import java.util.Map;
+/**
+ * holds statistics about classes collected in the first pass.
+ * To cut down on the size of the database, class, method, signature is not stored as a key
+ * only a hash of that data is stored. This will allow some false positives, but hopefully not
+ * enough to cause issues.
+ */
public class Statistics {
private static Statistics statistics = new Statistics();
Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java (rev 0)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -0,0 +1,75 @@
+/*
+ * 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
+ */
+package com.mebigfatguy.fbcontrib.debug;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.apache.bcel.Constants;
+import org.apache.bcel.classfile.Code;
+import org.apache.bcel.classfile.Method;
+
+import edu.umd.cs.findbugs.BugReporter;
+import edu.umd.cs.findbugs.BytecodeScanningDetector;
+import edu.umd.cs.findbugs.OpcodeStack;
+import edu.umd.cs.findbugs.ba.ClassContext;
+
+public class OCSDebugger extends BytecodeScanningDetector {
+
+ private static final String OCS_OUTPUT_FILE = "fb-contrib.ocs.output";
+ private static final String OCS_METHOD_DESC = "fb-contrib.ocs.method";
+
+ private static final String OUTPUT_FILE_NAME = System.getProperty(OCS_OUTPUT_FILE);
+ private static final String METHOD_DESC = System.getProperty(OCS_METHOD_DESC);
+
+ private OpcodeStack stack = new OpcodeStack();
+ private PrintWriter pw = null;
+
+ public OCSDebugger(BugReporter bugReporter) {
+ }
+
+ public void visitClassContext(ClassContext classContext) {
+ if ((OUTPUT_FILE_NAME != null) && (METHOD_DESC != null))
+ super.visitClassContext(classContext);
+ }
+
+ public void visitCode(Code obj) {
+ Method m = getMethod();
+
+ String curMethodDesc = getClassContext().getJavaClass().getClassName() + "." + m.getName() + m.getSignature();
+ if (curMethodDesc.equals(METHOD_DESC)) {
+ try {
+ pw = new PrintWriter(new FileWriter(OUTPUT_FILE_NAME));
+ stack.resetForMethodEntry(this);
+
+ super.visitCode(obj);
+ } catch (IOException e) {
+ } finally {
+ pw.close();
+ pw = null;
+ }
+ }
+ }
+
+ public void sawOpcode(int seen) {
+ stack.sawOpcode(this, seen);
+ pw.println(String.format("After executing: %-16s at PC: %-5d Stack Size: %-3d", Constants.OPCODE_NAMES[getOpcode()], getPC(), stack.getStackDepth()));
+ }
+}
Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java
___________________________________________________________________
Added: svn:eol
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:mimetype
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -18,8 +18,7 @@
*/
package com.mebigfatguy.fbcontrib.detect;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.BitSet;
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.Code;
@@ -28,6 +27,8 @@
import org.apache.bcel.classfile.Method;
import org.apache.bcel.generic.Type;
+import com.mebigfatguy.fbcontrib.utils.RegisterUtils;
+
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.BytecodeScanningDetector;
@@ -38,7 +39,8 @@
private BugReporter bugReporter;
private OpcodeStack stack;
- private Set<Integer> initializedRegs;
+ private BitSet initializedRegs;
+ private BitSet iincRegs;
/**
* constructs an AIOB detector given the reporter to report bugs on
@@ -52,7 +54,8 @@
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
- initializedRegs = new HashSet<Integer>();
+ initializedRegs = new BitSet();
+ iincRegs = new BitSet();
super.visitClassContext(classContext);
} finally {
stack = null;
@@ -64,20 +67,23 @@
Method m = getMethod();
stack.resetForMethodEntry(this);
initializedRegs.clear();
+ iincRegs.clear();
Type[] argTypes = m.getArgumentTypes();
int arg = ((m.getAccessFlags() & Constants.ACC_STATIC) != 0) ? 0 : 1;
for (Type argType : argTypes) {
String argSig = argType.getSignature();
- initializedRegs.add(Integer.valueOf(arg));
+ initializedRegs.set(arg);
arg += ("J".equals(argSig) || "D".equals(argSig)) ? 2 : 1;
}
super.visitCode(obj);
initializedRegs.clear();
+ iincRegs.clear();
}
public void sawOpcode(int seen) {
Integer size = null;
+ boolean sizeSet = false;
try {
switch (seen) {
case ICONST_0:
@@ -87,17 +93,39 @@
case ICONST_4:
case ICONST_5:
size = Integer.valueOf(seen - ICONST_0);
+ sizeSet = true;
break;
+ case ILOAD:
+ case ILOAD_0:
+ case ILOAD_1:
+ case ILOAD_2:
+ case ILOAD_3: {
+ int reg = RegisterUtils.getLoadReg(this, seen);
+ if (iincRegs.get(reg)) {
+ size = null;
+ iincRegs.clear(reg);
+ sizeSet = true;
+ }
+ }
+ break;
+
+
case BIPUSH:
case SIPUSH:
size = getIntConstant();
+ sizeSet = true;
break;
+
+ case IINC:
+ iincRegs.set(getRegisterOperand());
+ break;
case LDC:
Constant c = getConstantRefOperand();
if (c instanceof ConstantInteger) {
size = Integer.valueOf(((ConstantInteger) c).getBytes());
+ sizeSet = true;
}
break;
@@ -106,6 +134,7 @@
if (stack.getStackDepth() >= 1) {
OpcodeStack.Item item = stack.getStackItem(0);
size = (Integer) item.getUserValue();
+ sizeSet = true;
}
break;
@@ -133,7 +162,7 @@
}
int reg = arrayItem.getRegisterNumber();
- if ((reg >= 0) && !initializedRegs.contains(Integer.valueOf(reg))) {
+ if ((reg >= 0) && !initializedRegs.get(reg)) {
bugReporter.reportBug(new BugInstance(this, "AIOB_ARRAY_STORE_TO_NULL_REFERENCE", HIGH_PRIORITY)
.addClass(this)
.addMethod(this)
@@ -177,16 +206,16 @@
if (stack.getStackDepth() > 0) {
OpcodeStack.Item value = stack.getStackItem(0);
if (!value.isNull())
- initializedRegs.add(Integer.valueOf(getRegisterOperand()));
+ initializedRegs.set(getRegisterOperand());
} else {
- initializedRegs.add(Integer.valueOf(getRegisterOperand()));
+ initializedRegs.set(getRegisterOperand());
}
break;
}
} finally {
stack.sawOpcode(this, seen);
- if (size != null) {
+ if (sizeSet) {
if (stack.getStackDepth() >= 1) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(size);
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -75,7 +75,7 @@
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
- wrappers = new HashMap<Integer, WrapperInfo>();
+ wrappers = new HashMap<Integer, WrapperInfo>(10);
super.visitClassContext(classContext);
} finally {
stack = null;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -19,6 +19,7 @@
package com.mebigfatguy.fbcontrib.detect;
import java.util.ArrayList;
+import java.util.BitSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -47,24 +48,31 @@
* performance impact of that assignment.
*/
public class BloatedAssignmentScope extends BytecodeScanningDetector {
- private static final Set<String> dangerousAssignmentClassSources = new HashSet<String>();
- private static final Set<String> dangerousAssignmentMethodSources = new HashSet<String>();
+ private static final Set<String> dangerousAssignmentClassSources = new HashSet<String>(7);
+ private static final Set<String> dangerousAssignmentMethodSources = new HashSet<String>(4);
static {
- dangerousAssignmentClassSources.add("java/io/InputStream");
- dangerousAssignmentClassSources.add("java/io/ObjectInput");
+ dangerousAssignmentClassSources.add("java/io/BufferedInputStream");
+ dangerousAssignmentClassSources.add("java/io/DataInputStream");
+ dangerousAssignmentClassSources.add("java/io/InputStream");
+ dangerousAssignmentClassSources.add("java/io/ObjectInputStream");
+ dangerousAssignmentClassSources.add("java/io/BufferedReader");
+ dangerousAssignmentClassSources.add("java/io/FileReader");
+ dangerousAssignmentClassSources.add("java/io/Reader");
dangerousAssignmentMethodSources.add("java/lang/System.currentTimeMillis()J");
dangerousAssignmentMetho...
[truncated message content] |