fb-contrib-commit Mailing List for fb-contrib (Page 2)
Brought to you by:
dbrosius
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(56) |
Oct
(60) |
Nov
(58) |
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(66) |
Feb
(55) |
Mar
(85) |
Apr
(115) |
May
(35) |
Jun
(28) |
Jul
(3) |
Aug
(48) |
Sep
(37) |
Oct
(22) |
Nov
(14) |
Dec
(66) |
2007 |
Jan
(45) |
Feb
(63) |
Mar
(10) |
Apr
(1) |
May
(1) |
Jun
(12) |
Jul
|
Aug
|
Sep
(25) |
Oct
(21) |
Nov
(39) |
Dec
|
2008 |
Jan
(7) |
Feb
|
Mar
(26) |
Apr
(5) |
May
(2) |
Jun
(32) |
Jul
(9) |
Aug
(10) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
|
2009 |
Jan
(10) |
Feb
(31) |
Mar
(32) |
Apr
(35) |
May
(25) |
Jun
|
Jul
(31) |
Aug
(10) |
Sep
(95) |
Oct
(35) |
Nov
(10) |
Dec
(34) |
2010 |
Jan
(90) |
Feb
(4) |
Mar
(7) |
Apr
(20) |
May
(20) |
Jun
(13) |
Jul
(7) |
Aug
(18) |
Sep
(25) |
Oct
(4) |
Nov
(16) |
Dec
(2) |
2011 |
Jan
(1) |
Feb
|
Mar
(11) |
Apr
(3) |
May
(2) |
Jun
(26) |
Jul
(10) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(14) |
Nov
(3) |
Dec
(4) |
2013 |
Jan
(3) |
Feb
(2) |
Mar
(1) |
Apr
(4) |
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(3) |
2014 |
Jan
(4) |
Feb
(2) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
(3) |
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
(2) |
Nov
(7) |
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(5) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(3) |
2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(5) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dbr...@us...> - 2017-04-14 23:56:40
|
Revision: 1817 http://sourceforge.net/p/fb-contrib/code/1817 Author: dbrosius Date: 2017-04-14 23:56:37 +0000 (Fri, 14 Apr 2017) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt 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/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java Added Paths: ----------- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java trunk/fb-contrib/src/samples/java/ex/UAC_Sample.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/build.xml 2017-04-14 23:56:37 UTC (rev 1817) @@ -31,7 +31,7 @@ <property name="javac.debug" value="on" /> <property name="test_reports.dir" value="${target.dir}/reports/test"/> - <property name="fb-contrib.version" value="6.9.0-SNAPSHOT" /> + <property name="fb-contrib.version" value="7.0.0" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/etc/bugrank.txt 2017-04-14 23:56:37 UTC (rev 1817) @@ -69,8 +69,10 @@ +0 BugPattern IMC_IMMATURE_CLASS_NO_PACKAGE +2 BugPattern IMC_IMMATURE_CLASS_NO_TOSTRING +0 BugPattern IMC_IMMATURE_CLASS_PRINTSTACKTRACE ++0 BugPattern IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER +0 BugPattern IOI_COPY_WITH_READER +0 BugPattern IOI_DOUBLE_BUFFER_COPY ++0 BugPattern IOI_USE_OF_FILE_STREAM_CONSTRUCTORS +0 BugPattern IPU_IMPROPER_PROPERTIES_USE +0 BugPattern IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY +0 BugPattern ISB_EMPTY_STRING_APPENDING @@ -232,6 +234,8 @@ +0 BugPattern TBP_TRISTATE_BOOLEAN_PATTERN +0 BugPattern TR_TAIL_RECURSION +0 BugPattern UAA_USE_ADD_ALL ++0 BugPattern UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT ++0 BugPattern UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH +0 BugPattern UCC_UNRELATED_COLLECTION_CONTENTS +0 BugPattern UCPM_USE_CHARACTER_PARAMETERIZED_METHOD +0 BugPattern UEC_USE_ENUM_COLLECTIONS Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/etc/findbugs.xml 2017-04-14 23:56:37 UTC (rev 1817) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -77,7 +77,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing" speed="fast" reports="NAB_NEEDLESS_AUTOBOXING_CTOR,NAB_NEEDLESS_BOXING_STRING_CTOR,NAB_NEEDLESS_AUTOBOXING_VALUEOF,NAB_NEEDLESS_BOXING_PARSE,NAB_NEEDLESS_BOXING_VALUEOF,NAB_NEEDLESS_BOX_TO_UNBOX,NAB_NEEDLESS_BOX_TO_CAST,NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" speed="fast" reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" speed="fast" reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" speed="fast" reports="COM_COPIED_OVERRIDDEN_METHOD,COM_PARENT_DELEGATED_CALL" /> @@ -285,7 +285,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.StringifiedTypes" speed="fast" reports="STT_STRING_PARSING_A_FIELD,STT_TOSTRING_STORED_IN_FIELD" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE,IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.JAXRSIssues" speed="fast" reports="JXI_GET_ENDPOINT_CONSUMES_CONTENT,JXI_INVALID_CONTEXT_PARAMETER_TYPE,JXI_PARM_PARAM_NOT_FOUND_IN_PATH,JXI_UNDEFINED_PARAMETER_SOURCE_IN_ENDPOINT" /> @@ -295,7 +295,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuboptimalExpressionOrder" speed="fast" reports="SEO_SUBOPTIMAL_EXPRESSION_ORDER"/> - <Detector class="com.mebigfatguy.fbcontrib.detect.IOIssues" speed="fast" reports="IOI_DOUBLE_BUFFER_COPY,IOI_COPY_WITH_READER"/> + <Detector class="com.mebigfatguy.fbcontrib.detect.IOIssues" speed="fast" reports="IOI_DOUBLE_BUFFER_COPY,IOI_COPY_WITH_READER,IOI_USE_OF_FILE_STREAM_CONSTRUCTORS"/> <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousMapCollection" speed="fast" reports="DMC_DUBIOUS_MAP_COLLECTION"/> @@ -305,10 +305,6 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/> - <!-- COMMENT OUT FOR POINT RELEASE --> - - <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/> - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousShadedClassUse" speed="fast" reports="SSCU_SUSPICIOUS_SHADED_CLASS_USE"/> <Detector class="com.mebigfatguy.fbcontrib.detect.UnsynchronizedSingletonFieldWrites" speed="fast" reports="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES"/> @@ -315,8 +311,14 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED"/> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT"/> + <!-- COMMENT OUT FOR POINT RELEASE --> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/> + + <!-- COMMENT OUT FOR POINT RELEASE --> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -567,6 +569,7 @@ <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_PACKAGE" category="STYLE" /> <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_TOSTRING" category="STYLE" /> <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_PRINTSTACKTRACE" category="STYLE" /> + <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER" category="STYLE" /> <BugPattern abbrev="JXI" type="JXI_GET_ENDPOINT_CONSUMES_CONTENT" category="CORRECTNESS" /> <BugPattern abbrev="JXI" type="JXI_INVALID_CONTEXT_PARAMETER_TYPE" category="CORRECTNESS" /> <BugPattern abbrev="JXI" type="JXI_PARM_PARAM_NOT_FOUND_IN_PATH" category="CORRECTNESS" /> @@ -581,6 +584,7 @@ <BugPattern abbrev="SEO" type="SEO_SUBOPTIMAL_EXPRESSION_ORDER" category="PERFORMANCE"/> <BugPattern abbrev="IOI" type="IOI_DOUBLE_BUFFER_COPY" category="PERFORMANCE"/> <BugPattern abbrev="IOI" type="IOI_COPY_WITH_READER" category="PERFORMANCE"/> + <BugPattern abbrev="IOI" type="IOI_USE_OF_FILE_STREAM_CONSTRUCTORS"/> <BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS"/> <BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE"/> <BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS"/> @@ -592,4 +596,6 @@ <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION" category="CORRECTNESS" experimental="true"/> <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_CHECKING_REFERENCE" category="CORRECTNESS" experimental="true"/> <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED" category="CORRECTNESS" experimental="true"/> + <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS" experimental="true"/> + <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS" experimental="true"/> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/etc/messages.xml 2017-04-14 23:56:37 UTC (rev 1817) @@ -1685,7 +1685,18 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion"> + <Details> + <![CDATA[ + <p>Looks for code that appears to be using two forms of similar apis, an older one, and a new one. + It finds code that creates newer api objects by first instantiating older api objects, and converting + them into the new form. It is simpler just to create the new object directly.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> + <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger"> <Details></Details> </Detector> @@ -5415,6 +5426,20 @@ </Details> </BugPattern> + <BugPattern type="IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER"> + <ShortDescription>Class orders instance fields before static fields</ShortDescription> + <LongDescription>Class {0} orders instance fields before static fields</LongDescription> + <Details> + <![CDATA[ + <p>This class adds fields to the class in an order that is confusing, and not expected by + other developers. The standard is for static fields to be listed first, followed by instance + fields. when fields are listed out of order, developers may make assumptions about their + behaviour that is incorrect and lead to bugs.</p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="JXI_GET_ENDPOINT_CONSUMES_CONTENT"> <ShortDescription>JAX-RS Method implements a GET request but consumes input</ShortDescription> <LongDescription>JAX-RS Method {1} implements a GET request but consumes input</LongDescription> @@ -5617,6 +5642,26 @@ </Details> </BugPattern> + <BugPattern type="IOI_USE_OF_FILE_STREAM_CONSTRUCTORS"> + <ShortDescription>Method uses a FileInputStream or FileOutputStream constructor</ShortDescription> + <LongDescription>Method {1} uses a FileInputStream or FileOutputStream constructor</LongDescription> + <Details> + <![CDATA[ + <p>This method creates and uses a java.io.FileInputStream or java.io.FileOutputStream object. Unfortunately both + of these classes implement a finalize method, which means that objects created will likely hang around until a + full garbage collection occurs, which will leave excessive garbage on the heap for longer, and potentially much + longer than expected. Java 7 introduced two ways to create streams for reading and writing files that do not have this concern. + You should consider switching from these above classes to + <code> + InputStream is = java.nio.file.Files.newInputStream(myfile.toPath()); + OutputStream os = java.nio.file.Files.newOutputStream(myfile.toPath()); + </code> + </p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="DMC_DUBIOUS_MAP_COLLECTION"> <ShortDescription>Class holds a map-type field, but uses it as only a List</ShortDescription> <LongDescription>Class {0} holds a map-type field {1}, but uses it as only a List</LongDescription> @@ -5772,6 +5817,32 @@ ]]> </Details> </BugPattern> + + <BugPattern type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT"> + <ShortDescription>Method constructs a Date object, merely to convert it to an Instant object</ShortDescription> + <LongDescription>Method {1} constructs a Date object, merely to convert it to an Instant object</LongDescription> + <Details> + <![CDATA[ + <p>This method creates a java.time.Instant object by first creating a java.util.Date object, and then calling + toInstant() on it. It is simpler to just construct the Instant object directly, say by using + {@code Instant.now()} to get the current time, of by using {@code Instant.parse(CharSequence)} to convert a String. + </p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"> + <ShortDescription>Method constructs a File object, merely to convert it to a Path object</ShortDescription> + <LongDescription>Method {1} constructs a File object, merely to convert it to a Path object</LongDescription> + <Details> + <![CDATA[ + <p>This method creates a java.nio.file.Path object by first creating a java.io.File object, and then calling + toPath() on it. It is simpler to just construct the Path object directly, say by using + {@code Path.get(String...)}. + </p> + ]]> + </Details> + </BugPattern> <!-- BugCode --> @@ -5914,4 +5985,5 @@ <BugCode abbrev="SSCU">Suspicious Shaded Class Use</BugCode> <BugCode abbrev="USFW">Unsynchronized Singleton Field Writes</BugCode> <BugCode abbrev="OI">Optional Issues</BugCode> + <BugCode abbrev="UAC">Unnecessary Api Conversion</BugCode> </MessageCollection> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/htdocs/index.shtml 2017-04-14 23:56:37 UTC (rev 1817) @@ -68,7 +68,7 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.4 available for download + <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.0 available for download <a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p> <p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p> <p style="font-weight: bold;">Please note that active development for this project is now done on @@ -77,13 +77,20 @@ </div> <hr/> - <img id="git_image" src="flip2.gif" onClick="toggleBlock('git', 'git_image');" align="top"/> + <img id="git_image" src="flip1.gif" onClick="toggleBlock('git', 'git_image');" align="top"/> Detectors added in git<br/> - <div id="git" style="display:block;"> - <ul> + <div id="git" style="display:none;"> + <ul> <li><b>[UTWR] Use Try With Resources</b><br/> Looks for try/finally blocks that manage resources, without using try-with-resources. </li> + </ul> + </div> + <hr/> + <img id="v7_0_0_image" src="flip2.gif" onClick="toggleBlock('v7_0_0', 'v7_0_0_image');" align="top"/> + Detectors added in v7.0.0<br/> + <div id="v7_0_0" style="display:block;"> + <ul> <li><b>[SSCU] Suspicious Shaded Class Use</b><br/> Looks for use of classes that have been shaded into 3rdparty jars, rather than using the real class, from the real jar. @@ -94,6 +101,11 @@ <li><b>[OI] Optional Issues</b><br/> Looks for various issues around use of java.util.Optional </li> + <li><b>[UAC] Unnecessary Api Conversion</b><br/> + Looks for code that appears to be using two forms of similar apis, an older one, and a new one. + It finds code that creates newer api objects by first instantiating older api objects, and converting + them into the new form. It is simpler just to create the new object directly. + </li> </ul> </div> <hr/> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/htdocs/repository.html 2017-04-14 23:56:37 UTC (rev 1817) @@ -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.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>6.8.4</td></tr> + <tr><td><b>Version:</b></td><td>7.0.0</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/pom.xml 2017-04-14 23:56:37 UTC (rev 1817) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.9.0-SNAPSHOT</version> + <version>7.0.0</version> <prerequisites> <maven>2.2.1</maven> Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java =================================================================== --- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -20,6 +20,7 @@ import java.util.Set; +import org.apache.bcel.Constants; import org.apache.bcel.Repository; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; @@ -73,6 +74,7 @@ private BugReporter bugReporter; private OpcodeStack stack; + private int clsVersion; /** * constructs a IOI detector given the reporter to report bugs on @@ -102,6 +104,7 @@ try { stack = new OpcodeStack(); + clsVersion = clsContext.getJavaClass().getMajor(); super.visitClassContext(clsContext); } finally { stack = null; @@ -124,7 +127,8 @@ /** * implements the visitor to look for common api copy utilities to copy streams where the passed in Stream is Buffered. Since these libraries already handle * the buffering, you are just slowing them down by the extra copy. Also look for copies where the source is a Reader, as this is just wasteful. Can't wrap - * my head around whether a Writer output is sometime valid, might be, so for now ignoring that. + * my head around whether a Writer output is sometime valid, might be, so for now ignoring that. Also reports uses of java.io.FileInputStream and + * java.io.FileOutputStream on {@code java >= 1.7} as those classes have finalize methods that junk up gc. * * @param seen * the currently parsed opcode @@ -164,6 +168,11 @@ String clsName = getDottedClassConstantOperand(); if (BUFFERED_CLASSES.contains(clsName)) { return IOIUserValue.BUFFER; + } else if ("java.io.FileInputStream".equals(clsName) || "java.io.FileOutputStream".equals(clsName)) { + if (clsVersion >= Constants.MAJOR_1_7) { + bugReporter.reportBug(new BugInstance(this, BugType.IOI_USE_OF_FILE_STREAM_CONSTRUCTORS.name(), NORMAL_PRIORITY).addClass(this) + .addMethod(this).addSourceLine(this)); + } } else if (readerClass != null) { JavaClass cls = Repository.lookupClass(clsName); if (cls.instanceOf(readerClass)) { Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java =================================================================== --- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -36,7 +36,12 @@ NOT_NEEDED, UNKNOWN, NEEDED }; + enum FieldStatus { + NONE, SAW_INSTANCE, REPORTED + } + private BugReporter bugReporter; + private FieldStatus fieldStatus = FieldStatus.NONE; public ImmatureClass(BugReporter reporter) { bugReporter = reporter; @@ -51,6 +56,7 @@ @Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); + fieldStatus = FieldStatus.NONE; if (cls.getPackageName().isEmpty()) { bugReporter.reportBug(new BugInstance(this, BugType.IMC_IMMATURE_CLASS_NO_PACKAGE.name(), LOW_PRIORITY).addClass(cls)); @@ -112,6 +118,30 @@ super.visitClassContext(classContext); } + @Override + public void visitField(Field f) { + if (!f.isSynthetic() && !f.getName().contains("$")) { + switch (fieldStatus) { + case NONE: + if (!f.isStatic()) { + fieldStatus = FieldStatus.SAW_INSTANCE; + } + break; + + case SAW_INSTANCE: + if (f.isStatic()) { + bugReporter.reportBug( + new BugInstance(this, BugType.IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER.name(), LOW_PRIORITY).addClass(this).addField(this)); + fieldStatus = FieldStatus.REPORTED; + } + break; + + case REPORTED: + break; + } + } + } + /** * implements the visitor to check for calls to Throwable.printStackTrace() * Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java =================================================================== --- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -20,8 +20,6 @@ import java.util.BitSet; import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; import java.util.Set; import org.apache.bcel.Constants; @@ -131,22 +129,6 @@ } /** - * removes all methods from the map that are synthetic - * - * @param methods - * the methods to check - */ - private void removeSyntheticMethods(Map<QMethod, Boolean> methods) { - Iterator<Map.Entry<QMethod, Boolean>> it = methods.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry<QMethod, Boolean> entry = it.next(); - if (entry.getValue().booleanValue()) { - it.remove(); - } - } - } - - /** * builds a set of all non constructor or static initializer method/signatures * * @param cls Added: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java =================================================================== --- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java (rev 0) +++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -0,0 +1,108 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2017 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.detect; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.bcel.classfile.Code; + +import com.mebigfatguy.fbcontrib.utils.BugType; +import com.mebigfatguy.fbcontrib.utils.FQMethod; + +import edu.umd.cs.findbugs.BugInstance; +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; +import edu.umd.cs.findbugs.ba.XMethod; + +/** + * looks for code that appears to be using two forms of similar apis, an older one, and a new one. It finds code that creates newer api objects by first + * instantiating older api objects, and converting them into the new form. It is simpler just to create the new object directly. + */ +public class UnnecessaryApiConversion extends BytecodeScanningDetector { + + private static Map<FQMethod, LegacyInfo> conversions = new HashMap<>(); + + static { + conversions.put(new FQMethod("java/util/Date", "toInstant", "()Ljava/time/Instant;"), + new LegacyInfo("<init>", BugType.UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT)); + conversions.put(new FQMethod("java/io/File", "toPath", "()Ljava/nio/file/Path;"), + new LegacyInfo("<init>", BugType.UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH)); + + } + + private BugReporter bugReporter; + private OpcodeStack stack; + + public UnnecessaryApiConversion(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + @Override + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } finally { + stack = null; + } + } + + @Override + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + super.visitCode(obj); + } + + @Override + public void sawOpcode(int seen) { + + try { + switch (seen) { + case INVOKEVIRTUAL: + FQMethod conversionMethod = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()); + LegacyInfo legacyInfo = conversions.get(conversionMethod); + if ((legacyInfo != null) && (stack.getStackDepth() > 0)) { + OpcodeStack.Item itm = stack.getStackItem(0); + XMethod xm = itm.getReturnValueOf(); + if ((xm != null) && (xm.getName().equals(legacyInfo.methodName) + && (xm.getClassName().equals(conversionMethod.getClassName().replace('/', '.'))))) { + bugReporter.reportBug( + new BugInstance(this, legacyInfo.bugType.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); + } + } + break; + } + } finally { + stack.sawOpcode(this, seen); + } + } + + static class LegacyInfo { + String methodName; + BugType bugType; + + public LegacyInfo(String methodName, BugType bugType) { + this.methodName = methodName; + this.bugType = bugType; + } + } +} Property changes on: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java ___________________________________________________________________ Added: svn:eol-style ## -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 Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java =================================================================== --- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -100,8 +100,10 @@ IMC_IMMATURE_CLASS_NO_PACKAGE, IMC_IMMATURE_CLASS_NO_TOSTRING, IMC_IMMATURE_CLASS_PRINTSTACKTRACE, + IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER, IOI_COPY_WITH_READER, IOI_DOUBLE_BUFFER_COPY, + IOI_USE_OF_FILE_STREAM_CONSTRUCTORS, IPU_IMPROPER_PROPERTIES_USE, IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY, ISB_EMPTY_STRING_APPENDING, @@ -272,6 +274,8 @@ TR_TAIL_RECURSION, UAA_USE_ADD_ALL, + UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT, + UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH, UCC_UNRELATED_COLLECTION_CONTENTS, UCPM_USE_CHARACTER_PARAMETERIZED_METHOD, UEC_USE_ENUM_COLLECTIONS, Modified: trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java =================================================================== --- trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -1,4 +1,5 @@ package ex; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -17,6 +18,8 @@ private String reportMe; + private static final int OUT_OF_PLACE_STATIC = 0; + @SuperSecret class FPClassIMC { private String dontReportMe; @@ -26,7 +29,7 @@ @SuperSecret private String dontReportMe; } - + public void psf(File f) { try (InputStream is = new FileInputStream(f)) { is.read(); Modified: trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java =================================================================== --- trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java 2017-04-09 22:42:29 UTC (rev 1816) +++ trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -1,11 +1,14 @@ package ex; + import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import org.apache.commons.io.IOUtils; @@ -28,4 +31,17 @@ return baos.toByteArray(); } } + + public void copy(String inName, String outName) throws IOException { + byte[] buf = new byte[1024]; + + try (InputStream is = new FileInputStream(inName); OutputStream os = new FileOutputStream(outName);) { + + int size = is.read(buf); + while (size >= 0) { + os.write(buf, 0, size); + size = is.read(buf); + } + } + } } Added: trunk/fb-contrib/src/samples/java/ex/UAC_Sample.java =================================================================== --- trunk/fb-contrib/src/samples/java/ex/UAC_Sample.java (rev 0) +++ trunk/fb-contrib/src/samples/java/ex/UAC_Sample.java 2017-04-14 23:56:37 UTC (rev 1817) @@ -0,0 +1,18 @@ +package ex; + +import java.io.File; +import java.nio.file.Path; +import java.time.Instant; +import java.util.Date; + +public class UAC_Sample { + + public Instant getInstant() { + return new Date().toInstant(); + } + + public Path getPath() { + + return new File("hello.world").toPath(); + } +} Property changes on: trunk/fb-contrib/src/samples/java/ex/UAC_Sample.java ___________________________________________________________________ Added: svn:eol-style ## -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2017-04-09 22:42:36
|
Revision: 1816 http://sourceforge.net/p/fb-contrib/code/1816 Author: dbrosius Date: 2017-04-09 22:42:29 +0000 (Sun, 09 Apr 2017) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/pom.xml trunk/fb-contrib/samples.xml trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WiringIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/QMethod.java Added Paths: ----------- trunk/fb-contrib/src/samples/java/ex/ trunk/fb-contrib/src/samples/java/ex/ABC_Sample.java trunk/fb-contrib/src/samples/java/ex/ACEM_Sample.java trunk/fb-contrib/src/samples/java/ex/AFBR_Sample.java trunk/fb-contrib/src/samples/java/ex/AIOB_Sample.java trunk/fb-contrib/src/samples/java/ex/AOM_Sample.java trunk/fb-contrib/src/samples/java/ex/AWCBR_Sample.java trunk/fb-contrib/src/samples/java/ex/BAS_Sample.java trunk/fb-contrib/src/samples/java/ex/BED_Sample.java trunk/fb-contrib/src/samples/java/ex/BL_Sample.java trunk/fb-contrib/src/samples/java/ex/BRPI_Sample.java trunk/fb-contrib/src/samples/java/ex/BSB_Sample.java trunk/fb-contrib/src/samples/java/ex/CAAL_Sample.java trunk/fb-contrib/src/samples/java/ex/CAO_Sample.java trunk/fb-contrib/src/samples/java/ex/CBC_Sample.java trunk/fb-contrib/src/samples/java/ex/CBX_Sample.java trunk/fb-contrib/src/samples/java/ex/CCI_Sample.java trunk/fb-contrib/src/samples/java/ex/CCNE_Sample.java trunk/fb-contrib/src/samples/java/ex/CEBE_EqualsToEqualsSample.java trunk/fb-contrib/src/samples/java/ex/CE_Sample.java trunk/fb-contrib/src/samples/java/ex/CFS_Sample.java trunk/fb-contrib/src/samples/java/ex/CHBH_HashcodeToHashcodeSample.java trunk/fb-contrib/src/samples/java/ex/CLI_Sample.java trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java trunk/fb-contrib/src/samples/java/ex/COM_Sample.java trunk/fb-contrib/src/samples/java/ex/CRF_Sample.java trunk/fb-contrib/src/samples/java/ex/CSBTS_StringToStringSample.java trunk/fb-contrib/src/samples/java/ex/CSI_Sample.java trunk/fb-contrib/src/samples/java/ex/CTU_Sample.java trunk/fb-contrib/src/samples/java/ex/CU_Sample.java trunk/fb-contrib/src/samples/java/ex/CVAA_Sample.java trunk/fb-contrib/src/samples/java/ex/DDC_Sample.java trunk/fb-contrib/src/samples/java/ex/DLC_Sample.java trunk/fb-contrib/src/samples/java/ex/DMC_Sample.java trunk/fb-contrib/src/samples/java/ex/DRE_Sample.java trunk/fb-contrib/src/samples/java/ex/DSOC_Sample.java trunk/fb-contrib/src/samples/java/ex/DTEP_Sample.java trunk/fb-contrib/src/samples/java/ex/DWI_Sample.java trunk/fb-contrib/src/samples/java/ex/EXS_Sample.java trunk/fb-contrib/src/samples/java/ex/FCBL_Sample.java trunk/fb-contrib/src/samples/java/ex/FCCD_Sample.java trunk/fb-contrib/src/samples/java/ex/FPL_Sample.java trunk/fb-contrib/src/samples/java/ex/FP_Sample.java trunk/fb-contrib/src/samples/java/ex/HCP_Sample.java trunk/fb-contrib/src/samples/java/ex/HES_Sample.java trunk/fb-contrib/src/samples/java/ex/ICA_Sample.java trunk/fb-contrib/src/samples/java/ex/IICU_Sample.java trunk/fb-contrib/src/samples/java/ex/IKNC_Sample.java trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java trunk/fb-contrib/src/samples/java/ex/IPU_Sample.java trunk/fb-contrib/src/samples/java/ex/ISB_Sample.java trunk/fb-contrib/src/samples/java/ex/ITC_Sample.java trunk/fb-contrib/src/samples/java/ex/ITU_Sample.java trunk/fb-contrib/src/samples/java/ex/JPAI_Sample.java trunk/fb-contrib/src/samples/java/ex/JVR_Sample.java trunk/fb-contrib/src/samples/java/ex/JXI_Sample.java trunk/fb-contrib/src/samples/java/ex/LEST_Sample.java trunk/fb-contrib/src/samples/java/ex/LGO_Sample.java trunk/fb-contrib/src/samples/java/ex/LII_Sample.java trunk/fb-contrib/src/samples/java/ex/LO_Sample.java trunk/fb-contrib/src/samples/java/ex/LSC_Sample.java trunk/fb-contrib/src/samples/java/ex/LSYC_Sample.java trunk/fb-contrib/src/samples/java/ex/MAC_Sample.java trunk/fb-contrib/src/samples/java/ex/MDM_Sample.java trunk/fb-contrib/src/samples/java/ex/MOM_Sample.java trunk/fb-contrib/src/samples/java/ex/MRC_Sample.java trunk/fb-contrib/src/samples/java/ex/MTA_Sample.java trunk/fb-contrib/src/samples/java/ex/MUC_Sample.java trunk/fb-contrib/src/samples/java/ex/NAB_Sample.java trunk/fb-contrib/src/samples/java/ex/NCMU_Sample.java trunk/fb-contrib/src/samples/java/ex/NCS_Sample.java trunk/fb-contrib/src/samples/java/ex/NFF_Sample.java trunk/fb-contrib/src/samples/java/ex/NIR_Sample.java trunk/fb-contrib/src/samples/java/ex/NMCS_Sample.java trunk/fb-contrib/src/samples/java/ex/NOS_Sample.java trunk/fb-contrib/src/samples/java/ex/NPMC_Sample.java trunk/fb-contrib/src/samples/java/ex/NRTL_Sample.java trunk/fb-contrib/src/samples/java/ex/NSE_Sample.java trunk/fb-contrib/src/samples/java/ex/OCP_Sample.java trunk/fb-contrib/src/samples/java/ex/OC_Sample.java trunk/fb-contrib/src/samples/java/ex/ODN_Sample.java trunk/fb-contrib/src/samples/java/ex/OI_Sample.java trunk/fb-contrib/src/samples/java/ex/OPM_Sample.java trunk/fb-contrib/src/samples/java/ex/PCAIL_Sample.java trunk/fb-contrib/src/samples/java/ex/PCOA_Sample.java trunk/fb-contrib/src/samples/java/ex/PDP_Sample.java trunk/fb-contrib/src/samples/java/ex/PIS_Sample.java trunk/fb-contrib/src/samples/java/ex/PL_Sample.java trunk/fb-contrib/src/samples/java/ex/PMB_Sample.java trunk/fb-contrib/src/samples/java/ex/PME_Sample.java trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java trunk/fb-contrib/src/samples/java/ex/PSC_Sample.java trunk/fb-contrib/src/samples/java/ex/PUS_Sample.java trunk/fb-contrib/src/samples/java/ex/ROOM_Sample.java trunk/fb-contrib/src/samples/java/ex/S508C_Sample.java trunk/fb-contrib/src/samples/java/ex/SACM_Sample.java trunk/fb-contrib/src/samples/java/ex/SCA_Sample.java trunk/fb-contrib/src/samples/java/ex/SCII_Sample.java trunk/fb-contrib/src/samples/java/ex/SCI_Sample.java trunk/fb-contrib/src/samples/java/ex/SCRV_Sample.java trunk/fb-contrib/src/samples/java/ex/SCR_Sample.java trunk/fb-contrib/src/samples/java/ex/SCSS_Sample.java trunk/fb-contrib/src/samples/java/ex/SEC_Sample.java trunk/fb-contrib/src/samples/java/ex/SEO_Sample.java trunk/fb-contrib/src/samples/java/ex/SGSU_Sample.java trunk/fb-contrib/src/samples/java/ex/SG_Sample.java trunk/fb-contrib/src/samples/java/ex/SIL_Sample.java trunk/fb-contrib/src/samples/java/ex/SJVU_Sample.java trunk/fb-contrib/src/samples/java/ex/SLS_Sample.java trunk/fb-contrib/src/samples/java/ex/SMII_Sample.java trunk/fb-contrib/src/samples/java/ex/SNG_Sample.java trunk/fb-contrib/src/samples/java/ex/SPP_Sample.java trunk/fb-contrib/src/samples/java/ex/SSCU_Sample.java trunk/fb-contrib/src/samples/java/ex/STB_Sample.java trunk/fb-contrib/src/samples/java/ex/STS_Sample.java trunk/fb-contrib/src/samples/java/ex/STT_Sample.java trunk/fb-contrib/src/samples/java/ex/SUA_Sample.java trunk/fb-contrib/src/samples/java/ex/SWCO_Sample.java trunk/fb-contrib/src/samples/java/ex/TBP_Sample.java trunk/fb-contrib/src/samples/java/ex/TR_Sample.java trunk/fb-contrib/src/samples/java/ex/UAA_Sample.java trunk/fb-contrib/src/samples/java/ex/UCC_Sample.java trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java trunk/fb-contrib/src/samples/java/ex/UEC_Sample.java trunk/fb-contrib/src/samples/java/ex/UMTP_Sample.java trunk/fb-contrib/src/samples/java/ex/UNNC_Sample.java trunk/fb-contrib/src/samples/java/ex/UP_Sample.java trunk/fb-contrib/src/samples/java/ex/URV_Sample.java trunk/fb-contrib/src/samples/java/ex/USBR_Sample.java trunk/fb-contrib/src/samples/java/ex/USFW_Sample.java trunk/fb-contrib/src/samples/java/ex/USS_Sample.java trunk/fb-contrib/src/samples/java/ex/UTAO_Sample.java trunk/fb-contrib/src/samples/java/ex/UTA_Sample.java trunk/fb-contrib/src/samples/java/ex/UTWR_Sample.java trunk/fb-contrib/src/samples/java/ex/UVA_Sample.java trunk/fb-contrib/src/samples/java/ex/WEM_Sample.java trunk/fb-contrib/src/samples/java/ex/WI_Sample.java trunk/fb-contrib/src/samples/java/ex/WOC_Sample.java Removed Paths: ------------- trunk/fb-contrib/src/samples/java/ABC_Sample.java trunk/fb-contrib/src/samples/java/ACEM_Sample.java trunk/fb-contrib/src/samples/java/AFBR_Sample.java trunk/fb-contrib/src/samples/java/AIOB_Sample.java trunk/fb-contrib/src/samples/java/AOM_Sample.java trunk/fb-contrib/src/samples/java/AWCBR_Sample.java trunk/fb-contrib/src/samples/java/BAS_Sample.java trunk/fb-contrib/src/samples/java/BED_Sample.java trunk/fb-contrib/src/samples/java/BL_Sample.java trunk/fb-contrib/src/samples/java/BRPI_Sample.java trunk/fb-contrib/src/samples/java/BSB_Sample.java trunk/fb-contrib/src/samples/java/CAAL_Sample.java trunk/fb-contrib/src/samples/java/CAO_Sample.java trunk/fb-contrib/src/samples/java/CBC_Sample.java trunk/fb-contrib/src/samples/java/CBX_Sample.java trunk/fb-contrib/src/samples/java/CCI_Sample.java trunk/fb-contrib/src/samples/java/CCNE_Sample.java trunk/fb-contrib/src/samples/java/CEBE_EqualsToEqualsSample.java trunk/fb-contrib/src/samples/java/CE_Sample.java trunk/fb-contrib/src/samples/java/CFS_Sample.java trunk/fb-contrib/src/samples/java/CHBH_HashcodeToHashcodeSample.java trunk/fb-contrib/src/samples/java/CLI_Sample.java trunk/fb-contrib/src/samples/java/CNC_Sample.java trunk/fb-contrib/src/samples/java/COM_Sample.java trunk/fb-contrib/src/samples/java/CRF_Sample.java trunk/fb-contrib/src/samples/java/CSBTS_StringToStringSample.java trunk/fb-contrib/src/samples/java/CSI_Sample.java trunk/fb-contrib/src/samples/java/CTU_Sample.java trunk/fb-contrib/src/samples/java/CU_Sample.java trunk/fb-contrib/src/samples/java/CVAA_Sample.java trunk/fb-contrib/src/samples/java/DDC_Sample.java trunk/fb-contrib/src/samples/java/DLC_Sample.java trunk/fb-contrib/src/samples/java/DMC_Sample.java trunk/fb-contrib/src/samples/java/DRE_Sample.java trunk/fb-contrib/src/samples/java/DSOC_Sample.java trunk/fb-contrib/src/samples/java/DTEP_Sample.java trunk/fb-contrib/src/samples/java/DWI_Sample.java trunk/fb-contrib/src/samples/java/EXS_Sample.java trunk/fb-contrib/src/samples/java/FCBL_Sample.java trunk/fb-contrib/src/samples/java/FCCD_Sample.java trunk/fb-contrib/src/samples/java/FPL_Sample.java trunk/fb-contrib/src/samples/java/FP_Sample.java trunk/fb-contrib/src/samples/java/HCP_Sample.java trunk/fb-contrib/src/samples/java/HES_Sample.java trunk/fb-contrib/src/samples/java/ICA_Sample.java trunk/fb-contrib/src/samples/java/IICU_Sample.java trunk/fb-contrib/src/samples/java/IKNC_Sample.java trunk/fb-contrib/src/samples/java/IMC_Sample.java trunk/fb-contrib/src/samples/java/IOI_Sample.java trunk/fb-contrib/src/samples/java/IPU_Sample.java trunk/fb-contrib/src/samples/java/ISB_Sample.java trunk/fb-contrib/src/samples/java/ITC_Sample.java trunk/fb-contrib/src/samples/java/ITU_Sample.java trunk/fb-contrib/src/samples/java/JPAI_Sample.java trunk/fb-contrib/src/samples/java/JVR_Sample.java trunk/fb-contrib/src/samples/java/JXI_Sample.java trunk/fb-contrib/src/samples/java/LEST_Sample.java trunk/fb-contrib/src/samples/java/LGO_Sample.java trunk/fb-contrib/src/samples/java/LII_Sample.java trunk/fb-contrib/src/samples/java/LO_Sample.java trunk/fb-contrib/src/samples/java/LSC_Sample.java trunk/fb-contrib/src/samples/java/LSYC_Sample.java trunk/fb-contrib/src/samples/java/MAC_Sample.java trunk/fb-contrib/src/samples/java/MDM_Sample.java trunk/fb-contrib/src/samples/java/MOM_Sample.java trunk/fb-contrib/src/samples/java/MRC_Sample.java trunk/fb-contrib/src/samples/java/MTA_Sample.java trunk/fb-contrib/src/samples/java/MUC_Sample.java trunk/fb-contrib/src/samples/java/NAB_Sample.java trunk/fb-contrib/src/samples/java/NCMU_Sample.java trunk/fb-contrib/src/samples/java/NCS_Sample.java trunk/fb-contrib/src/samples/java/NFF_Sample.java trunk/fb-contrib/src/samples/java/NIR_Sample.java trunk/fb-contrib/src/samples/java/NMCS_Sample.java trunk/fb-contrib/src/samples/java/NOS_Sample.java trunk/fb-contrib/src/samples/java/NPMC_Sample.java trunk/fb-contrib/src/samples/java/NRTL_Sample.java trunk/fb-contrib/src/samples/java/NSE_Sample.java trunk/fb-contrib/src/samples/java/OCP_Sample.java trunk/fb-contrib/src/samples/java/OC_Sample.java trunk/fb-contrib/src/samples/java/ODN_Sample.java trunk/fb-contrib/src/samples/java/OI_Sample.java trunk/fb-contrib/src/samples/java/OPM_Sample.java trunk/fb-contrib/src/samples/java/PCAIL_Sample.java trunk/fb-contrib/src/samples/java/PCOA_Sample.java trunk/fb-contrib/src/samples/java/PDP_Sample.java trunk/fb-contrib/src/samples/java/PIS_Sample.java trunk/fb-contrib/src/samples/java/PL_Sample.java trunk/fb-contrib/src/samples/java/PMB_Sample.java trunk/fb-contrib/src/samples/java/PME_Sample.java trunk/fb-contrib/src/samples/java/PRMC_Sample.java trunk/fb-contrib/src/samples/java/PSC_Sample.java trunk/fb-contrib/src/samples/java/PUS_Sample.java trunk/fb-contrib/src/samples/java/ROOM_Sample.java trunk/fb-contrib/src/samples/java/S508C_Sample.java trunk/fb-contrib/src/samples/java/SACM_Sample.java trunk/fb-contrib/src/samples/java/SCA_Sample.java trunk/fb-contrib/src/samples/java/SCII_Sample.java trunk/fb-contrib/src/samples/java/SCI_Sample.java trunk/fb-contrib/src/samples/java/SCRV_Sample.java trunk/fb-contrib/src/samples/java/SCR_Sample.java trunk/fb-contrib/src/samples/java/SCSS_Sample.java trunk/fb-contrib/src/samples/java/SEC_Sample.java trunk/fb-contrib/src/samples/java/SEO_Sample.java trunk/fb-contrib/src/samples/java/SGSU_Sample.java trunk/fb-contrib/src/samples/java/SG_Sample.java trunk/fb-contrib/src/samples/java/SIL_Sample.java trunk/fb-contrib/src/samples/java/SJVU_Sample.java trunk/fb-contrib/src/samples/java/SLS_Sample.java trunk/fb-contrib/src/samples/java/SMII_Sample.java trunk/fb-contrib/src/samples/java/SNG_Sample.java trunk/fb-contrib/src/samples/java/SPP_Sample.java trunk/fb-contrib/src/samples/java/SSCU_Sample.java trunk/fb-contrib/src/samples/java/STB_Sample.java trunk/fb-contrib/src/samples/java/STS_Sample.java trunk/fb-contrib/src/samples/java/STT_Sample.java trunk/fb-contrib/src/samples/java/SUA_Sample.java trunk/fb-contrib/src/samples/java/SWCO_Sample.java trunk/fb-contrib/src/samples/java/TBP_Sample.java trunk/fb-contrib/src/samples/java/TR_Sample.java trunk/fb-contrib/src/samples/java/UAA_Sample.java trunk/fb-contrib/src/samples/java/UCC_Sample.java trunk/fb-contrib/src/samples/java/UCPM_Sample.java trunk/fb-contrib/src/samples/java/UEC_Sample.java trunk/fb-contrib/src/samples/java/UMTP_Sample.java trunk/fb-contrib/src/samples/java/UNNC_Sample.java trunk/fb-contrib/src/samples/java/UP_Sample.java trunk/fb-contrib/src/samples/java/URV_Sample.java trunk/fb-contrib/src/samples/java/USBR_Sample.java trunk/fb-contrib/src/samples/java/USFW_Sample.java trunk/fb-contrib/src/samples/java/USS_Sample.java trunk/fb-contrib/src/samples/java/UTAO_Sample.java trunk/fb-contrib/src/samples/java/UTA_Sample.java trunk/fb-contrib/src/samples/java/UTWR_Sample.java trunk/fb-contrib/src/samples/java/UVA_Sample.java trunk/fb-contrib/src/samples/java/WEM_Sample.java trunk/fb-contrib/src/samples/java/WI_Sample.java trunk/fb-contrib/src/samples/java/WOC_Sample.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2017-03-12 23:39:23 UTC (rev 1815) +++ trunk/fb-contrib/build.xml 2017-04-09 22:42:29 UTC (rev 1816) @@ -31,7 +31,7 @@ <property name="javac.debug" value="on" /> <property name="test_reports.dir" value="${target.dir}/reports/test"/> - <property name="fb-contrib.version" value="6.8.4" /> + <property name="fb-contrib.version" value="6.9.0-SNAPSHOT" /> <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 2017-03-12 23:39:23 UTC (rev 1815) +++ trunk/fb-contrib/etc/findbugs.xml 2017-04-09 22:42:29 UTC (rev 1816) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -305,7 +305,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/> - <!-- COMMENT OUT FOR POINT RELEASE + <!-- COMMENT OUT FOR POINT RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/> @@ -315,7 +315,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED"/> - COMMENT OUT FOR POINT RELEASE --> + <!-- COMMENT OUT FOR POINT RELEASE --> <!-- BugPattern --> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2017-03-12 23:39:23 UTC (rev 1815) +++ trunk/fb-contrib/etc/messages.xml 2017-04-09 22:42:29 UTC (rev 1816) @@ -5638,7 +5638,7 @@ <![CDATA[ <p>Looks for relatively large if blocks of code, where you unconditionally return from them, and then follow that with an unconditional return of a small block. This places the bulk of the logic to the right indentation-wise, making it more difficult to read than needed. - It would be better to invert the logic of the if block, and immediately return, allowing the bulk of the logic to be move to the left, + It would be better to invert the logic of the if block, and immediately return, allowing the bulk of the logic to be move to the left for easier reading.</p> ]]> </Details> @@ -5649,9 +5649,9 @@ <LongDescription>Class {0} auto wires the same object into two separate fields in a class hierarchy</LongDescription> <Details> <![CDATA[ - <p>this class has two fields in either itself or a parent class which autowire (without specialization, the same object - for both fields. This is likely caused by a developer just not being aware that the field already is available for you use, - and just causes wasted space, and confusing code access the same object through two different pathways.</p> + <p>this class has two fields in either itself or a parent class which autowire (without specialization), the same object + for both fields. This is likely caused by a developer just not being aware that the field already is available for your use, + and just causes wasted space, and confusing code access to the same object through two different pathways.</p> ]]> </Details> </BugPattern> @@ -5662,7 +5662,7 @@ <Details> <![CDATA[ <p>This method retrieves the value of a key from a ConcurrentHashMap, where the value is itself a collection. It checks this - value for null, and if it is so, creates a new collection and places in the map. This may cause thread race conditions + value for null, and if it is so, creates a new collection and places it in the map. This may cause thread race conditions where two threads overwrite each other's values. You should be using <code> ConcurrentHashMap.putIfAbsent(K, V) @@ -5677,9 +5677,9 @@ <LongDescription>Method {1} manually handles closing an auto-closeable resource</LongDescription> <Details> <![CDATA[[ - <p>This method allocates and uses a auto closeable resources. However it manually closes the resource in a finally block. + <p>This method allocates and uses an auto closeable resources. However it manually closes the resource in a finally block. While this is correct management, it doesn't rely on the Idiomatic way available to JDK 7 and above, and allows for possible - subtle problems, and complicates the reading of code, by developers expecting the use of try-with-resources. + subtle problems, and complicates the reading of code by developers expecting the use of try-with-resources. </p> <p>Switch to using try with resources, as: <pre> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2017-03-12 23:39:23 UTC (rev 1815) +++ trunk/fb-contrib/pom.xml 2017-04-09 22:42:29 UTC (rev 1816) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.8.4</version> + <version>6.9.0-SNAPSHOT</version> <prerequisites> <maven>2.2.1</maven> Modified: trunk/fb-contrib/samples.xml =================================================================== --- trunk/fb-contrib/samples.xml 2017-03-12 23:39:23 UTC (rev 1815) +++ trunk/fb-contrib/samples.xml 2017-04-09 22:42:29 UTC (rev 1816) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<BugCollection version="3.0.1" sequence="0" timestamp="1489328062955" analysisTimestamp="1489328062981" release=""> +<BugCollection version="3.0.1" sequence="0" timestamp="1491777371371" analysisTimestamp="1491777371509" release=""> <Project projectName="Samples"> <Jar>/home/dave/dev/fb-contrib/target/classes/samples</Jar> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> @@ -19,7 +19,6 @@ <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpcore-4.4.5.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpclient-4.5.2.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/commons-codec-1.10.jar</AuxClasspathEntry> - <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jsr311-api-${jsr311-api.version}.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry> @@ -29,371 +28,280 @@ <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry> </Project> - <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="52beb96b508e41498d672e105e62ceda" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Class is defined in the default package</ShortMessage> - <LongMessage>Class A id defined in the default package</LongMessage> - <Class classname="A" primary="true"> - <SourceLine classname="A" start="1" end="1" sourcefile="SCR_Sample.java" sourcepath="SCR_Sample.java"> - <Message>At SCR_Sample.java:[line 1]</Message> - </SourceLine> - <Message>In class A</Message> - </Class> - <SourceLine classname="A" start="1" end="1" sourcefile="SCR_Sample.java" sourcepath="SCR_Sample.java" synthetic="true"> - <Message>At SCR_Sample.java:[line 1]</Message> - </SourceLine> - </BugInstance> - <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="5421bf96fc5a9d37844eb8b32cd4cb17" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="c119924fdc9852642c13941116e4133a" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method uses array as basis of collection</ShortMessage> - <LongMessage>Method ABC_Sample.testLists(List, String[]) uses array as basis of collection</LongMessage> - <Class classname="ABC_Sample" primary="true"> - <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 9-23]</Message> + <LongMessage>Method ex.ABC_Sample.testLists(List, String[]) uses array as basis of collection</LongMessage> + <Class classname="ex.ABC_Sample" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="10" end="24" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 10-24]</Message> </SourceLine> - <Message>In class ABC_Sample</Message> + <Message>In class ex.ABC_Sample</Message> </Class> - <Method classname="ABC_Sample" name="testLists" signature="(Ljava/util/List;[Ljava/lang/String;)Z" isStatic="false" primary="true"> - <SourceLine classname="ABC_Sample" start="23" end="23" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"/> - <Message>In method ABC_Sample.testLists(List, String[])</Message> + <Method classname="ex.ABC_Sample" name="testLists" signature="(Ljava/util/List;[Ljava/lang/String;)Z" isStatic="false" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="24" end="24" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"/> + <Message>In method ex.ABC_Sample.testLists(List, String[])</Message> </Method> - <SourceLine classname="ABC_Sample" primary="true" start="23" end="23" startBytecode="2" endBytecode="2" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[line 23]</Message> + <SourceLine classname="ex.ABC_Sample" primary="true" start="24" end="24" startBytecode="2" endBytecode="2" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[line 24]</Message> </SourceLine> </BugInstance> - <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="40414f9e8176322dc38b05fd7a40112b" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="5022f7e5f22e85b8c09eb0698effc480" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method uses array as basis of collection</ShortMessage> - <LongMessage>Method ABC_Sample.testMaps(String[], String) uses array as basis of collection</LongMessage> - <Class classname="ABC_Sample" primary="true"> - <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 9-23]</Message> + <LongMessage>Method ex.ABC_Sample.testMaps(String[], String) uses array as basis of collection</LongMessage> + <Class classname="ex.ABC_Sample" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="10" end="24" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 10-24]</Message> </SourceLine> - <Message>In class ABC_Sample</Message> + <Message>In class ex.ABC_Sample</Message> </Class> - <Method classname="ABC_Sample" name="testMaps" signature="([Ljava/lang/String;Ljava/lang/String;)Ljava/util/Map;" isStatic="false" primary="true"> - <SourceLine classname="ABC_Sample" start="11" end="13" startBytecode="0" endBytecode="116" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"/> - <Message>In method ABC_Sample.testMaps(String[], String)</Message> + <Method classname="ex.ABC_Sample" name="testMaps" signature="([Ljava/lang/String;Ljava/lang/String;)Ljava/util/Map;" isStatic="false" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="12" end="14" startBytecode="0" endBytecode="116" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"/> + <Message>In method ex.ABC_Sample.testMaps(String[], String)</Message> </Method> - <SourceLine classname="ABC_Sample" primary="true" start="12" end="12" startBytecode="11" endBytecode="11" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[line 12]</Message> + <SourceLine classname="ex.ABC_Sample" primary="true" start="13" end="13" startBytecode="11" endBytecode="11" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[line 13]</Message> </SourceLine> </BugInstance> - <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="dfcf9c8148359ea9a561f2ac7905bdc1" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="4072d21498fbe1619af1b99012438a3e" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method uses array as basis of collection</ShortMessage> - <LongMessage>Method ABC_Sample.testSets(String[]) uses array as basis of collection</LongMessage> - <Class classname="ABC_Sample" primary="true"> - <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 9-23]</Message> + <LongMessage>Method ex.ABC_Sample.testSets(String[]) uses array as basis of collection</LongMessage> + <Class classname="ex.ABC_Sample" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="10" end="24" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 10-24]</Message> </SourceLine> - <Message>In class ABC_Sample</Message> + <Message>In class ex.ABC_Sample</Message> </Class> - <Method classname="ABC_Sample" name="testSets" signature="([Ljava/lang/String;)Ljava/util/Set;" isStatic="false" primary="true"> - <SourceLine classname="ABC_Sample" start="17" end="19" startBytecode="0" endBytecode="105" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"/> - <Message>In method ABC_Sample.testSets(String[])</Message> + <Method classname="ex.ABC_Sample" name="testSets" signature="([Ljava/lang/String;)Ljava/util/Set;" isStatic="false" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="18" end="20" startBytecode="0" endBytecode="105" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"/> + <Message>In method ex.ABC_Sample.testSets(String[])</Message> </Method> - <SourceLine classname="ABC_Sample" primary="true" start="18" end="18" startBytecode="10" endBytecode="10" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[line 18]</Message> + <SourceLine classname="ex.ABC_Sample" primary="true" start="19" end="19" startBytecode="10" endBytecode="10" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[line 19]</Message> </SourceLine> </BugInstance> - <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="6a106c10c25dcb88c0ca36a141248693" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Class is defined in the default package</ShortMessage> - <LongMessage>Class ABC_Sample id defined in the default package</LongMessage> - <Class classname="ABC_Sample" primary="true"> - <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 9-23]</Message> - </SourceLine> - <Message>In class ABC_Sample</Message> - </Class> - <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[lines 9-23]</Message> - </SourceLine> - </BugInstance> - <BugInstance type="UVA_USE_VAR_ARGS" priority="3" rank="20" abbrev="UVA" category="STYLE" instanceHash="953736d56fdf8525c7638c0264d76ee1" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="UVA_USE_VAR_ARGS" priority="3" rank="20" abbrev="UVA" category="STYLE" instanceHash="b812994e88471986bcb49febe893981" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> - <LongMessage>Method ABC_Sample.testLists(List, String[]) defines parameter list with array as last argument, rather than vararg</LongMessage> - <Class classname="ABC_Sample" primary="true"> - <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 9-23]</Message> + <LongMessage>Method ex.ABC_Sample.testLists(List, String[]) defines parameter list with array as last argument, rather than vararg</LongMessage> + <Class classname="ex.ABC_Sample" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="10" end="24" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 10-24]</Message> </SourceLine> - <Message>In class ABC_Sample</Message> + <Message>In class ex.ABC_Sample</Message> </Class> - <Method classname="ABC_Sample" name="testLists" signature="(Ljava/util/List;[Ljava/lang/String;)Z" isStatic="false" primary="true"> - <SourceLine classname="ABC_Sample" start="23" end="23" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"/> - <Message>In method ABC_Sample.testLists(List, String[])</Message> + <Method classname="ex.ABC_Sample" name="testLists" signature="(Ljava/util/List;[Ljava/lang/String;)Z" isStatic="false" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="24" end="24" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"/> + <Message>In method ex.ABC_Sample.testLists(List, String[])</Message> </Method> - <SourceLine classname="ABC_Sample" start="23" end="23" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[line 23]</Message> + <SourceLine classname="ex.ABC_Sample" start="24" end="24" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java" synthetic="true"> + <Message>At ABC_Sample.java:[line 24]</Message> </SourceLine> </BugInstance> - <BugInstance type="UVA_USE_VAR_ARGS" priority="3" rank="20" abbrev="UVA" category="STYLE" instanceHash="371050328f0e7fbfb0936e6adf778ec5" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="UVA_USE_VAR_ARGS" priority="3" rank="20" abbrev="UVA" category="STYLE" instanceHash="429323157d988fb6e44ff020f056b86a" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> - <LongMessage>Method ABC_Sample.testSets(String[]) defines parameter list with array as last argument, rather than vararg</LongMessage> - <Class classname="ABC_Sample" primary="true"> - <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 9-23]</Message> + <LongMessage>Method ex.ABC_Sample.testSets(String[]) defines parameter list with array as last argument, rather than vararg</LongMessage> + <Class classname="ex.ABC_Sample" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="10" end="24" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 10-24]</Message> </SourceLine> - <Message>In class ABC_Sample</Message> + <Message>In class ex.ABC_Sample</Message> </Class> - <Method classname="ABC_Sample" name="testSets" signature="([Ljava/lang/String;)Ljava/util/Set;" isStatic="false" primary="true"> - <SourceLine classname="ABC_Sample" start="17" end="19" startBytecode="0" endBytecode="105" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"/> - <Message>In method ABC_Sample.testSets(String[])</Message> + <Method classname="ex.ABC_Sample" name="testSets" signature="([Ljava/lang/String;)Ljava/util/Set;" isStatic="false" primary="true"> + <SourceLine classname="ex.ABC_Sample" start="18" end="20" startBytecode="0" endBytecode="105" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"/> + <Message>In method ex.ABC_Sample.testSets(String[])</Message> </Method> - <SourceLine classname="ABC_Sample" start="17" end="19" startBytecode="0" endBytecode="105" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[lines 17-19]</Message> + <SourceLine classname="ex.ABC_Sample" start="18" end="20" startBytecode="0" endBytecode="105" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java" synthetic="true"> + <Message>At ABC_Sample.java:[lines 18-20]</Message> </SourceLine> </BugInstance> - <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="c520853fde7213434793beddd90ecf4b" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Class is defined in the default package</ShortMessage> - <LongMessage>Class ABC_Sample$UseComparator id defined in the default package</LongMessage> - <Class classname="ABC_Sample$UseComparator" primary="true"> - <SourceLine classname="ABC_Sample$UseComparator" start="29" end="40" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 29-40]</Message> - </SourceLine> - <Message>In class ABC_Sample$UseComparator</Message> - </Class> - <SourceLine classname="ABC_Sample$UseComparator" start="29" end="40" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[lines 29-40]</Message> - </SourceLine> - </BugInstance> - <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="2e5c6f2ce94c7857de42f1491cf2f6c2" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Class is defined in the default package</ShortMessage> - <LongMessage>Class ABC_Sample$UseComparator$1 id defined in the default package</LongMessage> - <Class classname="ABC_Sample$UseComparator$1" primary="true"> - <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 1-33]</Message> - </SourceLine> - <Message>In class ABC_Sample$UseComparator$1</Message> - </Class> - <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[lines 1-33]</Message> - </SourceLine> - </BugInstance> - <BugInstance type="SIC_INNER_SHOULD_BE_STATIC_ANON" priority="3" rank="20" abbrev="SIC" category="PERFORMANCE" instanceHash="9296dd6a3b1f76793e436f0b899dac" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="SIC_INNER_SHOULD_BE_STATIC_ANON" priority="3" rank="20" abbrev="SIC" category="PERFORMANCE" instanceHash="77e4834d0124712408e4e088c71d9594" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Could be refactored into a named static inner class</ShortMessage> - <LongMessage>The class ABC_Sample$UseComparator$1 could be refactored into a named _static_ inner class</LongMessage> - <Class classname="ABC_Sample$UseComparator$1" primary="true"> - <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 1-33]</Message> + <LongMessage>The class ex.ABC_Sample$UseComparator$1 could be refactored into a named _static_ inner class</LongMessage> + <Class classname="ex.ABC_Sample$UseComparator$1" primary="true"> + <SourceLine classname="ex.ABC_Sample$UseComparator$1" start="1" end="34" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 1-34]</Message> </SourceLine> - <Message>In class ABC_Sample$UseComparator$1</Message> + <Message>In class ex.ABC_Sample$UseComparator$1</Message> </Class> - <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[lines 1-33]</Message> + <SourceLine classname="ex.ABC_Sample$UseComparator$1" start="1" end="34" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java" synthetic="true"> + <Message>At ABC_Sample.java:[lines 1-34]</Message> </SourceLine> </BugInstance> - <BugInstance type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" priority="2" rank="19" abbrev="ACEM" category="STYLE" instanceHash="1d9ad842073400e44bf8df1666096e98" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" priority="2" rank="19" abbrev="ACEM" category="STYLE" instanceHash="aad57247260e0468a77c14712f5304f" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Empty method could be declared abstract</ShortMessage> - <LongMessage>Empty method ACEM_Sample.test() could be declared abstract</LongMessage> - <Class classname="ACEM_Sample" primary="true"> - <SourceLine classname="ACEM_Sample" start="2" end="12" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java"> - <Message>At ACEM_Sample.java:[lines 2-12]</Message> + <LongMessage>Empty method ex.ACEM_Sample.test() could be declared abstract</LongMessage> + <Class classname="ex.ACEM_Sample" primary="true"> + <SourceLine classname="ex.ACEM_Sample" start="3" end="13" sourcefile="ACEM_Sample.java" sourcepath="ex/ACEM_Sample.java"> + <Message>At ACEM_Sample.java:[lines 3-13]</Message> </SourceLine> - <Message>In class ACEM_Sample</Message> + <Message>In class ex.ACEM_Sample</Message> </Class> - <Method classname="ACEM_Sample" name="test" signature="()V" isStatic="false" primary="true"> - <SourceLine classname="ACEM_Sample" start="4" end="4" startBytecode="0" endBytecode="42" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java"/> - <Message>In method ACEM_Sample.test()</Message> + <Method classname="ex.ACEM_Sample" name="test" signature="()V" isStatic="false" primary="true"> + <SourceLine classname="ex.ACEM_Sample" start="5" end="5" startBytecode="0" endBytecode="42" sourcefile="ACEM_Sample.java" sourcepath="ex/ACEM_Sample.java"/> + <Message>In method ex.ACEM_Sample.test()</Message> </Method> - <SourceLine classname="ACEM_Sample" primary="true" start="4" end="4" startBytecode="0" endBytecode="0" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java"> - <Message>At ACEM_Sample.java:[line 4]</Message> + <SourceLine classname="ex.ACEM_Sample" primary="true" start="5" end="5" startBytecode="0" endBytecode="0" sourcefile="ACEM_Sample.java" sourcepath="ex/ACEM_Sample.java"> + <Message>At ACEM_Sample.java:[line 5]</Message> </SourceLine> </BugInstance> - <BugInstance type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" priority="2" rank="19" abbrev="ACEM" category="STYLE" instanceHash="dfb744a9fd133992695661a44c1ad885" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" priority="2" rank="19" abbrev="ACEM" category="STYLE" instanceHash="e87d3eb59ec00415966480f172c1cfb6" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Empty method could be declared abstract</ShortMessage> - <LongMessage>Empty method ACEM_Sample.test1() could be declared abstract</LongMessage> - <Class classname="ACEM_Sample" primary="true"> - <SourceLine classname="ACEM_Sample" start="2" end="12" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java"> - <Message>At ACEM_Sample.java:[lines 2-12]</Message> + <LongMessage>Empty method ex.ACEM_Sample.test1() could be declared abstract</LongMessage> + <Class classname="ex.ACEM_Sample" primary="true"> + <SourceLine classname="ex.ACEM_Sample" start="3" end="13" sourcefile="ACEM_Sample.java" sourcepath="ex/ACEM_Sample.java"> + <Message>At ACEM_Sample.java:[lines 3-13]</Message> </SourceLine> - <Message>In class ACEM_Sample</Message> + <Message>In class ex.ACEM_Sample</Message> </Class> - <Method classname="ACEM_Sample" name="test1" signature="()I" isStatic="false" primary="true"> - <SourceLine classname="ACEM_Sample" start="7" end="7" startBytecode="0" endBytecode="51" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java"/> - <Message>In method ACEM_Sample.test1()</Message> + <Method classname="ex.ACEM_Sample" name="test1" signature="()I" isStatic="false" primary="true"> + <SourceLine classname="ex.ACEM_Sample" start="8" end="8" startBytecode="0" endBytecode="51" sourcefile="ACEM_Sample.java" sourcepath="ex/ACEM_Sample.java"/> + <Message>In method ex.ACEM_Sample.test1()</Message> </Method> - <SourceLine classname="ACEM_Sample" primary="true" start="7" end="7" startBytecode="9" endBytecode="9" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java"> - <Message>At ACEM_Sample.java:[line 7]</Message> + <SourceLine classname="ex.ACEM_Sample" primary="true" start="8" end="8" startBytecode="9" endBytecode="9" sourcefile="ACEM_Sample.java" sourcepath="ex/ACEM_Sample.java"> + <Message>At ACEM_Sample.java:[line 8]</Message> </SourceLine> </BugInstance> - <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="3e69b2201e7354f6c9dcfbd765b2aea4" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Class is defined in the default package</ShortMessage> - <LongMessage>Class ACEM_Sample id defined in the default package</LongMessage> - <Class classname="ACEM_Sample" primary="true"> - <SourceLine classname="ACEM_Sample" start="2" end="12" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java"> - <Message>At ACEM_Sample.java:[lines 2-12]</Message> - </SourceLine> - <Message>In class ACEM_Sample</Message> - </Class> - <SourceLine classname="ACEM_Sample" start="2" end="12" sourcefile="ACEM_Sample.java" sourcepath="ACEM_Sample.java" synthetic="true"> - <Message>At ACEM_Sample.java:[lines 2-12]</Message> - </SourceLine> - </BugInstance> - <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="7d163f23adfca420d778642389488e30" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Class is defined in the default package</ShortMessage> - <LongMessage>Class AFBR_Sample id defined in the default package</LongMessage> - <Class classname="AFBR_Sample" primary="true"> - <SourceLine classname="AFBR_Sample" start="6" end="55" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"> - <Message>At AFBR_Sample.java:[lines 6-55]</Message> - </SourceLine> - <Message>In class AFBR_Sample</Message> - </Class> - <SourceLine classname="AFBR_Sample" start="6" end="55" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java" synthetic="true"> - <Message>At AFBR_Sample.java:[lines 6-55]</Message> - </SourceLine> - </BugInstance> - <BugInstance type="UTWR_USE_TRY_WITH_RESOURCES" priority="2" rank="17" abbrev="UTWR" category="STYLE" instanceHash="7853058b271c094cda47622eb67ea1ef" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="UTWR_USE_TRY_WITH_RESOURCES" priority="2" rank="17" abbrev="UTWR" category="STYLE" instanceHash="ec7e6902ec57bf55eb9d354038d69126" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method manually handles closing an auto-closeable resource</ShortMessage> - <LongMessage>Method AFBR_Sample.test5() manually handles closing an auto-closeable resource</LongMessage> - <Class classname="AFBR_Sample" primary="true"> - <SourceLine classname="AFBR_Sample" start="6" end="55" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"> - <Message>At AFBR_Sample.java:[lines 6-55]</Message> + <LongMessage>Method ex.AFBR_Sample.test5() manually handles closing an auto-closeable resource</LongMessage> + <Class classname="ex.AFBR_Sample" primary="true"> + <SourceLine classname="ex.AFBR_Sample" start="7" end="56" sourcefile="AFBR_Sample.java" sourcepath="ex/AFBR_Sample.java"> + <Message>At AFBR_Sample.java:[lines 7-56]</Message> </SourceLine> - <Message>In class AFBR_Sample</Message> + <Message>In class ex.AFBR_Sample</Message> </Class> - <Method classname="AFBR_Sample" name="test5" signature="()I" isStatic="false" primary="true"> - <SourceLine classname="AFBR_Sample" start="45" end="55" startBytecode="0" endBytecode="244" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"/> - <Message>In method AFBR_Sample.test5()</Message> + <Method classname="ex.AFBR_Sample" name="test5" signature="()I" isStatic="false" primary="true"> + <SourceLine classname="ex.AFBR_Sample" start="46" end="56" startBytecode="0" endBytecode="244" sourcefile="AFBR_Sample.java" sourcepath="ex/AFBR_Sample.java"/> + <Message>In method ex.AFBR_Sample.test5()</Message> </Method> - <SourceLine classname="AFBR_Sample" primary="true" start="53" end="53" startBytecode="48" endBytecode="48" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"> - <Message>At AFBR_Sample.java:[line 53]</Message> + <SourceLine classname="ex.AFBR_Sample" primary="true" start="54" end="54" startBytecode="48" endBytecode="48" sourcefile="AFBR_Sample.java" sourcepath="ex/AFBR_Sample.java"> + <Message>At AFBR_Sample.java:[line 54]</Message> </SourceLine> </BugInstance> - <BugInstance type="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS" priority="1" rank="5" abbrev="AIOB" category="CORRECTNESS" instanceHash="d2f4886e79bc1813b0e731d7c4a23e9" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS" priority="1" rank="5" abbrev="AIOB" category="CORRECTNESS" instanceHash="27db0e3df2e5d04faa228833bdf78524" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method attempts to access an array element outside the array's size</ShortMessage> - <LongMessage>Method AIOB_Sample.testOutOfBounds() attempts to access an array element outside the array's size</LongMessage> - <Class classname="AIOB_Sample" primary="true"> - <SourceLine classname="AIOB_Sample" start="3" end="80" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> - <Message>At AIOB_Sample.java:[lines 3-80]</Message> + <LongMessage>Method ex.AIOB_Sample.testOutOfBounds() attempts to access an array element outside the array's size</LongMessage> + <Class classname="ex.AIOB_Sample" primary="true"> + <SourceLine classname="ex.AIOB_Sample" start="4" end="81" sourcefile="AIOB_Sample.java" sourcepath="ex/AIOB_Sample.java"> + <Message>At AIOB_Sample.java:[lines 4-81]</Message> </SourceLine> - <Message>In class AIOB_Sample</Message> + <Message>In class ex.AIOB_Sample</Message> </Class> - <Method classname="AIOB_Sample" name="testOutOfBounds" signature="()V" isStatic="false" primary="true"> - <SourceLine classname="AIOB_Sample" start="9" end="13" startBytecode="0" endBytecode="79" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> - <Message>In method AIOB_Sample.testOutOfBounds()</Message> + <Method classname="ex.AIOB_Sample" name="testOutOfBounds" signature="()V" isStatic="false" primary="true"> + <SourceLine classname="ex.AIOB_Sample" start="10" end="14" startBytecode="0" endBytecode="79" sourcefile="AIOB_Sample.java" sourcepath="ex/AIOB_Sample.java"/> + <Message>In method ex.AIOB_Sample.testOutOfBounds()</Message> </Method> - <SourceLine classname="AIOB_Sample" primary="true" start="11" end="11" startBytecode="7" endBytecode="7" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> - <Message>At AIOB_Sample.java:[line 11]</Message> + <SourceLine classname="ex.AIOB_Sample" primary="true" start="12" end="12" startBytecode="7" endBytecode="7" sourcefile="AIOB_Sample.java" sourcepath="ex/AIOB_Sample.java"> + <Message>At AIOB_Sample.java:[line 12]</Message> </SourceLine> </BugInstance> - <BugInstance type="AIOB_ARRAY_STORE_TO_NULL_REFERENCE" priority="1" rank="5" abbrev="AIOB" category="CORRECTNESS" instanceHash="8e04af5b8eab8882d56ff00e1aae49bd" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="AIOB_ARRAY_STORE_TO_NULL_REFERENCE" priority="1" rank="5" abbrev="AIOB" category="CORRECTNESS" instanceHash="32fd3a9096a628f23868ee9eff245995" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method attempts to store an array element to an array that does not appear to be allocated</ShortMessage> - <LongMessage>Method AIOB_Sample.testUnallocated() attempts to store an array element to an array that does not appear to be allocated</LongMessage> - <Class classname="AIOB_Sample" primary="true"> - <SourceLine classname="AIOB_Sample" start="3" end="80" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> - <Message>At AIOB_Sample.java:[lines 3-80]</Message> + <LongMessage>Method ex.AIOB_Sample.testUnallocated() attempts to store an array element to an array that does not appear to be allocated</LongMessage> + <Class classname="ex.AIOB_Sample" primary="true"> + <SourceLine classname="ex.AIOB_Sample" start="4" end="81" sourcefile="AIOB_Sample.java" sourcepath="ex/AIOB_Sample.java"> + <Message>At AIOB_Sample.java:[lines 4-81]</Message> </SourceLine> - <Message>In class AIOB_Sample</Message> + <Message>In class ex.AIOB_Sample</Message> </Class> - <Method classname="AIOB_Sample" name="testUnallocated" signature="()V" isStatic="false" primary="true"> - <SourceLine classname="AIOB_Sample" start="24" end="28" startBytecode="0" endBytecode="77" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> - <Message>In method AIOB_Sample.testUnallocated()</Message> + <Method classname="ex.AIOB_Sample" name="testUnallocated" signature="()V" isStatic="false" primary="true"> + <SourceLine classname="ex.AIOB_Sample" start="25" end="29" startBytecode="0" endBytecode="77" sourcefile="AIOB_Sample.java" sourcepath="ex/AIOB_Sample.java"/> + <Message>In method ex.AIOB_Sample.testUnallocated()</Message> </Method> - <SourceLine classname="AIOB_Sample" primary="true" start="26" end="26" startBytecode="5" endBytecode="5" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> - <Message>At AIOB_Sample.java:[line 26]</Message> + <SourceLine classname="ex.AIOB_Sample" primary="true" start="27" end="27" startBytecode="5" endBytecode="5" sourcefile="AIOB_Sample.java" sourcepath="ex/AIOB_Sample.java"> + <Message>At AIOB_Sample.java:[line 27]</Message> </SourceLine> </BugInstance> - <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="3" rank="20" abbrev="DLS" category="STYLE" instanceHash="92b9c579b1c9b45022ff884c72079ad3" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563"> + <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="3" rank="20" abbrev="DLS" category="STYLE" instanceHash="6fac8373ac4fb823f4ab0435e7682742" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563"> <ShortMessage>Dead store to local variable</ShortMessage> - <LongMessage>Dead store to s in AIOB_Sample.fpPlusPlusNotRecognized(List)</LongMessage> - <Class classname="AIOB_Sample" primary="true"> - <SourceLine classname="AIOB_Sample" start="3" end="80" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> - <Message>At AIOB_Sample.java:[lines 3-80]</Message> + <LongMessage>Dead store to s in ex.AIOB_Sample.fpPlusPlusNotRecognized(List)</LongMessage> + <Class classname="ex.AIOB_Sample" primary="true"> + <SourceLine classname="ex.AIOB_Sample" start="4" end="81" sourcefile="AIOB_Sample.java" sourcepath="ex/AIOB_Sample.java"> + <Message>At AIOB_Sample.java:[lines 4-81]</Message> </SourceLine> - <Message>In class AIOB_Sample</Message> + <Message>In class ex.AIOB_Sample</Message> </Class> - <Method classname="AIOB_Sample" name="fpPlusPlusNotRecognized" signature="(Ljava/util/List;)[I" isStatic="false" primary="true"> - <SourceLine classname="AIOB_Sample" start="38" end="47" startBytecode="0" endBytecode="22" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> - <Message>In method AIOB_Sample.fpPlusPlusNotRecognized(List)</Message> + <Method classname="ex.AIOB_Sample" name="fpPlusPlusNotRecognized" signature="(Ljava/util/List;)[I" isStatic="false" primary="true"> + <SourceLine classname="ex.AIOB_Sample" start="39" end="48" startBytecode="0" endBytecode="22" sourcefile="AIOB_Sample.jav... [truncated message content] |
From: <dbr...@us...> - 2017-03-12 23:39:25
|
Revision: 1815 http://sourceforge.net/p/fb-contrib/code/1815 Author: dbrosius Date: 2017-03-12 23:39:23 +0000 (Sun, 12 Mar 2017) Log Message: ----------- Removed Paths: ------------- tags/v6.8.4/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2017-03-12 23:38:14
|
Revision: 1814 http://sourceforge.net/p/fb-contrib/code/1814 Author: dbrosius Date: 2017-03-12 23:38:13 +0000 (Sun, 12 Mar 2017) Log Message: ----------- Version 6.8.4 Added Paths: ----------- tags/v6_8_4/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2017-03-12 23:37:19
|
Revision: 1813 http://sourceforge.net/p/fb-contrib/code/1813 Author: dbrosius Date: 2017-03-12 23:37:17 +0000 (Sun, 12 Mar 2017) Log Message: ----------- Version 6.8.4 Added Paths: ----------- tags/v6.8.4/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2017-03-12 23:32:15
|
Revision: 1812 http://sourceforge.net/p/fb-contrib/code/1812 Author: dbrosius Date: 2017-03-12 23:32:07 +0000 (Sun, 12 Mar 2017) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.properties trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/etc/samples.fbp trunk/fb-contrib/htdocs/index.shtml trunk/fb-contrib/htdocs/repository.html trunk/fb-contrib/pom.xml trunk/fb-contrib/samples.xml trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JAXRSIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java trunk/fb-contrib/src/samples/java/BL_Sample.java trunk/fb-contrib/src/samples/java/DMC_Sample.java trunk/fb-contrib/src/samples/java/JXI_Sample.java trunk/fb-contrib/src/samples/java/OCP_Sample.java trunk/fb-contrib/src/samples/java/SJVU_Sample.java trunk/fb-contrib/src/samples/java/SLS_Sample.java trunk/fb-contrib/src/samples/java/SPP_Sample.java trunk/fb-contrib/src/samples/java/STB_Sample.java trunk/fb-contrib/src/samples/java/STT_Sample.java trunk/fb-contrib/yank.xls Removed Paths: ------------- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/StatisticsKey.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/.classpath 2017-03-12 23:32:07 UTC (rev 1812) @@ -5,8 +5,8 @@ <classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" output="target/classes/test" path="src/test/java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="lib" path="lib/backport-util-concurrent-3.1.jar"/> - <classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/> + <classpathentry kind="lib" path="lib/backport-util-concurrent-3.1.jar" sourcepath="/home/dave/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1-sources.jar"/> + <classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar" sourcepath="lib/sources/javax.servlet-api-3.1.0-sources.jar"/> <classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/> <classpathentry kind="lib" path="lib/javax.servlet.jsp-api-2.3.1.jar"/> <classpathentry kind="lib" path="lib/asm-debug-all-5.0.2.jar" sourcepath="lib/sources/asm-debug-all-5.0.2-sources.jar"/> @@ -17,7 +17,6 @@ </classpathentry> <classpathentry kind="lib" path="lib/findbugs-3.0.1.jar" sourcepath="lib/sources/findbugs-3.0.1-sources.jar"/> <classpathentry kind="lib" path="lib/junit-4.12.jar"/> - <classpathentry kind="lib" path="lib/jsr311-api-1.1.1.jar" sourcepath="lib/sources/jsr311-api-1.1.1-sources.jar"/> <classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar"/> <classpathentry kind="lib" path="lib/mockito-all-2.0.2-beta.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> @@ -39,5 +38,7 @@ <classpathentry kind="lib" path="lib/testng-6.9.10.jar"/> <classpathentry kind="lib" path="lib/jcommander-1.48.jar"/> <classpathentry kind="lib" path="lib/commons-io-2.4.jar"/> + <classpathentry kind="lib" path="lib/jersey-media-multipart-2.25.1.jar"/> + <classpathentry kind="lib" path="lib/javax.ws.rs-api-2.0.1.jar"/> <classpathentry kind="output" path="target/classes/main"/> </classpath> Modified: trunk/fb-contrib/build.properties =================================================================== --- trunk/fb-contrib/build.properties 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/build.properties 2017-03-12 23:32:07 UTC (rev 1812) @@ -1,6 +1,5 @@ -bin.includes = plugin.xml,\ - META-INF/,\ +bin.includes = plugin.xml . jars.compile.order = . source.. = src/main/java,\ Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/build.xml 2017-03-12 23:32:07 UTC (rev 1812) @@ -31,7 +31,7 @@ <property name="javac.debug" value="on" /> <property name="test_reports.dir" value="${target.dir}/reports/test"/> - <property name="fb-contrib.version" value="6.8.3" /> + <property name="fb-contrib.version" value="6.8.4" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -130,7 +130,6 @@ <pathelement location="${lib.dir}/httpcore-${httpcore.version}.jar" /> <pathelement location="${lib.dir}/httpclient-${httpclient.version}.jar" /> <pathelement location="${lib.dir}/commons-codec-${commons-codec.version}.jar" /> - <pathelement location="${lib.dir}/jsr311-api-${jsr311-api.version}.jar" /> <pathelement location="${lib.dir}/spring-beans-${spring-beans.version}.jar" /> <pathelement location="${lib.dir}/spring-context-${spring-context.version}.jar" /> <pathelement location="${lib.dir}/spring-tx-${spring-tx.version}.jar" /> @@ -137,6 +136,8 @@ <pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" /> <pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" /> <pathelement location="${lib.dir}/jena-shaded-guava-${jena-shaded-guava.version}.jar" /> + <pathelement location="${lib.dir}/javax.ws.rs-api-${javax.ws.rs-api.version}.jar" /> + <pathelement location="${lib.dir}/jersey-media-multipart-${jersey-media-multipart.version}.jar" /> </path> </target> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/etc/bugrank.txt 2017-03-12 23:32:07 UTC (rev 1812) @@ -200,6 +200,7 @@ +0 BugPattern SPP_NON_USEFUL_TOSTRING +0 BugPattern SPP_NO_CHAR_SB_CTOR +0 BugPattern SPP_NULL_BEFORE_INSTANCEOF ++0 BugPattern SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR +0 BugPattern SPP_NULL_CHECK_ON_OPTIONAL +0 BugPattern SPP_SERIALVER_SHOULD_BE_PRIVATE +0 BugPattern SPP_STATIC_FORMAT_STRING Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/etc/findbugs.xml 2017-03-12 23:32:07 UTC (rev 1812) @@ -145,7 +145,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SCRV_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_SERIALVER_SHOULD_BE_PRIVATE,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,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT" /> + 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_SERIALVER_SHOULD_BE_PRIVATE,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,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT,SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" /> @@ -428,6 +428,7 @@ <BugPattern abbrev="SPP" type="SPP_STATIC_FORMAT_STRING" category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_OPTIONAL" category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_WRONG_COMMONS_TO_STRING_OBJECT" category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" 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" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/etc/messages.xml 2017-03-12 23:32:07 UTC (rev 1812) @@ -774,7 +774,8 @@ compiled. This can happen if you specify the <code>-source</code> and <code>-target</code> options of the javac compiler, and specify a target that is less than the JDK version of the javac compiler.</p> <p>It relies on the system property <code>-Dfb-contrib.sjvu.jdkhome=/path/to/older/jdk/to/check"</code> to specify - what JDK to compare against. If this property is not set, this detector does nothing.</p> + what JDK to compare against. On linux, you may need to give file permissions to findbugs to read these directories. + If this property is not set, this detector does nothing.</p> <p>It is a slow detector.</p> ]]> </Details> @@ -3432,7 +3433,7 @@ <ShortDescription>Method does not pass an object to commons-lang's ToStringBuilder</ShortDescription> <LongDescription>Method {1} does not pass an object to commons-lang's ToStringBuilder</LongDescription> <Details> - <![CDATA[[ + <![CDATA[ This method uses commons-lang, or commons-lang3's ToStringBuilder to attempt to output a representation of an object. However, no object was passed, just the style specifier, and so the output will be of the ToStringStyle object itself. Don't forget to include the object you wish to output as the first parameter, such as @@ -3442,6 +3443,18 @@ ]]> </Details> </BugPattern> + + <BugPattern type="SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR"> + <ShortDescription>Method checks whether the keySet(), entrySet() or values() collection of a Map is null</ShortDescription> + <LongDescription>Method {1} checks whether the keySet(), entrySet() or values() collection of a Map is null</LongDescription> + <Details> + <![CDATA[ + This method checks to see if the return value from a keySet(), entrySet() or values() method call on a Map is null. + For any valid functioning Map these collections will always be non-null, and so the call is superfluous. Maybe you intended + to check whether those sets where empty() instead. + ]]> + </Details> + </BugPattern> <BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE"> <ShortDescription>Method assigns a variable in a larger scope than is needed</ShortDescription> @@ -5899,6 +5912,6 @@ <BugCode abbrev="CCI">Concurrent Collection Issues</BugCode> <BugCode abbrev="UTWR">Use Try With Resources</BugCode> <BugCode abbrev="SSCU">Suspicious Shaded Class Use</BugCode> - <BugCode abbrev="USFW">Unsynchronous Singleton Field Writes</BugCode> + <BugCode abbrev="USFW">Unsynchronized Singleton Field Writes</BugCode> <BugCode abbrev="OI">Optional Issues</BugCode> </MessageCollection> Modified: trunk/fb-contrib/etc/samples.fbp =================================================================== --- trunk/fb-contrib/etc/samples.fbp 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/etc/samples.fbp 2017-03-12 23:32:07 UTC (rev 1812) @@ -1,28 +1,29 @@ <Project projectName="sample"> - <Jar>./../target/classes/samples</Jar> - <AuxClasspathEntry>./../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/commons-codec-1.10.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/commons-collections-3.2.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/commons-lang3-3.4.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/guava-19.0.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/httpclient-4.5.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/httpcore-4.4.5.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/jsr311-api-1.1.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/junit-4.12.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/log4j-1.2.17.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/threetenbp-1.3.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/commons-io-2.4.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/testng-6.9.10.jar</AuxClasspathEntry> - <SrcDir>../src/samples/java</SrcDir> + <Jar>././../target/classes/samples</Jar> + <AuxClasspathEntry>././../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/commons-codec-1.10.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/commons-collections-3.2.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/commons-lang3-3.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/guava-19.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/httpclient-4.5.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/httpcore-4.4.5.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/junit-4.12.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/log4j-1.2.17.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/threetenbp-1.3.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/commons-io-2.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/testng-6.9.10.jar</AuxClasspathEntry> + <AuxClasspathEntry>../lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>../lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry> + <SrcDir>./../src/samples/java</SrcDir> </Project> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/htdocs/index.shtml 2017-03-12 23:32:07 UTC (rev 1812) @@ -68,7 +68,7 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.3 available for download + <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.4 available for download <a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p> <p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p> <p style="font-weight: bold;">Please note that active development for this project is now done on @@ -77,9 +77,9 @@ </div> <hr/> - <img id="git_image" src="flip1.gif" onClick="toggleBlock('git', 'git_image');" align="top"/> + <img id="git_image" src="flip2.gif" onClick="toggleBlock('git', 'git_image');" align="top"/> Detectors added in git<br/> - <div id="git" style="display:none;"> + <div id="git" style="display:block;"> <ul> <li><b>[UTWR] Use Try With Resources</b><br/> Looks for try/finally blocks that manage resources, without using try-with-resources. @@ -88,12 +88,18 @@ Looks for use of classes that have been shaded into 3rdparty jars, rather than using the real class, from the real jar. </li> + <li><b>[USFW] Unsynchronized Singleton Field Writes</b><br/> + Looks for field writes to objects that are non singletons, where the write is not synchronized + </li> + <li><b>[OI] Optional Issues</b><br/> + Looks for various issues around use of java.util.Optional + </li> </ul> </div> <hr/> - <img id="git_image" src="flip2.gif" onClick="toggleBlock('v6_8_0', 'v6_8_0_image');" align="top"/> + <img id="git_image" src="flip1.gif" onClick="toggleBlock('v6_8_0', 'v6_8_0_image');" align="top"/> Detectors added in v6.8.0<br/> - <div id="v6_8_0" style="display:block;"> + <div id="v6_8_0" style="display:none;"> <ul> <li><b>[DMC] Dubious Map Collection</b><br/> Looks for fields that are implementations of java.util.Map, but that are only ever iterated over. This probably means that this Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/htdocs/repository.html 2017-03-12 23:32:07 UTC (rev 1812) @@ -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.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>6.8.3</td></tr> + <tr><td><b>Version:</b></td><td>6.8.4</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/pom.xml 2017-03-12 23:32:07 UTC (rev 1812) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.8.3</version> + <version>6.8.4</version> <prerequisites> <maven>2.2.1</maven> @@ -148,10 +148,9 @@ <dependency><scope>test</scope><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.10</version></dependency> <dependency><scope>test</scope><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency> <dependency><scope>test</scope><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.2</version></dependency> - <dependency><scope>test</scope><groupId>javax.persistence</groupId><artifactId>persistence-api</artifactId><version>1.0.2</version></dependency> <dependency><scope>test</scope><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version></dependency> <dependency><scope>test</scope><groupId>javax.servlet.jsp</groupId><artifactId>javax.servlet.jsp-api</artifactId><version>2.3.1</version></dependency> - <dependency><scope>test</scope><groupId>javax.ws.rs</groupId><artifactId>jsr311-api</artifactId><version>1.1.1</version></dependency> + <dependency><scope>test</scope><groupId>javax.ws.rs</groupId><artifactId>javax.ws.rs-api</artifactId><version>2.0.1</version></dependency> <dependency><scope>test</scope><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency> <dependency><scope>test</scope><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency> <dependency><scope>test</scope><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.3</version></dependency> @@ -185,6 +184,18 @@ <version>3.1.0</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.glassfish.jersey.media</groupId> + <artifactId>jersey-media-multipart</artifactId> + <version>2.25.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.eclipse.persistence</groupId> + <artifactId>javax.persistence</artifactId> + <version>2.1.1</version> + <scope>test</scope> + </dependency> </dependencies> <build> Modified: trunk/fb-contrib/samples.xml =================================================================== --- trunk/fb-contrib/samples.xml 2017-02-12 16:42:47 UTC (rev 1811) +++ trunk/fb-contrib/samples.xml 2017-03-12 23:32:07 UTC (rev 1812) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<BugCollection version="3.0.1" sequence="0" timestamp="1486772460637" analysisTimestamp="1486772460662" release=""> +<BugCollection version="3.0.1" sequence="0" timestamp="1489328062955" analysisTimestamp="1489328062981" release=""> <Project projectName="Samples"> <Jar>/home/dave/dev/fb-contrib/target/classes/samples</Jar> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> @@ -19,7 +19,7 @@ <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpcore-4.4.5.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpclient-4.5.2.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/commons-codec-1.10.jar</AuxClasspathEntry> - <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jsr311-api-1.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jsr311-api-${jsr311-api.version}.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry> @@ -26,6 +26,8 @@ <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry> </Project> <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="52beb96b508e41498d672e105e62ceda" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Class is defined in the default package</ShortMessage> @@ -155,13 +157,13 @@ <ShortMessage>Class is defined in the default package</ShortMessage> <LongMessage>Class ABC_Sample$UseComparator$1 id defined in the default package</LongMessage> <Class classname="ABC_Sample$UseComparator$1" primary="true"> - <SourceLine classname="ABC_Sample$UseComparator$1" start="30" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 30-33]</Message> + <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 1-33]</Message> </SourceLine> <Message>In class ABC_Sample$UseComparator$1</Message> </Class> - <SourceLine classname="ABC_Sample$UseComparator$1" start="30" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[lines 30-33]</Message> + <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> + <Message>At ABC_Sample.java:[lines 1-33]</Message> </SourceLine> </BugInstance> <BugInstance type="SIC_INNER_SHOULD_BE_STATIC_ANON" priority="3" rank="20" abbrev="SIC" category="PERFORMANCE" instanceHash="9296dd6a3b1f76793e436f0b899dac" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -168,13 +170,13 @@ <ShortMessage>Could be refactored into a named static inner class</ShortMessage> <LongMessage>The class ABC_Sample$UseComparator$1 could be refactored into a named _static_ inner class</LongMessage> <Class classname="ABC_Sample$UseComparator$1" primary="true"> - <SourceLine classname="ABC_Sample$UseComparator$1" start="30" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> - <Message>At ABC_Sample.java:[lines 30-33]</Message> + <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"> + <Message>At ABC_Sample.java:[lines 1-33]</Message> </SourceLine> <Message>In class ABC_Sample$UseComparator$1</Message> </Class> - <SourceLine classname="ABC_Sample$UseComparator$1" start="30" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> - <Message>At ABC_Sample.java:[lines 30-33]</Message> + <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true"> + <Message>At ABC_Sample.java:[lines 1-33]</Message> </SourceLine> </BugInstance> <BugInstance type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" priority="2" rank="19" abbrev="ACEM" category="STYLE" instanceHash="1d9ad842073400e44bf8df1666096e98" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -247,10 +249,10 @@ <Message>In class AFBR_Sample</Message> </Class> <Method classname="AFBR_Sample" name="test5" signature="()I" isStatic="false" primary="true"> - <SourceLine classname="AFBR_Sample" start="45" end="55" startBytecode="0" endBytecode="231" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"/> + <SourceLine classname="AFBR_Sample" start="45" end="55" startBytecode="0" endBytecode="244" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"/> <Message>In method AFBR_Sample.test5()</Message> </Method> - <SourceLine classname="AFBR_Sample" primary="true" start="53" end="53" startBytecode="50" endBytecode="50" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"> + <SourceLine classname="AFBR_Sample" primary="true" start="53" end="53" startBytecode="48" endBytecode="48" sourcefile="AFBR_Sample.java" sourcepath="AFBR_Sample.java"> <Message>At AFBR_Sample.java:[line 53]</Message> </SourceLine> </BugInstance> @@ -301,16 +303,15 @@ <SourceLine classname="AIOB_Sample" start="38" end="47" startBytecode="0" endBytecode="22" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> <Message>In method AIOB_Sample.fpPlusPlusNotRecognized(List)</Message> </Method> - <LocalVariable name="s" register="4" pc="29" role="LOCAL_VARIABLE_NAMED"> + <LocalVariable name="s" register="3" pc="24" role="LOCAL_VARIABLE_NAMED"> <Message>Local variable named s</Message> </LocalVariable> - <SourceLine classname="AIOB_Sample" primary="true" start="40" end="40" startBytecode="27" endBytecode="27" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> + <SourceLine classname="AIOB_Sample" primary="true" start="40" end="40" startBytecode="23" endBytecode="23" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> <Message>At AIOB_Sample.java:[line 40]</Message> </SourceLine> <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.BASE_VALUE" value="true"/> <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.KILLED_BY_SUBSEQUENT_STORE" value="true"/> <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.LOCAL_NAME" value="s"/> - <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.NO_LOADS" value="true"/> </BugInstance> <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="cbb4e363f4a491db50a6fd5e57d755af" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Class is defined in the default package</ShortMessage> @@ -488,7 +489,7 @@ <Message>In class AIOB_Sample</Message> </Class> <Method classname="AIOB_Sample" name="fpPlusEquals" signature="(Ljava/util/List;)V" isStatic="false" primary="true"> - <SourceLine classname="AIOB_Sample" start="65" end="74" startBytecode="0" endBytecode="190" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> + <SourceLine classname="AIOB_Sample" start="65" end="74" startBytecode="0" endBytecode="200" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> <Message>In method AIOB_Sample.fpPlusEquals(List)</Message> </Method> <String value="a"> @@ -497,7 +498,7 @@ <Type descriptor="[I"> <Message>Type int[]</Message> </Type> - <SourceLine classname="AIOB_Sample" primary="true" start="71" end="71" startBytecode="41" endBytecode="41" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> + <SourceLine classname="AIOB_Sample" primary="true" start="71" end="71" startBytecode="42" endBytecode="42" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> <Message>At AIOB_Sample.java:[line 71]</Message> </SourceLine> </BugInstance> @@ -534,10 +535,10 @@ <Message>In class AIOB_Sample</Message> </Class> <Method classname="AIOB_Sample" name="fpPlusEquals" signature="(Ljava/util/List;)V" isStatic="false" primary="true"> - <SourceLine classname="AIOB_Sample" start="65" end="74" startBytecode="0" endBytecode="190" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> + <SourceLine classname="AIOB_Sample" start="65" end="74" startBytecode="0" endBytecode="200" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"/> <Message>In method AIOB_Sample.fpPlusEquals(List)</Message> </Method> - <SourceLine classname="AIOB_Sample" primary="true" start="74" end="74" startBytecode="48" endBytecode="48" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> + <SourceLine classname="AIOB_Sample" primary="true" start="74" end="74" startBytecode="49" endBytecode="49" sourcefile="AIOB_Sample.java" sourcepath="AIOB_Sample.java"> <Message>At AIOB_Sample.java:[line 74]</Message> </SourceLine> </BugInstance> @@ -946,7 +947,7 @@ <SourceLine classname="BAS_Sample" start="28" end="33" startBytecode="0" endBytecode="18" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> <Message>In method BAS_Sample.testFPForScope(String)</Message> </Method> - <LocalVariable name="o" register="2" pc="22" role="LOCAL_VARIABLE_NAMED"> + <LocalVariable name="o" register="2" pc="18" role="LOCAL_VARIABLE_NAMED"> <Message>Local variable named o</Message> </LocalVariable> <SourceLine classname="BAS_Sample" start="28" end="33" startBytecode="0" endBytecode="18" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java" synthetic="true"> @@ -968,7 +969,7 @@ <Message>In class BAS_Sample</Message> </Class> <Method classname="BAS_Sample" name="testFPSynchronized" signature="(Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;" isStatic="false" primary="true"> - <SourceLine classname="BAS_Sample" start="197" end="206" startBytecode="0" endBytecode="29" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> + <SourceLine classname="BAS_Sample" start="197" end="206" startBytecode="0" endBytecode="27" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> <Message>In method BAS_Sample.testFPSynchronized(String, String)</Message> </Method> <LocalVariable name="x" register="4" pc="11" role="LOCAL_VARIABLE_NAMED"> @@ -1122,7 +1123,7 @@ <Message>In class BAS_Sample</Message> </Class> <Method classname="BAS_Sample" name="testFPSynchronized" signature="(Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;" isStatic="false" primary="true"> - <SourceLine classname="BAS_Sample" start="197" end="206" startBytecode="0" endBytecode="227" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> + <SourceLine classname="BAS_Sample" start="197" end="206" startBytecode="0" endBytecode="223" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> <Message>In method BAS_Sample.testFPSynchronized(String, String)</Message> </Method> <SourceLine classname="BAS_Sample" primary="true" start="199" end="199" startBytecode="15" endBytecode="15" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> @@ -1139,7 +1140,7 @@ <Message>In class BAS_Sample</Message> </Class> <Method classname="BAS_Sample" name="testFPSync" signature="(Ljava/util/Set;Ljava/util/Set;)V" isStatic="false" primary="true"> - <SourceLine classname="BAS_Sample" start="99" end="107" startBytecode="0" endBytecode="286" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> + <SourceLine classname="BAS_Sample" start="99" end="107" startBytecode="0" endBytecode="282" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> <Message>In method BAS_Sample.testFPSync(Set, Set)</Message> </Method> <SourceLine classname="BAS_Sample" primary="true" start="99" end="99" startBytecode="4" endBytecode="4" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> @@ -1146,9 +1147,9 @@ <Message>At BAS_Sample.java:[line 99]</Message> </SourceLine> </BugInstance> - <BugInstance type="SPP_NON_USEFUL_TOSTRING" priority="3" rank="20" abbrev="SPP" category="STYLE" instanceHash="ecbf4c98733075e0dde7b18211f17145" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Method calls toString() on an instance of a class that hasn't overridden toString()</ShortMessage> - <LongMessage>Method BAS_Sample.tstFPRefChangeThruMethodChain(BAS_Sample$Holder, BAS_Sample$Holder, boolean) calls toString() on an instance of a class that hasn't overridden toString()</LongMessage> + <BugInstance type="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" priority="2" rank="18" abbrev="PRMC" category="PERFORMANCE" instanceHash="5dc78d66b9e0f5737cd0259c9b6a132b" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Method appears to call the same method on the same object redundantly</ShortMessage> + <LongMessage>Method BAS_Sample.testFPTwoCatches(List) appears to call the same method on the same object redundantly</LongMessage> <Class classname="BAS_Sample" primary="true"> <SourceLine classname="BAS_Sample" start="14" end="247" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> <Message>At BAS_Sample.java:[lines 14-247]</Message> @@ -1155,17 +1156,20 @@ </SourceLine> <Message>In class BAS_Sample</Message> </Class> - <Method classname="BAS_Sample" name="tstFPRefChangeThruMethodChain" signature="(LBAS_Sample$Holder;LBAS_Sample$Holder;Z)V" isStatic="false" primary="true"> - <SourceLine classname="BAS_Sample" start="143" end="149" startBytecode="0" endBytecode="135" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> - <Message>In method BAS_Sample.tstFPRefChangeThruMethodChain(BAS_Sample$Holder, BAS_Sample$Holder, boolean)</Message> + <Method classname="BAS_Sample" name="testFPTwoCatches" signature="(Ljava/util/List;)I" isStatic="false" primary="true"> + <SourceLine classname="BAS_Sample" start="241" end="247" startBytecode="0" endBytecode="251" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> + <Message>In method BAS_Sample.testFPTwoCatches(List)</Message> </Method> - <SourceLine classname="BAS_Sample" primary="true" start="143" end="143" startBytecode="1" endBytecode="1" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> - <Message>At BAS_Sample.java:[line 143]</Message> + <SourceLine classname="BAS_Sample" primary="true" start="247" end="247" startBytecode="65" endBytecode="65" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> + <Message>At BAS_Sample.java:[line 247]</Message> </SourceLine> + <String value="valueOf(Ljava/lang/Object;)Ljava/lang/String;"> + <Message>Value valueOf(Ljava/lang/Object;)Ljava/lang/String;</Message> + </String> </BugInstance> - <BugInstance type="UC_USELESS_VOID_METHOD" priority="1" rank="15" abbrev="UC" category="STYLE" instanceHash="1424a0c761589b4d991a1def4c01879b" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Useless non-empty void method</ShortMessage> - <LongMessage>Method BAS_Sample.testFPSync(Set, Set) seems to be useless</LongMessage> + <BugInstance type="SPP_NON_USEFUL_TOSTRING" priority="3" rank="20" abbrev="SPP" category="STYLE" instanceHash="ecbf4c98733075e0dde7b18211f17145" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Method calls toString() on an instance of a class that hasn't overridden toString()</ShortMessage> + <LongMessage>Method BAS_Sample.tstFPRefChangeThruMethodChain(BAS_Sample$Holder, BAS_Sample$Holder, boolean) calls toString() on an instance of a class that hasn't overridden toString()</LongMessage> <Class classname="BAS_Sample" primary="true"> <SourceLine classname="BAS_Sample" start="14" end="247" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> <Message>At BAS_Sample.java:[lines 14-247]</Message> @@ -1172,12 +1176,12 @@ </SourceLine> <Message>In class BAS_Sample</Message> </Class> - <Method classname="BAS_Sample" name="testFPSync" signature="(Ljava/util/Set;Ljava/util/Set;)V" isStatic="false" primary="true"> - <SourceLine classname="BAS_Sample" start="99" end="107" startBytecode="0" endBytecode="286" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> - <Message>In method BAS_Sample.testFPSync(Set, Set)</Message> + <Method classname="BAS_Sample" name="tstFPRefChangeThruMethodChain" signature="(LBAS_Sample$Holder;LBAS_Sample$Holder;Z)V" isStatic="false" primary="true"> + <SourceLine classname="BAS_Sample" start="143" end="149" startBytecode="0" endBytecode="135" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"/> + <Message>In method BAS_Sample.tstFPRefChangeThruMethodChain(BAS_Sample$Holder, BAS_Sample$Holder, boolean)</Message> </Method> - <SourceLine classname="BAS_Sample" primary="true" start="107" end="107" startBytecode="61" endBytecode="61" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> - <Message>At BAS_Sample.java:[line 107]</Message> + <SourceLine classname="BAS_Sample" primary="true" start="143" end="143" startBytecode="1" endBytecode="1" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> + <Message>At BAS_Sample.java:[line 143]</Message> </SourceLine> </BugInstance> <BugInstance type="UC_USELESS_VOID_METHOD" priority="2" rank="17" abbrev="UC" category="STYLE" instanceHash="29d93fb0574d2f180c00558ce250cbed" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -1239,13 +1243,13 @@ <ShortMessage>Class is defined in the default package</ShortMessage> <LongMessage>Class BAS_Sample$1 id defined in the default package</LongMessage> <Class classname="BAS_Sample$1" primary="true"> - <SourceLine classname="BAS_Sample$1" start="226" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> - <Message>At BAS_Sample.java:[lines 226-229]</Message> + <SourceLine classname="BAS_Sample$1" start="1" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> + <Message>At BAS_Sample.java:[lines 1-229]</Message> </SourceLine> <Message>In class BAS_Sample$1</Message> </Class> - <SourceLine classname="BAS_Sample$1" start="226" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java" synthetic="true"> - <Message>At BAS_Sample.java:[lines 226-229]</Message> + <SourceLine classname="BAS_Sample$1" start="1" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java" synthetic="true"> + <Message>At BAS_Sample.java:[lines 1-229]</Message> </SourceLine> </BugInstance> <BugInstance type="SIC_INNER_SHOULD_BE_STATIC_ANON" priority="3" rank="20" abbrev="SIC" category="PERFORMANCE" instanceHash="83cf1d144d99316e42805aface651c5c" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -1252,13 +1256,13 @@ <ShortMessage>Could be refactored into a named static inner class</ShortMessage> <LongMessage>The class BAS_Sample$1 could be refactored into a named _static_ inner class</LongMessage> <Class classname="BAS_Sample$1" primary="true"> - <SourceLine classname="BAS_Sample$1" start="226" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> - <Message>At BAS_Sample.java:[lines 226-229]</Message> + <SourceLine classname="BAS_Sample$1" start="1" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java"> + <Message>At BAS_Sample.java:[lines 1-229]</Message> </SourceLine> <Message>In class BAS_Sample$1</Message> </Class> - <SourceLine classname="BAS_Sample$1" start="226" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java" synthetic="true"> - <Message>At BAS_Sample.java:[lines 226-229]</Message> + <SourceLine classname="BAS_Sample$1" start="1" end="229" sourcefile="BAS_Sample.java" sourcepath="BAS_Sample.java" synthetic="true"> + <Message>At BAS_Sample.java:[lines 1-229]</Message> </SourceLine> </BugInstance> <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="ceca5a312a923c8a5513e31633fbce48" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -1297,8 +1301,8 @@ <ShortMessage>Method assigns a variable in a larger scope than is needed</ShortMessage> <LongMessage>Method BED_Sample.fpJustThrowIt(boolean, String) assigns a variable in a larger scope than is needed</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1314,8 +1318,8 @@ <ShortMessage>Non derivable method declares throwing an exception that isn't thrown</ShortMessage> <LongMessage>Non derivable method new BED_Sample() declares throwing an exception that isn't thrown</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1334,8 +1338,8 @@ <ShortMessage>Non derivable method declares throwing an exception that isn't thrown</ShortMessage> <LongMessage>Non derivable method BED_Sample.badFinal() declares throwing an exception that isn't thrown</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1354,13 +1358,13 @@ <ShortMessage>Non derivable method declares throwing an exception that isn't thrown</ShortMessage> <LongMessage>Non derivable method BED_Sample.badStatic() declares throwing an exception that isn't thrown</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> <Method classname="BED_Sample" name="badStatic" signature="()V" isStatic="true" primary="true"> - <SourceLine classname="BED_Sample" start="46" end="46" startBytecode="0" endBytecode="24" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"/> + <SourceLine classname="BED_Sample" start="46" end="46" startBytecode="0" endBytecode="32" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"/> <Message>In method BED_Sample.badStatic()</Message> </Method> <SourceLine classname="BED_Sample" primary="true" start="46" end="46" startBytecode="0" endBytecode="0" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> @@ -1374,8 +1378,8 @@ <ShortMessage>Non derivable method declares throwing an exception that isn't thrown</ShortMessage> <LongMessage>Non derivable method BED_Sample.badThrow() declares throwing an exception that isn't thrown</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1394,8 +1398,8 @@ <ShortMessage>Non derivable method declares throwing an exception that isn't thrown</ShortMessage> <LongMessage>Non derivable method BED_Sample.doIt() declares throwing an exception that isn't thrown</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1414,8 +1418,8 @@ <ShortMessage>Non derivable method declares throwing an exception that isn't thrown</ShortMessage> <LongMessage>Non derivable method BED_Sample.issue92a() declares throwing an exception that isn't thrown</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1434,13 +1438,13 @@ <ShortMessage>Non derivable method declares throwing an exception that isn't thrown</ShortMessage> <LongMessage>Non derivable method BED_Sample.issue92b() declares throwing an exception that isn't thrown</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> <Method classname="BED_Sample" name="issue92b" signature="()V" isStatic="true" primary="true"> - <SourceLine classname="BED_Sample" start="94" end="95" startBytecode="0" endBytecode="36" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"/> + <SourceLine classname="BED_Sample" start="94" end="95" startBytecode="0" endBytecode="44" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"/> <Message>In method BED_Sample.issue92b()</Message> </Method> <SourceLine classname="BED_Sample" primary="true" start="94" end="94" startBytecode="0" endBytecode="0" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> @@ -1454,8 +1458,8 @@ <ShortMessage>Method declares throwing two or more exceptions related by inheritance</ShortMessage> <LongMessage>Method BED_Sample.doesTheNasty() declares throwing two or more exceptions related by inheritance</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1474,8 +1478,8 @@ <ShortMessage>Method declares throwing two or more exceptions related by inheritance</ShortMessage> <LongMessage>Method BED_Sample.doesTheNasty2() declares throwing two or more exceptions related by inheritance</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1494,8 +1498,8 @@ <ShortMessage>This method needlessly uses a String literal as a Charset encoding</ShortMessage> <LongMessage>This method "String.getBytes(String)" needlessly uses a String literal to define an encoding. A built-in Charset could be used instead like: String.getBytes(Charset)</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1519,8 +1523,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to context in new BED_Sample(String)</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1542,8 +1546,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to is in BED_Sample.doIt()</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1565,8 +1569,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to is in BED_Sample.fp()</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1588,8 +1592,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to e in BED_Sample.fpThrowField(boolean)</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1611,8 +1615,8 @@ <ShortMessage>Code contains a hard coded reference to an absolute pathname</ShortMessage> <LongMessage>Hard coded reference to an absolute pathname in BED_Sample.doIt()</LongMessage> <Class classname="BED_Sample" primary="true"> - <SourceLine classname="BED_Sample" start="15" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> - <Message>At BED_Sample.java:[lines 15-105]</Message> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> </SourceLine> <Message>In class BED_Sample</Message> </Class> @@ -1631,8 +1635,8 @@ <ShortMessage>Code contains a hard coded reference to an absolute pathname</ShortMessage> <LongMessage>... [truncated message content] |
From: <dbr...@us...> - 2017-01-08 19:50:42
|
Revision: 1809 http://sourceforge.net/p/fb-contrib/code/1809 Author: dbrosius Date: 2017-01-08 19:50:36 +0000 (Sun, 08 Jan 2017) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/pom.xml trunk/fb-contrib/samples.xml trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/ImmutabilityType.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/MethodInfo.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CloneUsability.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflatingResourcesAndFiles.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HttpClientProblems.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JAXRSIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorMansEnum.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Unjitable.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseSplit.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseTryWithResources.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WiringIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/AttributesUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/CodeByteUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/FQMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/OpcodeUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/PublicAPI.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/QMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilder.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/StopOpcodeParsingException.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/ToString.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/UnmodifiableList.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/UnmodifiableSet.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/XClassUtils.java trunk/fb-contrib/src/samples/java/CAAL_Sample.java trunk/fb-contrib/src/samples/java/LO_Sample.java trunk/fb-contrib/src/samples/java/PCAIL_Sample.java trunk/fb-contrib/src/samples/java/SNG_Sample.java trunk/fb-contrib/src/samples/java/UCC_Sample.java trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilderTest.java trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-11-23 20:11:17 UTC (rev 1808) +++ trunk/fb-contrib/build.xml 2017-01-08 19:50:36 UTC (rev 1809) @@ -31,7 +31,7 @@ <property name="javac.debug" value="on" /> <property name="test_reports.dir" value="${target.dir}/reports/test"/> - <property name="fb-contrib.version" value="6.8.2" /> + <property name="fb-contrib.version" value="6.9.0-SNAPSHOT" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -249,7 +249,7 @@ <target name="javadoc" depends="-init" description="build the javadoc for the project"> <javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="fb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api" access="private"> <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> - <bottom><![CDATA[<i>Copyright © 2005-2016 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> + <bottom><![CDATA[<i>Copyright © 2005-2017 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> </javadoc> </target> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2016-11-23 20:11:17 UTC (rev 1808) +++ trunk/fb-contrib/etc/bugrank.txt 2017-01-08 19:50:36 UTC (rev 1809) @@ -55,7 +55,7 @@ +0 BugPattern FPL_FLOATING_POINT_LOOPS +6 BugPattern FP_FINAL_PARAMETERS +0 BugPattern HCP_HTTP_REQUEST_RESOURCES_NOT_FREED_FIELD -+0 BugPattern HCP_HTTP_REQUEST_RESOURCES_NOT_FREED_LOCAL ++4 BugPattern HCP_HTTP_REQUEST_RESOURCES_NOT_FREED_LOCAL +0 BugPattern HES_EXECUTOR_NEVER_SHUTDOWN +0 BugPattern HES_EXECUTOR_OVERWRITTEN_WITHOUT_SHUTDOWN +4 BugPattern HES_LOCAL_EXECUTOR_SERVICE Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-11-23 20:11:17 UTC (rev 1808) +++ trunk/fb-contrib/etc/findbugs.xml 2017-01-08 19:50:36 UTC (rev 1809) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -305,7 +305,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/> - <!-- COMMENT OUT FOR POINT RELEASE + <!-- COMMENT OUT FOR POINT RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/> @@ -313,7 +313,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnsynchronizedSingletonFieldWrites" speed="fast" reports="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES"/> - COMMENT OUT FOR POINT RELEASE --> + <!-- COMMENT OUT FOR POINT RELEASE --> <!-- BugPattern --> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2016-11-23 20:11:17 UTC (rev 1808) +++ trunk/fb-contrib/pom.xml 2017-01-08 19:50:36 UTC (rev 1809) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.8.2</version> + <version>6.9.0-SNAPSHOT</version> <prerequisites> <maven>2.2.1</maven> @@ -147,7 +147,7 @@ <dependency><scope>test</scope><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>19.0</version></dependency> <dependency><scope>test</scope><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.10</version></dependency> <dependency><scope>test</scope><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency> - <dependency><scope>test</scope><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.1</version></dependency> + <dependency><scope>test</scope><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.2</version></dependency> <dependency><scope>test</scope><groupId>javax.persistence</groupId><artifactId>persistence-api</artifactId><version>1.0.2</version></dependency> <dependency><scope>test</scope><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version></dependency> <dependency><scope>test</scope><groupId>javax.servlet.jsp</groupId><artifactId>javax.servlet.jsp-api</artifactId><version>2.3.1</version></dependency> Modified: trunk/fb-contrib/samples.xml =================================================================== --- trunk/fb-contrib/samples.xml 2016-11-23 20:11:17 UTC (rev 1808) +++ trunk/fb-contrib/samples.xml 2017-01-08 19:50:36 UTC (rev 1809) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<BugCollection version="3.0.1" sequence="0" timestamp="1479928382089" analysisTimestamp="1479928382559" release=""> +<BugCollection version="3.0.1" sequence="0" timestamp="1482370136475" analysisTimestamp="1482370136584" release=""> <Project projectName="Samples"> <Jar>/home/dave/dev/fb-contrib/target/classes/samples</Jar> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> @@ -2411,8 +2411,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(byte[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2428,8 +2428,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(char[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2445,8 +2445,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(double[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2462,8 +2462,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(float[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2479,8 +2479,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(int[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2496,8 +2496,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(long[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2513,8 +2513,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(short[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2530,8 +2530,8 @@ <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(boolean[]) calls Array.asList on an array of primitive values</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2547,8 +2547,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(byte[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2570,8 +2570,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(char[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2593,8 +2593,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(double[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2616,8 +2616,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(float[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2639,8 +2639,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(int[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2662,8 +2662,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(long[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2685,8 +2685,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(short[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2708,8 +2708,8 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(boolean[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2727,25 +2727,65 @@ <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.METHOD_RESULT" value="true"/> <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.NO_LOADS" value="true"/> </BugInstance> + <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="2" rank="17" abbrev="DLS" category="STYLE" instanceHash="1ab25098c41073065701f266e4d406e2" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563"> + <ShortMessage>Dead store to local variable</ShortMessage> + <LongMessage>Dead store to l in CAAL_Sample.testFPTwoArrays(char[], char[])</LongMessage> + <Class classname="CAAL_Sample" primary="true"> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> + </SourceLine> + <Message>In class CAAL_Sample</Message> + </Class> + <Method classname="CAAL_Sample" name="testFPTwoArrays" signature="([C[C)V" isStatic="false" primary="true"> + <SourceLine classname="CAAL_Sample" start="39" end="40" startBytecode="0" endBytecode="12" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"/> + <Message>In method CAAL_Sample.testFPTwoArrays(char[], char[])</Message> + </Method> + <LocalVariable name="l" register="3" pc="16" role="LOCAL_VARIABLE_NAMED"> + <Message>Local variable named l</Message> + </LocalVariable> + <SourceLine classname="CAAL_Sample" primary="true" start="39" end="39" startBytecode="15" endBytecode="15" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[line 39]</Message> + </SourceLine> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.LOCAL_NAME" value="l"/> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.METHOD_RESULT" value="true"/> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.NO_LOADS" value="true"/> + </BugInstance> <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="19beeeeb2dfcc042c1566c86a435e725" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Class is defined in the default package</ShortMessage> <LongMessage>Class CAAL_Sample id defined in the default package</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java" synthetic="true"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java" synthetic="true"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> </BugInstance> + <BugInstance type="UC_USELESS_VOID_METHOD" priority="2" rank="17" abbrev="UC" category="STYLE" instanceHash="c759550e89df4882282f9ca5ddfdd0ce" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Useless non-empty void method</ShortMessage> + <LongMessage>Method CAAL_Sample.testFPTwoArrays(char[], char[]) seems to be useless</LongMessage> + <Class classname="CAAL_Sample" primary="true"> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> + </SourceLine> + <Message>In class CAAL_Sample</Message> + </Class> + <Method classname="CAAL_Sample" name="testFPTwoArrays" signature="([C[C)V" isStatic="false" primary="true"> + <SourceLine classname="CAAL_Sample" start="39" end="40" startBytecode="0" endBytecode="92" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"/> + <Message>In method CAAL_Sample.testFPTwoArrays(char[], char[])</Message> + </Method> + <SourceLine classname="CAAL_Sample" primary="true" start="40" end="40" startBytecode="16" endBytecode="16" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[line 40]</Message> + </SourceLine> + </BugInstance> <BugInstance type="UC_USELESS_VOID_METHOD" priority="3" rank="20" abbrev="UC" category="STYLE" instanceHash="e92a7f41ad84b74f0eabea017d590ff9" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(byte[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2761,8 +2801,8 @@ <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(char[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2778,8 +2818,8 @@ <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(double[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2795,8 +2835,8 @@ <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(float[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2812,8 +2852,8 @@ <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(int[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2829,8 +2869,8 @@ <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(long[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2846,8 +2886,8 @@ <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(short[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2863,8 +2903,8 @@ <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(boolean[]) seems to be useless</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2880,8 +2920,8 @@ <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(double[]) defines parameter list with array as last argument, rather than vararg</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2897,8 +2937,8 @@ <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(float[]) defines parameter list with array as last argument, rather than vararg</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2914,8 +2954,8 @@ <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(int[]) defines parameter list with array as last argument, rather than vararg</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2931,8 +2971,8 @@ <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(long[]) defines parameter list with array as last argument, rather than vararg</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2948,8 +2988,8 @@ <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(short[]) defines parameter list with array as last argument, rather than vararg</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2965,8 +3005,8 @@ <ShortMessage>Method defines parameter list with array as last argument, rather than vararg</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(boolean[]) defines parameter list with array as last argument, rather than vararg</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -2982,8 +3022,8 @@ <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>byte[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(byte[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -3006,8 +3046,8 @@ <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>char[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(char[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -3030,8 +3070,8 @@ <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>double[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(double[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -3054,8 +3094,8 @@ <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>float[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(float[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -3078,8 +3118,8 @@ <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>int[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(int[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -3102,8 +3142,8 @@ <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>long[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(long[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -3126,8 +3166,8 @@ <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>short[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(short[])</LongMessage> <Class classname="CAAL_Sample" primary="true"> - <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> - <Message>At CAAL_Sample.java:[lines 4-36]</Message> + <SourceLine classname="CAAL_Sample" start="4" end="40" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-40]</Message> </SourceLine> <Message>In class CAAL_Sample</Message> </Class> @@ -10221,7 +10261,7 @@ <Message>At JXI_Sample.java:[line 23]</Message> </SourceLine> </BugInstance> - <BugInstance type="JXI_INVALID_CONTEXT_PARAMETER_TYPE" priority="2" rank="7" abbrev="JXI" category="CORRECTNESS" instanceHash="4b1009a33e61042fb3b4566101c82906" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="JXI_INVALID_CONTEXT_PARAMETER_TYPE" priority="2" rank="7" abbrev="JXI" category="CORRECTNESS" instanceHash="298f091f09789a4ddc54546245159bc1" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>JAX-RS Method specifies an invalid @Context parameter type</ShortMessage> <LongMessage>JAX-RS JXI_Sample.stuffWithBadContext(InputStream) Method specifies an invalid @Context parameter type</LongMessage> <Class classname="JXI_Sample" primary="true"> @@ -10234,14 +10274,14 @@ <SourceLine classname="JXI_Sample" start="41" end="41" startBytecode="0" endBytecode="58" sourcefile="JXI_Sample.java" sourcepath="JXI_Sample.java"/> <Message>In method JXI_Sample.stuffWithBadContext(InputStream)</Message> </Method> - <String value="Ljava/io/InputStream;"> - <Message>Value Ljava/io/InputStream;</Message> + <String value="Parameter signature: Ljava/io/InputStream;"> + <Message>Value Parameter signature: Ljava/io/InputStream;</Message> </String> <SourceLine classname="JXI_Sample" start="41" end="41" startBytecode="0" endBytecode="58" sourcefile="JXI_Sample.java" sourcepath="JXI_Sample.java" synthetic="true"> <Message>At JXI_Sample.java:[line 41]</Message> </SourceLine> </BugInstance> - <BugInstance type="JXI_PARM_PARAM_NOT_FOUND_IN_PATH" priority="2" rank="7" abbrev="JXI" category="CORRECTNESS" instanceHash="eff341939209229399f87602d8a058ec" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="JXI_PARM_PARAM_NOT_FOUND_IN_PATH" priority="2" rank="7" abbrev="JXI" category="CORRECTNESS" instanceHash="85815c88ab5fce47b3626c9bce6ee689" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>JAX-RS Method specifies non-resolveable @PathParam</ShortMessage> <LongMessage>JAX-RS Method JXI_Sample.mismatchParm(String) specifies non-resolveable @PathParam</LongMessage> <Class classname="JXI_Sample" primary="true"> @@ -10254,14 +10294,14 @@ <SourceLine classname="JXI_Sample" start="35" end="35" startBytecode="0" endBytecode="58" sourcefile="JXI_Sample.java" sourcepath="JXI_Sample.java"/> <Message>In method JXI_Sample.mismatchParm(String)</Message> </Method> - <String value="bad"> - <Message>Value bad</Message> + <String value="Path param: bad"> + <Message>Value Path param: bad</Message> </String> <SourceLine classname="JXI_Sample" start="35" end="35" startBytecode="0" endBytecode="58" sourcefile="JXI_Sample.java" sourcepath="JXI_Sample.java" synthetic="true"> <Message>At JXI_Sample.java:[line 35]</Message> </SourceLine> </BugInstance> - <BugInstance type="JXI_UNDEFINED_PARAMETER_SOURCE_IN_ENDPOINT" priority="2" rank="7" abbrev="JXI" category="CORRECTNESS" instanceHash="649996d3503c931e927e0f60fe9ae390" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <BugInstance type="JXI_UNDEFINED_PARAMETER_SOURCE_IN_ENDPOINT" priority="2" rank="7" abbrev="JXI" category="CORRECTNESS" instanceHash="ffc8e4034e0d3dc0fdd03414292cfcca" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>JAX-RS Method defines a parameter that has no @*Param or @Context annotation, or @Consumes method annotation</ShortMessage> <LongMessage>JAX-RS Method JXI_Sample.stufStuff(String, JXI_Sample$Stuff) defines a parameter that has no @*Param or @Context annotation, or @Consumes method annotation</LongMessage> <Class classname="JXI_Sample" primary="true"> @@ -10274,8 +10314,8 @@ <SourceLine classname="JXI_Sample" start="29" end="29" startBytecode="0" endBytecode="68" sourcefile="JXI_Sample.java" sourcepath="JXI_Sample.java"/> <Message>In method JXI_Sample.stufStuff(String, JXI_Sample$Stuff)</Message> </Method> - <String value="Parameter 11"> - <Message>Value Parameter 11</Message> + <String value="Parameter 2"> + <Message>Value Parameter 2</Message> </String> <SourceLine classname="JXI_Sample" start="29" end="29" startBytecode="0" endBytecode="68" sourcefile="JXI_Sample.java" sourcepath="JXI_Sample.java" synthetic="true"> <Message>At JXI_Sample.java:[line 29]</Message> @@ -21439,13 +21479,13 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to u in PCAIL_Sample.fpPutField()</LongMessage> <Class classname="PCAIL_Sample" primary="true"> - <SourceLine classname="PCAIL_Sample" start="8" end="143" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"> - <Message>At PCAIL_Sample.java:[lines 8-143]</Message> + <SourceLine classname="PCAIL_Sample" start="8" end="158" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"> + <Message>At PCAIL_Sample.java:[lines 8-158]</Message> </SourceLine> <Message>In class PCAIL_Sample</Message> </Class> <Method classname="PCAIL_Sample" name="fpPutField" signature="()V" isStatic="false" primary="true"> - <SourceLine classname="PCAIL_Sample" start="19" end="25" startBytecode="0" endBytecode="21" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"/> + <SourceLine classname="PCAIL_Sample" start="19" end="26" startBytecode="0" endBytecode="21" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"/> <Message>In method PCAIL_Sample.fpPutField()</Message> </Method> <LocalVariable name="u" register="3" pc="23" role="LOCAL_VARIABLE_NAMED"> @@ -21463,20 +21503,20 @@ <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to u in PCAIL_Sample.fpTwoRegs()</LongMessage> <Class classname="PCAIL_Sample" primary="true"> - <SourceLine classname="PCAIL_Sample" start="8" end="143" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"> - <Message>At PCAIL_Sample.java:[lines 8-143]</Message> + <SourceLine classname="PCAIL_Sample" start="8" end="158" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"> + <Message>At PCAIL_Sample.java:[lines 8-158]</Message> </SourceLine> <Message>In class PCAIL_Sample</Message> </Class> <Method classname="PCAIL_Sample" name="fpTwoRegs" signature="()V" isStatic="false" primary="true"> - <SourceLine classname="PCAIL_Sample" start="28" end="33" startBytecode="0" endBytecode="18" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"/> + <SourceLine classname="PCAIL_Sample" start="29" end="34" startBytecode="0" endBytecode="18" sourcefile="PCAIL_Sample.java" sourcepath="PCAIL_Sample.java"/> <Message>In method PCAIL_Sample.fpTwoRegs()</Message> </Method> ... [truncated message content] |
From: <dbr...@us...> - 2016-11-23 20:11:19
|
Revision: 1808 http://sourceforge.net/p/fb-contrib/code/1808 Author: dbrosius Date: 2016-11-23 20:11:17 +0000 (Wed, 23 Nov 2016) Log Message: ----------- Version 6.8.2 Added Paths: ----------- tags/v6_8_2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-11-23 20:08:49
|
Revision: 1807 http://sourceforge.net/p/fb-contrib/code/1807 Author: dbrosius Date: 2016-11-23 20:08:45 +0000 (Wed, 23 Nov 2016) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt 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.xml trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilder.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/RegisterUtilsTest.java Added Paths: ----------- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java trunk/fb-contrib/src/samples/java/USFW_Sample.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/build.xml 2016-11-23 20:08:45 UTC (rev 1807) @@ -31,7 +31,7 @@ <property name="javac.debug" value="on" /> <property name="test_reports.dir" value="${target.dir}/reports/test"/> - <property name="fb-contrib.version" value="6.8.1" /> + <property name="fb-contrib.version" value="6.8.2" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -109,6 +109,9 @@ <pathelement location="${lib.dir}/testng-${testng.version}.jar" /> <pathelement location="${lib.dir}/jcommander-${jcommander.version}.jar" /> <pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" /> + <pathelement location="${findbugs.dir}/lib/dom4j-1.6.1.jar" /> + <pathelement location="${findbugs.dir}/lib/jaxen-1.1.6.jar" /> + </path> <path id="fb-contrib.samples.classpath"> <pathelement location="${lib.dir}/javax.servlet.jsp-api-${javax.servlet.jsp-api.version}.jar" /> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/etc/bugrank.txt 2016-11-23 20:08:45 UTC (rev 1807) @@ -238,6 +238,7 @@ +0 BugPattern URV_INHERITED_METHOD_WITH_RELATED_TYPES +0 BugPattern URV_UNRELATED_RETURN_VALUES +0 BugPattern USBR_UNNECESSARY_STORE_BEFORE_RETURN ++0 BugPattern USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES +0 BugPattern USS_USE_STRING_SPLIT +0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT +0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_ASSERT_USED Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/etc/findbugs.xml 2016-11-23 20:08:45 UTC (rev 1807) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -311,8 +311,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousShadedClassUse" speed="fast" reports="SSCU_SUSPICIOUS_SHADED_CLASS_USE"/> - COMMENT OUT FOR POINT RELEASE --> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnsynchronizedSingletonFieldWrites" speed="fast" reports="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES"/> + COMMENT OUT FOR POINT RELEASE --> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -582,4 +584,5 @@ <BugPattern abbrev="CCI" type="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY" category="CORRECTNESS"/> <BugPattern abbrev="UTWR" type="UTWR_USE_TRY_WITH_RESOURCES" category="STYLE" experimental="true"/> <BugPattern abbrev="SSCU" type="SSCU_SUSPICIOUS_SHADED_CLASS_USE" category="CORRECTNESS" experimental="true"/> + <BugPattern abbrev="USFW" type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES" category="CORRECTNESS" experimental="true"/> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/etc/messages.xml 2016-11-23 20:08:45 UTC (rev 1807) @@ -1665,6 +1665,16 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnsynchronizedSingletonFieldWrites"> + <Details> + <![CDATA[ + <p>Looks for writes to fields of classes that are believed to be classes used only as Singletons. These + classes include Enums, as well as spring beans that are Singleton scoped.</p> + <p>It is a fast detector.</p> + ]]> + </Details> + </Detector> + <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger"> <Details></Details> </Detector> @@ -5679,6 +5689,17 @@ ]]> </Details> </BugPattern> + + <BugPattern type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES"> + <ShortDescription>Method of Singleton class writes to a field in an unsynchronized manner</ShortDescription> + <LongDescription>Method {1} of Singleton class writes to a field in an unsynchronized manner</LongDescription> + <Details> + <![CDATA[ + <p>This method writes to a field of this class. Since this class is seen as a Singleton this can produce race + conditions, or cause non-visible changes to other threads, because the field isn't accessed synchronously. + ]]> + </Details> + </BugPattern> <!-- BugCode --> @@ -5819,4 +5840,5 @@ <BugCode abbrev="CCI">Concurrent Collection Issues</BugCode> <BugCode abbrev="UTWR">Use Try With Resources</BugCode> <BugCode abbrev="SSCU">Suspicious Shaded Class Use</BugCode> + <BugCode abbrev="USFW">Unsynchronous Singleton Field Writes</BugCode> </MessageCollection> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/htdocs/index.shtml 2016-11-23 20:08:45 UTC (rev 1807) @@ -68,7 +68,7 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.1 available for download + <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.2 available for download <a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p> <p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p> <p style="font-weight: bold;">Please note that active development for this project is now done on Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/htdocs/repository.html 2016-11-23 20:08:45 UTC (rev 1807) @@ -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.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>6.8.1</td></tr> + <tr><td><b>Version:</b></td><td>6.8.2</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/pom.xml 2016-11-23 20:08:45 UTC (rev 1807) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.8.1</version> + <version>6.8.2</version> <prerequisites> <maven>2.2.1</maven> Modified: trunk/fb-contrib/samples.xml =================================================================== --- trunk/fb-contrib/samples.xml 2016-11-18 03:39:38 UTC (rev 1806) +++ trunk/fb-contrib/samples.xml 2016-11-23 20:08:45 UTC (rev 1807) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<BugCollection version="3.0.1" sequence="0" timestamp="1479256649283" analysisTimestamp="1479256649381" release=""> +<BugCollection version="3.0.1" sequence="0" timestamp="1479928382089" analysisTimestamp="1479928382559" release=""> <Project projectName="Samples"> <Jar>/home/dave/dev/fb-contrib/target/classes/samples</Jar> <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> @@ -1516,6 +1516,29 @@ <Message>Called method String.getBytes(Charset)</Message> </Method> </BugInstance> + <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="1" rank="15" abbrev="DLS" category="STYLE" instanceHash="79def569ec98541fd73e544709b9ac25" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563"> + <ShortMessage>Dead store to local variable</ShortMessage> + <LongMessage>Dead store to context in new BED_Sample(String)</LongMessage> + <Class classname="BED_Sample" primary="true"> + <SourceLine classname="BED_Sample" start="18" end="105" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[lines 18-105]</Message> + </SourceLine> + <Message>In class BED_Sample</Message> + </Class> + <Method classname="BED_Sample" name="<init>" signature="(Ljava/lang/String;)V" isStatic="false" primary="true"> + <SourceLine classname="BED_Sample" start="22" end="26" startBytecode="0" endBytecode="16" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"/> + <Message>In method new BED_Sample(String)</Message> + </Method> + <LocalVariable name="context" register="3" pc="29" role="LOCAL_VARIABLE_NAMED"> + <Message>Local variable named context</Message> + </LocalVariable> + <SourceLine classname="BED_Sample" primary="true" start="25" end="25" startBytecode="28" endBytecode="28" sourcefile="BED_Sample.java" sourcepath="BED_Sample.java"> + <Message>At BED_Sample.java:[line 25]</Message> + </SourceLine> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.DEAD_OBJECT_STORE" value="true"/> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.LOCAL_NAME" value="context"/> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.METHOD_RESULT" value="true"/> + </BugInstance> <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="1" rank="15" abbrev="DLS" category="STYLE" instanceHash="d9c72c4d31bddfd053659d13b086adf2" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563"> <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to is in BED_Sample.doIt()</LongMessage> @@ -2401,6 +2424,23 @@ <Message>At CAAL_Sample.java:[line 15]</Message> </SourceLine> </BugInstance> + <BugInstance type="CAAL_CONFUSING_ARRAY_AS_LIST" priority="2" rank="7" abbrev="CAAL" category="CORRECTNESS" instanceHash="3975618977829f30228696fd98eda368" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> + <LongMessage>Method CAAL_Sample.testCAAL(char[]) calls Array.asList on an array of primitive values</LongMessage> + <Class classname="CAAL_Sample" primary="true"> + <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-36]</Message> + </SourceLine> + <Message>In class CAAL_Sample</Message> + </Class> + <Method classname="CAAL_Sample" name="testCAAL" signature="([C)V" isStatic="false" primary="true"> + <SourceLine classname="CAAL_Sample" start="11" end="12" startBytecode="0" endBytecode="78" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"/> + <Message>In method CAAL_Sample.testCAAL(char[])</Message> + </Method> + <SourceLine classname="CAAL_Sample" primary="true" start="11" end="11" startBytecode="8" endBytecode="8" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[line 11]</Message> + </SourceLine> + </BugInstance> <BugInstance type="CAAL_CONFUSING_ARRAY_AS_LIST" priority="2" rank="7" abbrev="CAAL" category="CORRECTNESS" instanceHash="9130cff189697a73dc4c8b172b28e88f" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method calls Array.asList on an array of primitive values</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(double[]) calls Array.asList on an array of primitive values</LongMessage> @@ -2526,6 +2566,29 @@ <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.METHOD_RESULT" value="true"/> <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.NO_LOADS" value="true"/> </BugInstance> + <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="2" rank="17" abbrev="DLS" category="STYLE" instanceHash="8d45810983ce3547c197ddc3bd02a09a" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563"> + <ShortMessage>Dead store to local variable</ShortMessage> + <LongMessage>Dead store to l in CAAL_Sample.testCAAL(char[])</LongMessage> + <Class classname="CAAL_Sample" primary="true"> + <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-36]</Message> + </SourceLine> + <Message>In class CAAL_Sample</Message> + </Class> + <Method classname="CAAL_Sample" name="testCAAL" signature="([C)V" isStatic="false" primary="true"> + <SourceLine classname="CAAL_Sample" start="11" end="12" startBytecode="0" endBytecode="8" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"/> + <Message>In method CAAL_Sample.testCAAL(char[])</Message> + </Method> + <LocalVariable name="l" register="2" pc="12" role="LOCAL_VARIABLE_NAMED"> + <Message>Local variable named l</Message> + </LocalVariable> + <SourceLine classname="CAAL_Sample" primary="true" start="11" end="11" startBytecode="11" endBytecode="11" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[line 11]</Message> + </SourceLine> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.LOCAL_NAME" value="l"/> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.METHOD_RESULT" value="true"/> + <Property name="edu.umd.cs.findbugs.detect.DeadLocalStoreProperty.NO_LOADS" value="true"/> + </BugInstance> <BugInstance type="DLS_DEAD_LOCAL_STORE" priority="2" rank="17" abbrev="DLS" category="STYLE" instanceHash="16a66803b6865903daa61b77c398f1ae" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="563"> <ShortMessage>Dead store to local variable</ShortMessage> <LongMessage>Dead store to l in CAAL_Sample.testCAAL(double[])</LongMessage> @@ -2694,6 +2757,23 @@ <Message>At CAAL_Sample.java:[line 16]</Message> </SourceLine> </BugInstance> + <BugInstance type="UC_USELESS_VOID_METHOD" priority="3" rank="20" abbrev="UC" category="STYLE" instanceHash="24df9110e0ec9d2b233d21bf82af853d" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Useless non-empty void method</ShortMessage> + <LongMessage>Method CAAL_Sample.testCAAL(char[]) seems to be useless</LongMessage> + <Class classname="CAAL_Sample" primary="true"> + <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-36]</Message> + </SourceLine> + <Message>In class CAAL_Sample</Message> + </Class> + <Method classname="CAAL_Sample" name="testCAAL" signature="([C)V" isStatic="false" primary="true"> + <SourceLine classname="CAAL_Sample" start="11" end="12" startBytecode="0" endBytecode="78" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"/> + <Message>In method CAAL_Sample.testCAAL(char[])</Message> + </Method> + <SourceLine classname="CAAL_Sample" primary="true" start="12" end="12" startBytecode="12" endBytecode="12" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[line 12]</Message> + </SourceLine> + </BugInstance> <BugInstance type="UC_USELESS_VOID_METHOD" priority="3" rank="20" abbrev="UC" category="STYLE" instanceHash="c04ebe3ef7884c235addb6c48bd5d1f9" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Useless non-empty void method</ShortMessage> <LongMessage>Method CAAL_Sample.testCAAL(double[]) seems to be useless</LongMessage> @@ -2922,6 +3002,30 @@ <Message>At CAAL_Sample.java:[line 15]</Message> </SourceLine> </BugInstance> + <BugInstance type="VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG" priority="1" rank="7" abbrev="VA" category="CORRECTNESS" instanceHash="17bf4f8f0183d1e020ae2fd1b0821168" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> + <LongMessage>char[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(char[])</LongMessage> + <Class classname="CAAL_Sample" primary="true"> + <SourceLine classname="CAAL_Sample" start="4" end="36" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[lines 4-36]</Message> + </SourceLine> + <Message>In class CAAL_Sample</Message> + </Class> + <Method classname="CAAL_Sample" name="testCAAL" signature="([C)V" isStatic="false" primary="true"> + <SourceLine classname="CAAL_Sample" start="11" end="12" startBytecode="0" endBytecode="78" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"/> + <Message>In method CAAL_Sample.testCAAL(char[])</Message> + </Method> + <Type descriptor="[C" role="TYPE_FOUND"> + <Message>Actual type char[]</Message> + </Type> + <Method classname="java.util.Arrays" name="asList" signature="([Ljava/lang/Object;)Ljava/util/List;" isStatic="true" role="METHOD_CALLED"> + <SourceLine classname="java.util.Arrays" start="3800" end="3800" startBytecode="0" endBytecode="32" sourcefile="Arrays.java" sourcepath="java/util/Arrays.java"/> + <Message>Called method java.util.Arrays.asList(Object[])</Message> + </Method> + <SourceLine classname="CAAL_Sample" primary="true" start="11" end="11" startBytecode="8" endBytecode="8" sourcefile="CAAL_Sample.java" sourcepath="CAAL_Sample.java"> + <Message>At CAAL_Sample.java:[line 11]</Message> + </SourceLine> + </BugInstance> <BugInstance type="VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG" priority="1" rank="7" abbrev="VA" category="CORRECTNESS" instanceHash="c2a4b2be51b7ea4a120c2699541e106f" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Primitive array passed to function expecting a variable number of object arguments</ShortMessage> <LongMessage>double[] passed to varargs method java.util.Arrays.asList(Object[]) in CAAL_Sample.testCAAL(double[])</LongMessage> @@ -3257,14 +3361,14 @@ <Message>In class CAO_Sample</Message> </Class> <Method classname="CAO_Sample" name="testci" signature="(I)V" isStatic="false" primary="true"> - <SourceLine classname="CAO_Sample" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java"/> + <SourceLine classname="CAO_Sample" start="8" end="9" startBytecode="0" endBytecode="64" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java"/> <Message>In method CAO_Sample.testci(int)</Message> </Method> <String value="- Method declared public but could be declared private"> <Message>Value - Method declared public but could be declared private</Message> </String> - <SourceLine classname="CAO_Sample" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java" synthetic="true"> - <Message>In CAO_Sample.java</Message> + <SourceLine classname="CAO_Sample" start="8" end="9" startBytecode="0" endBytecode="64" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java" synthetic="true"> + <Message>At CAO_Sample.java:[lines 8-9]</Message> </SourceLine> </BugInstance> <BugInstance type="OPM_OVERLY_PERMISSIVE_METHOD" priority="3" rank="20" abbrev="OPM" category="STYLE" instanceHash="ade4bec616aadf73e7d58c481278d97e" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -3277,14 +3381,14 @@ <Message>In class CAO_Sample</Message> </Class> <Method classname="CAO_Sample" name="testcj" signature="(J)V" isStatic="false" primary="true"> - <SourceLine classname="CAO_Sample" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java"/> + <SourceLine classname="CAO_Sample" start="16" end="17" startBytecode="0" endBytecode="64" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java"/> <Message>In method CAO_Sample.testcj(long)</Message> </Method> <String value="- Method declared public but could be declared private"> <Message>Value - Method declared public but could be declared private</Message> </String> - <SourceLine classname="CAO_Sample" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java" synthetic="true"> - <Message>In CAO_Sample.java</Message> + <SourceLine classname="CAO_Sample" start="16" end="17" startBytecode="0" endBytecode="64" sourcefile="CAO_Sample.java" sourcepath="CAO_Sample.java" synthetic="true"> + <Message>At CAO_Sample.java:[lines 16-17]</Message> </SourceLine> </BugInstance> <BugInstance type="CBC_CONTAINS_BASED_CONDITIONAL" priority="2" rank="17" abbrev="CBC" category="STYLE" instanceHash="9fa3a87f741346028d7886158f00bdae" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -9488,23 +9592,6 @@ <Message>At ISB_Sample.java:[line 87]</Message> </SourceLine> </BugInstance> - <BugInstance type="UPM_UNCALLED_PRIVATE_METHOD" priority="3" rank="20" abbrev="UPM" category="PERFORMANCE" instanceHash="bb44e2770c499a3b25207bc8b824abb2" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Private method is never called</ShortMessage> - <LongMessage>Private method ISB_Sample.getBigger(String, String) is never called</LongMessage> - <Class classname="ISB_Sample" primary="true"> - <SourceLine classname="ISB_Sample" start="5" end="127" sourcefile="ISB_Sample.java" sourcepath="ISB_Sample.java"> - <Message>At ISB_Sample.java:[lines 5-127]</Message> - </SourceLine> - <Message>In class ISB_Sample</Message> - </Class> - <Method classname="ISB_Sample" name="getBigger" signature="(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;" isStatic="true" primary="true"> - <SourceLine classname="ISB_Sample" start="100" end="102" startBytecode="0" endBytecode="83" sourcefile="ISB_Sample.java" sourcepath="ISB_Sample.java"/> - <Message>In method ISB_Sample.getBigger(String, String)</Message> - </Method> - <SourceLine classname="ISB_Sample" start="100" end="102" startBytecode="0" endBytecode="83" sourcefile="ISB_Sample.java" sourcepath="ISB_Sample.java" synthetic="true"> - <Message>At ISB_Sample.java:[lines 100-102]</Message> - </SourceLine> - </BugInstance> <BugInstance type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" priority="2" rank="17" abbrev="USBR" category="STYLE" instanceHash="ac5afe94dd68746f7b2d7ef7adcf0c9e" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Method stores return result in local before immediately returning it</ShortMessage> <LongMessage>Method ISB_Sample.testISB8() stores return result in local before immediately returning it</LongMessage> @@ -11270,6 +11357,23 @@ <Message>Value LO_Sample</Message> </String> </BugInstance> + <BugInstance type="LO_SUSPECT_LOG_PARAMETER" priority="2" rank="7" abbrev="LO" category="CORRECTNESS" instanceHash="9b05ba81d400239efa6dc9159d301831" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Constructor declares a Logger parameter</ShortMessage> + <LongMessage>Constructor new LO_Sample(Logger) declares a Logger parameter</LongMessage> + <Class classname="LO_Sample" primary="true"> + <SourceLine classname="LO_Sample" start="15" end="129" sourcefile="LO_Sample.java" sourcepath="LO_Sample.java"> + <Message>At LO_Sample.java:[lines 15-129]</Message> + </SourceLine> + <Message>In class LO_Sample</Message> + </Class> + <Method classname="LO_Sample" name="<init>" signature="(Lorg/apache/log4j/Logger;)V" isStatic="false" primary="true"> + <SourceLine classname="LO_Sample" start="38" end="40" startBytecode="0" endBytecode="69" sourcefile="LO_Sample.java" sourcepath="LO_Sample.java"/> + <Message>In method new LO_Sample(Logger)</Message> + </Method> + <SourceLine classname="LO_Sample" start="38" end="40" startBytecode="0" endBytecode="69" sourcefile="LO_Sample.java" sourcepath="LO_Sample.java" synthetic="true"> + <Message>At LO_Sample.java:[lines 38-40]</Message> + </SourceLine> + </BugInstance> <BugInstance type="NP_ALWAYS_NULL_EXCEPTION" priority="1" rank="7" abbrev="NP" category="CORRECTNESS" instanceHash="9e480fcdab07a3541fb8d0e22bcd9be4" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="476"> <ShortMessage>Null pointer dereference in method on exception path</ShortMessage> <LongMessage>Null pointer dereference of is in LO_Sample.testStutter() on exception path</LongMessage> @@ -11339,14 +11443,14 @@ <Message>In class LO_Sample</Message> </Class> <Method classname="LO_Sample" name="<init>" signature="(Lorg/apache/log4j/Logger;)V" isStatic="false" primary="true"> - <SourceLine classname="LO_Sample" sourcefile="LO_Sample.java" sourcepath="LO_Sample.java"/> + <SourceLine classname="LO_Sample" start="38" end="40" startBytecode="0" endBytecode="69" sourcefile="LO_Sample.java" sourcepath="LO_Sample.java"/> <Message>In method new LO_Sample(Logger)</Message> </Method> <String value="- Method declared public but could be declared private"> <Message>Value - Method declared public but could be declared private</Message> </String> - <SourceLine classname="LO_Sample" sourcefile="LO_Sample.java" sourcepath="LO_Sample.java" synthetic="true"> - <Message>In LO_Sample.java</Message> + <SourceLine classname="LO_Sample" start="38" end="40" startBytecode="0" endBytecode="69" sourcefile="LO_Sample.java" sourcepath="LO_Sample.java" synthetic="true"> + <Message>At LO_Sample.java:[lines 38-40]</Message> </SourceLine> </BugInstance> <BugInstance type="OS_OPEN_STREAM" priority="2" rank="16" abbrev="OS" category="BAD_PRACTICE" instanceHash="fb704331445d9f9d7a142368140da5ab" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> @@ -21751,6 +21855,26 @@ <Message>At PCOA_Sample.java:[lines 3-30]</Message> </SourceLine> </BugInstance> + <BugInstance type="OPM_OVERLY_PERMISSIVE_METHOD" priority="3" rank="20" abbrev="OPM" category="STYLE" instanceHash="fd022969c43d0b90018ba04d6bae5023" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>This method is declared more permissively than is used in the code base</ShortMessage> + <LongMessage>This method PCOA_Sample.nonOverridableMethod() is declared more permissively than is used in the code base</LongMessage> + <Class classname="PCOA_Sample" primary="true"> + <SourceLine classname="PCOA_Sample" start="3" end="30" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java"> + <Message>At PCOA_Sample.java:[lines 3-30]</Message> + </SourceLine> + <Message>In class PCOA_Sample</Message> + </Class> + <Method classname="PCOA_Sample" name="nonOverridableMethod" signature="()V" isStatic="false" primary="true"> + <SourceLine classname="PCOA_Sample" start="26" end="26" startBytecode="0" endBytecode="42" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java"/> + <Message>In method PCOA_Sample.nonOverridableMethod()</Message> + </Method> + <String value="- Method declared public but could be declared private"> + <Message>Value - Method declared public but could be declared private</Message> + </String> + <SourceLine classname="PCOA_Sample" start="26" end="26" startBytecode="0" endBytecode="42" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java" synthetic="true"> + <Message>At PCOA_Sample.java:[line 26]</Message> + </SourceLine> + </BugInstance> <BugInstance type="OPM_OVERLY_PERMISSIVE_METHOD" priority="3" rank="20" abbrev="OPM" category="STYLE" instanceHash="91ab82fc9f135956756569048b3528e1" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>This method is declared more permissively than is used in the code base</ShortMessage> <LongMessage>This method PCOA_Sample.overridableMethod() is declared more permissively than is used in the code base</LongMessage> @@ -21808,40 +21932,6 @@ <Message>At PCOA_Sample.java:[line 29]</Message> </SourceLine> </BugInstance> - <BugInstance type="UPM_UNCALLED_PRIVATE_METHOD" priority="3" rank="20" abbrev="UPM" category="PERFORMANCE" instanceHash="bbad39c94dbc7d829302b3d23130500a" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Private method is never called</ShortMessage> - <LongMessage>Private method PCOA_Sample.privateCallsOverridable() is never called</LongMessage> - <Class classname="PCOA_Sample" primary="true"> - <SourceLine classname="PCOA_Sample" start="3" end="30" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java"> - <Message>At PCOA_Sample.java:[lines 3-30]</Message> - </SourceLine> - <Message>In class PCOA_Sample</Message> - </Class> - <Method classname="PCOA_Sample" name="privateCallsOverridable" signature="()V" isStatic="false" primary="true"> - <SourceLine classname="PCOA_Sample" start="29" end="30" startBytecode="0" endBytecode="50" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java"/> - <Message>In method PCOA_Sample.privateCallsOverridable()</Message> - </Method> - <SourceLine classname="PCOA_Sample" start="29" end="30" startBytecode="0" endBytecode="50" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java" synthetic="true"> - <Message>At PCOA_Sample.java:[lines 29-30]</Message> - </SourceLine> - </BugInstance> - <BugInstance type="UPM_UNCALLED_PRIVATE_METHOD" priority="3" rank="20" abbrev="UPM" category="PERFORMANCE" instanceHash="80c6202fa8a34d7b906f1aa16f776be2" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> - <ShortMessage>Private method is never called</ShortMessage> - <LongMessage>Private method PCOA_Sample.privateNonFinalMethod() is never called</LongMessage> - <Class classname="PCOA_Sample" primary="true"> - <SourceLine classname="PCOA_Sample" start="3" end="30" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java"> - <Message>At PCOA_Sample.java:[lines 3-30]</Message> - </SourceLine> - <Message>In class PCOA_Sample</Message> - </Class> - <Method classname="PCOA_Sample" name="privateNonFinalMethod" signature="()V" isStatic="false" primary="true"> - <SourceLine classname="PCOA_Sample" start="23" end="23" startBytecode="0" endBytecode="42" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java"/> - <Message>In method PCOA_Sample.privateNonFinalMethod()</Message> - </Method> - <SourceLine classname="PCOA_Sample" start="23" end="23" startBytecode="0" endBytecode="42" sourcefile="PCOA_Sample.java" sourcepath="PCOA_Sample.java" synthetic="true"> - <Message>At PCOA_Sample.java:[line 23]</Message> - </SourceLine> - </BugInstance> <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="4da66eafef8d0a5a2fd51eed622ce9f0" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Class is defined in the default package</ShortMessage> <LongMessage>Class PCOA_Sample$FinalClass id defined in the default package</LongMessage> @@ -28361,6 +28451,23 @@ <Message>At SPP_Sample.java:[line 61]</Message> </SourceLine> </BugInstance> + <BugInstance type="FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER" priority="1" rank="6" abbrev="FE" category="CORRECTNESS" instanceHash="928c8daeafb0028a8ef59951281d17a1" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Doomed test for equality to NaN</ShortMessage> + <LongMessage>Doomed test for equality to NaN in SPP_Sample.testNAN(float)</LongMessage> + <Class classname="SPP_Sample" primary="true"> + <SourceLine classname="SPP_Sample" start="26" end="432" sourcefile="SPP_Sample.java" sourcepath="SPP_Sample.java"> + <Message>At SPP_Sample.java:[lines 26-432]</Message> + </SourceLine> + <Message>In class SPP_Sample</Message> + </Class> + <Method classname="SPP_Sample" name="testNAN" signature="(F)V" isStatic="false" primary="true"> + <SourceLine classname="SPP_Sample" start="87" end="90" startBytecode="0" endBytecode="84" sourcefile="SPP_Sample.java" sourcepath="SPP_Sample.java"/> + <Message>In method SPP_Sample.testNAN(float)</Message> + </Method> + <SourceLine classname="SPP_Sample" primary="true" start="87" end="87" startBytecode="3" endBytecode="3" sourcefile="SPP_Sample.java" sourcepath="SPP_Sample.java"> + <Message>At SPP_Sample.java:[line 87]</Message> + </SourceLine> + </BugInstance> <BugInstance type="FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER" priority="1" rank="6" abbrev="FE" category="CORRECTNESS" instanceHash="faa9639f56568b33510e4ba9c7bb8d0d" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Doomed test for equality to NaN</ShortMessage> <LongMessage>Doomed test for equality to NaN in SPP_Sample.testNAN2(Double)</LongMessage> @@ -33777,6 +33884,23 @@ <Message>At UEC_Sample.java:[lines 1-11]</Message> </SourceLine> </BugInstance> + <BugInstance type="DM_STRING_TOSTRING" priority="3" rank="20" abbrev="Dm" category="PERFORMANCE" instanceHash="23a4ba620b71c65c5c200ff59c663c4c" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Method invokes toString() method on a String</ShortMessage> + <LongMessage>UMTP_Sample.fpUseClass(Class) invokes toString() method on a String</LongMessage> + <Class classname="UMTP_Sample" primary="true"> + <SourceLine classname="UMTP_Sample" start="4" end="41" sourcefile="UMTP_Sample.java" sourcepath="UMTP_Sample.java"> + <Message>At UMTP_Sample.java:[lines 4-41]</Message> + </SourceLine> + <Message>In class UMTP_Sample</Message> + </Class> + <Method classname="UMTP_Sample" name="fpUseClass" signature="(Ljava/lang/Class;)Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="UMTP_Sample" start="18" end="18" startBytecode="0" endBytecode="77" sourcefile="UMTP_Sample.java" sourcepath="UMTP_Sample.java"/> + <Message>In method UMTP_Sample.fpUseClass(Class)</Message> + </Method> + <SourceLine classname="UMTP_Sample" primary="true" start="18" end="18" startBytecode="4" endBytecode="4" sourcefile="UMTP_Sample.java" sourcepath="UMTP_Sample.java"> + <Message>At UMTP_Sample.java:[line 18]</Message> + </SourceLine> + </BugInstance> <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="1743d798a28a9204e043c118961af4f1" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Class is defined in the default package</ShortMessage> <LongMessage>Class UMTP_Sample id defined in the default package</LongMessage> @@ -34511,6 +34635,313 @@ <Message>At USBR_Sample.java:[line 11]</Message> </SourceLine> </BugInstance> + <BugInstance type="FCBL_FIELD_COULD_BE_LOCAL" priority="2" rank="7" abbrev="FCBL" category="CORRECTNESS" instanceHash="3c49a28c984213110186414194179c34" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class defines fields that are used only as locals</ShortMessage> + <LongMessage>Class USFW1_Sample defines fields that are used only as locals</LongMessage> + <Class classname="USFW1_Sample" primary="true"> + <SourceLine classname="USFW1_Sample" start="19" end="25" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 19-25]</Message> + </SourceLine> + <Message>In class USFW1_Sample</Message> + </Class> + <Field classname="USFW1_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW1_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW1_Sample.s</Message> + </Field> + <SourceLine classname="USFW1_Sample" primary="true" start="24" end="24" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 24]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="e34081ca9ca24818de6ee6090f70dd77" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class is defined in the default package</ShortMessage> + <LongMessage>Class USFW1_Sample id defined in the default package</LongMessage> + <Class classname="USFW1_Sample" primary="true"> + <SourceLine classname="USFW1_Sample" start="19" end="25" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 19-25]</Message> + </SourceLine> + <Message>In class USFW1_Sample</Message> + </Class> + <SourceLine classname="USFW1_Sample" start="19" end="25" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 19-25]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_TOSTRING" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="b44204aa983e441147720ad6955da95" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class does not implement a toString method</ShortMessage> + <LongMessage>Class USFW1_Sample does not implement a toString method</LongMessage> + <Class classname="USFW1_Sample" primary="true"> + <SourceLine classname="USFW1_Sample" start="19" end="25" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 19-25]</Message> + </SourceLine> + <Message>In class USFW1_Sample</Message> + </Class> + <SourceLine classname="USFW1_Sample" start="19" end="25" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 19-25]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="URF_UNREAD_FIELD" priority="2" rank="18" abbrev="UrF" category="PERFORMANCE" instanceHash="c20b99d5c97f1999a33ef65bb1d7db60" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Unread field</ShortMessage> + <LongMessage>Unread field: USFW1_Sample.s</LongMessage> + <Class classname="USFW1_Sample" primary="true"> + <SourceLine classname="USFW1_Sample" start="19" end="25" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 19-25]</Message> + </SourceLine> + <Message>In class USFW1_Sample</Message> + </Class> + <Field classname="USFW1_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW1_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW1_Sample.s</Message> + </Field> + <SourceLine classname="USFW1_Sample" primary="true" start="24" end="24" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 24]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES" priority="2" rank="7" abbrev="USFW" category="CORRECTNESS" instanceHash="a531aa141737cb0f3b69bdffe883477d" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Method of Singleton class writes to a field in an unsynchronized manner</ShortMessage> + <LongMessage>Method USFW1_Sample.writeToField() of Singleton class writes to a field in an unsynchronized manner</LongMessage> + <Class classname="USFW1_Sample" primary="true"> + <SourceLine classname="USFW1_Sample" start="19" end="25" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 19-25]</Message> + </SourceLine> + <Message>In class USFW1_Sample</Message> + </Class> + <Method classname="USFW1_Sample" name="writeToField" signature="()V" isStatic="false" primary="true"> + <SourceLine classname="USFW1_Sample" start="24" end="25" startBytecode="0" endBytecode="52" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"/> + <Message>In method USFW1_Sample.writeToField()</Message> + </Method> + <SourceLine classname="USFW1_Sample" primary="true" start="24" end="24" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 24]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="FCBL_FIELD_COULD_BE_LOCAL" priority="2" rank="7" abbrev="FCBL" category="CORRECTNESS" instanceHash="d71900b03cc1b974d2158b4f506ac356" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class defines fields that are used only as locals</ShortMessage> + <LongMessage>Class USFW2_Sample defines fields that are used only as locals</LongMessage> + <Class classname="USFW2_Sample" primary="true"> + <SourceLine classname="USFW2_Sample" start="30" end="36" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 30-36]</Message> + </SourceLine> + <Message>In class USFW2_Sample</Message> + </Class> + <Field classname="USFW2_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW2_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW2_Sample.s</Message> + </Field> + <SourceLine classname="USFW2_Sample" primary="true" start="35" end="35" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 35]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="9a22440126fafa919b1dcf01f20b1424" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class is defined in the default package</ShortMessage> + <LongMessage>Class USFW2_Sample id defined in the default package</LongMessage> + <Class classname="USFW2_Sample" primary="true"> + <SourceLine classname="USFW2_Sample" start="30" end="36" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 30-36]</Message> + </SourceLine> + <Message>In class USFW2_Sample</Message> + </Class> + <SourceLine classname="USFW2_Sample" start="30" end="36" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 30-36]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_TOSTRING" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="21a68bfb2f6bae7766e7622442032bba" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class does not implement a toString method</ShortMessage> + <LongMessage>Class USFW2_Sample does not implement a toString method</LongMessage> + <Class classname="USFW2_Sample" primary="true"> + <SourceLine classname="USFW2_Sample" start="30" end="36" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 30-36]</Message> + </SourceLine> + <Message>In class USFW2_Sample</Message> + </Class> + <SourceLine classname="USFW2_Sample" start="30" end="36" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 30-36]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="URF_UNREAD_FIELD" priority="2" rank="18" abbrev="UrF" category="PERFORMANCE" instanceHash="ccca16fb63e7d50e321e7ad447e1b0f9" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Unread field</ShortMessage> + <LongMessage>Unread field: USFW2_Sample.s</LongMessage> + <Class classname="USFW2_Sample" primary="true"> + <SourceLine classname="USFW2_Sample" start="30" end="36" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 30-36]</Message> + </SourceLine> + <Message>In class USFW2_Sample</Message> + </Class> + <Field classname="USFW2_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW2_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW2_Sample.s</Message> + </Field> + <SourceLine classname="USFW2_Sample" primary="true" start="35" end="35" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 35]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES" priority="2" rank="7" abbrev="USFW" category="CORRECTNESS" instanceHash="85217e5671ddd28c2741952c24cf6923" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Method of Singleton class writes to a field in an unsynchronized manner</ShortMessage> + <LongMessage>Method USFW2_Sample.writeToField() of Singleton class writes to a field in an unsynchronized manner</LongMessage> + <Class classname="USFW2_Sample" primary="true"> + <SourceLine classname="USFW2_Sample" start="30" end="36" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 30-36]</Message> + </SourceLine> + <Message>In class USFW2_Sample</Message> + </Class> + <Method classname="USFW2_Sample" name="writeToField" signature="()V" isStatic="false" primary="true"> + <SourceLine classname="USFW2_Sample" start="35" end="36" startBytecode="0" endBytecode="52" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"/> + <Message>In method USFW2_Sample.writeToField()</Message> + </Method> + <SourceLine classname="USFW2_Sample" primary="true" start="35" end="35" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 35]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="FCBL_FIELD_COULD_BE_LOCAL" priority="2" rank="7" abbrev="FCBL" category="CORRECTNESS" instanceHash="81c66402d84fee76107634f2213951c7" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class defines fields that are used only as locals</ShortMessage> + <LongMessage>Class USFW3_Sample defines fields that are used only as locals</LongMessage> + <Class classname="USFW3_Sample" primary="true"> + <SourceLine classname="USFW3_Sample" start="41" end="47" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 41-47]</Message> + </SourceLine> + <Message>In class USFW3_Sample</Message> + </Class> + <Field classname="USFW3_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW3_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW3_Sample.s</Message> + </Field> + <SourceLine classname="USFW3_Sample" primary="true" start="46" end="46" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 46]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="dc5fcd2202d7fee9c733a927e430b0bd" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class is defined in the default package</ShortMessage> + <LongMessage>Class USFW3_Sample id defined in the default package</LongMessage> + <Class classname="USFW3_Sample" primary="true"> + <SourceLine classname="USFW3_Sample" start="41" end="47" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 41-47]</Message> + </SourceLine> + <Message>In class USFW3_Sample</Message> + </Class> + <SourceLine classname="USFW3_Sample" start="41" end="47" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 41-47]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_TOSTRING" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="3acb5e1f761eee7eb0dc0e8d60a00ce1" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class does not implement a toString method</ShortMessage> + <LongMessage>Class USFW3_Sample does not implement a toString method</LongMessage> + <Class classname="USFW3_Sample" primary="true"> + <SourceLine classname="USFW3_Sample" start="41" end="47" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 41-47]</Message> + </SourceLine> + <Message>In class USFW3_Sample</Message> + </Class> + <SourceLine classname="USFW3_Sample" start="41" end="47" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 41-47]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="URF_UNREAD_FIELD" priority="2" rank="18" abbrev="UrF" category="PERFORMANCE" instanceHash="480ff380bd8ac61ccd672c6775e00162" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Unread field</ShortMessage> + <LongMessage>Unread field: USFW3_Sample.s</LongMessage> + <Class classname="USFW3_Sample" primary="true"> + <SourceLine classname="USFW3_Sample" start="41" end="47" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 41-47]</Message> + </SourceLine> + <Message>In class USFW3_Sample</Message> + </Class> + <Field classname="USFW3_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW3_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW3_Sample.s</Message> + </Field> + <SourceLine classname="USFW3_Sample" primary="true" start="46" end="46" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 46]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="FCBL_FIELD_COULD_BE_LOCAL" priority="2" rank="7" abbrev="FCBL" category="CORRECTNESS" instanceHash="8f39f55b61442fb46343705463810554" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class defines fields that are used only as locals</ShortMessage> + <LongMessage>Class USFW_Sample defines fields that are used only as locals</LongMessage> + <Class classname="USFW_Sample" primary="true"> + <SourceLine classname="USFW_Sample" start="8" end="14" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 8-14]</Message> + </SourceLine> + <Message>In class USFW_Sample</Message> + </Class> + <Field classname="USFW_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW_Sample.s</Message> + </Field> + <SourceLine classname="USFW_Sample" primary="true" start="13" end="13" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 13]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="bdfff8aa127727983cdcf921ea39e916" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class is defined in the default package</ShortMessage> + <LongMessage>Class USFW_Sample id defined in the default package</LongMessage> + <Class classname="USFW_Sample" primary="true"> + <SourceLine classname="USFW_Sample" start="8" end="14" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 8-14]</Message> + </SourceLine> + <Message>In class USFW_Sample</Message> + </Class> + <SourceLine classname="USFW_Sample" start="8" end="14" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 8-14]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="IMC_IMMATURE_CLASS_NO_TOSTRING" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="19ce30e518c5878695c1be18b1124063" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Class does not implement a toString method</ShortMessage> + <LongMessage>Class USFW_Sample does not implement a toString method</LongMessage> + <Class classname="USFW_Sample" primary="true"> + <SourceLine classname="USFW_Sample" start="8" end="14" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 8-14]</Message> + </SourceLine> + <Message>In class USFW_Sample</Message> + </Class> + <SourceLine classname="USFW_Sample" start="8" end="14" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java" synthetic="true"> + <Message>At USFW_Sample.java:[lines 8-14]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="URF_UNREAD_FIELD" priority="2" rank="18" abbrev="UrF" category="PERFORMANCE" instanceHash="d2d350004426f5b9cc2d0a44562e0720" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Unread field</ShortMessage> + <LongMessage>Unread field: USFW_Sample.s</LongMessage> + <Class classname="USFW_Sample" primary="true"> + <SourceLine classname="USFW_Sample" start="8" end="14" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 8-14]</Message> + </SourceLine> + <Message>In class USFW_Sample</Message> + </Class> + <Field classname="USFW_Sample" name="s" signature="Ljava/lang/String;" isStatic="false" primary="true"> + <SourceLine classname="USFW_Sample" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>In USFW_Sample.java</Message> + </SourceLine> + <Message>Field USFW_Sample.s</Message> + </Field> + <SourceLine classname="USFW_Sample" primary="true" start="13" end="13" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 13]</Message> + </SourceLine> + </BugInstance> + <BugInstance type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES" priority="2" rank="7" abbrev="USFW" category="CORRECTNESS" instanceHash="bd51f08cc960e76c1ac83210ebdd3c17" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> + <ShortMessage>Method of Singleton class writes to a field in an unsynchronized manner</ShortMessage> + <LongMessage>Method USFW_Sample.writeToField() of Singleton class writes to a field in an unsynchronized manner</LongMessage> + <Class classname="USFW_Sample" primary="true"> + <SourceLine classname="USFW_Sample" start="8" end="14" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[lines 8-14]</Message> + </SourceLine> + <Message>In class USFW_Sample</Message> + </Class> + <Method classname="USFW_Sample" name="writeToField" signature="()V" isStatic="false" primary="true"> + <SourceLine classname="USFW_Sample" start="13" end="14" startBytecode="0" endBytecode="52" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"/> + <Message>In method USFW_Sample.writeToField()</Message> + </Method> + <SourceLine classname="USFW_Sample" primary="true" start="13" end="13" startBytecode="3" endBytecode="3" sourcefile="USFW_Sample.java" sourcepath="USFW_Sample.java"> + <Message>At USFW_Sample.java:[line 13]</Message> + </SourceLine> + </BugInstance> <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="a6e119a301a05ba89ab95f33ca3e7e87" instanceOccurrenceNum="0" instanceOccurrenceMax="0"> <ShortMessage>Class is defined in the default package</ShortMessage> <LongMessage>Class USS_Sample id defined in the default package</LongMessage> @@ -37827,6 +38258,16 @@ ]]></Details> </BugPattern> + <BugPattern type="LO_SUSPECT_LOG_PARAMETER" abbrev="LO" category="CORRECTNESS"> + <ShortDescription>Constructor declares a Logger parameter</ShortDescription> + <Details><![CDATA[ + + <p>This constructor declares a parameter that is a Logger. As loggers are meant to be + created statically per class, it doesn't make sense that you would pass a Logger from one + class to another. Declare the Logger static in each class instead.</p> + + ]]></Details> + </BugPattern> <BugPattern type="SPP_CONVERSION_OF_STRING_LITERAL" abbrev="SPP" category="CORRECTNESS"> <ShortDescription>Method converts a String literal</ShortDescription> <Details><![CDATA[ @@ -37870,6 +38311,15 @@ ]]></Details> </BugPattern> + <BugPattern type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES" abbrev="USFW" category="CORRECTNESS"> + <ShortDescription>Method of Singleton class writes to a field in an unsynchronized manner</ShortDescription> + <Details><![CDATA[ + + <p>This method writes to a field of this class. Since this class is seen as a Singleton this can produce race + conditions, or cause non-visible changes to other threads, because the field isn't accessed synchronously. + + ... [truncated message content] |
From: <dbr...@us...> - 2016-11-18 03:39:40
|
Revision: 1806 http://sourceforge.net/p/fb-contrib/code/1806 Author: dbrosius Date: 2016-11-18 03:39:38 +0000 (Fri, 18 Nov 2016) Log Message: ----------- Version 6.8.1 Added Paths: ----------- tags/v6_8_1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-11-18 03:36:11
|
Revision: 1805 http://sourceforge.net/p/fb-contrib/code/1805 Author: dbrosius Date: 2016-11-18 03:36:09 +0000 (Fri, 18 Nov 2016) Log Message: ----------- add tests Added Paths: ----------- trunk/fb-contrib/src/test/ trunk/fb-contrib/src/test/java/ trunk/fb-contrib/src/test/java/com/ trunk/fb-contrib/src/test/java/com/mebigfatguy/ trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/ trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/ trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/RegisterUtilsTest.java trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilderTest.java trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java Added: trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/RegisterUtilsTest.java =================================================================== --- trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/RegisterUtilsTest.java (rev 0) +++ trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/RegisterUtilsTest.java 2016-11-18 03:36:09 UTC (rev 1805) @@ -0,0 +1,132 @@ +package com.mebigfatguy.fbcontrib.utils; + +import edu.umd.cs.findbugs.FindBugs; +import edu.umd.cs.findbugs.visitclass.DismantleBytecode; + +import static org.apache.bcel.Constants.*; +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; + +import org.apache.bcel.classfile.Constant; +import org.apache.bcel.classfile.ConstantPool; +import org.apache.bcel.classfile.ConstantUtf8; +import org.apache.bcel.classfile.Method; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +public class RegisterUtilsTest { + + private static final int OPERAND = 12345; + + @Mock private DismantleBytecode dbc; + + @BeforeSuite + public void setUpClass() { + FindBugs.setHome("target/findbugs-3.0.1.jar"); + } + + @BeforeMethod + public void setUp() { + MockitoAnnotations.initMocks(this); + + when(dbc.getRegisterOperand()).thenReturn(OPERAND); + } + + @DataProvider(name = "parameterRegisters") + Object[][] parameterRegisters() { + return new Object[][] { + // access flags, signature, expected registers + {ACC_PUBLIC | ACC_STATIC, "(JLjava/lang/String;[[I)V", new int[] { 0, 2, 3 }}, + {ACC_STATIC, "(Ljava/lang/Object;)Z", new int[] { 0 }}, + {ACC_PUBLIC, "(DJ[D[J)V", new int[] { 1, 3, 5, 6 }}, + {0, "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", new int[] { 1, 2 }}, + }; + } + + @DataProvider(name = "reg_ASTORE") + Object[][] reg_ASTORE() { + return new Object[][] { + {ASTORE, OPERAND}, {ASTORE_0, 0}, {ASTORE_1, 1}, {ASTORE_2, 2}, {ASTORE_3, 3}, {ASTORE_0 - 1, -1}, {ASTORE_3 + 1, -1}, + }; + } + + @DataProvider(name = "reg_ALOAD") + Object[][] reg_ALOAD() { + return new Object[][] { + {ALOAD_0, 0}, {ALOAD_1, 1}, {ALOAD_2, 2}, {ALOAD_3, 3}, {ALOAD_0 - 1, -1}, {ALOAD_3 + 1, -1}, + }; + } + + @DataProvider(name = "regStore") + Object[][] regStore() { + return new Object[][] { + {ASTORE, OPERAND}, {ISTORE, OPERAND}, {LSTORE, OPERAND}, {FSTORE, OPERAND}, {DSTORE, OPERAND}, + {ASTORE_0, 0}, {ASTORE_1, 1}, {ASTORE_2, 2}, {ASTORE_3, 3}, + {ISTORE_0, 0}, {ISTORE_1, 1}, {ISTORE_2, 2}, {ISTORE_3, 3}, + {LSTORE_0, 0}, {LSTORE_1, 1}, {LSTORE_2, 2}, {LSTORE_3, 3}, + {FSTORE_0, 0}, {FSTORE_1, 1}, {FSTORE_2, 2}, {FSTORE_3, 3}, + {DSTORE_0, 0}, {DSTORE_1, 1}, {DSTORE_2, 2}, {DSTORE_3, 3}, + {Integer.MIN_VALUE, -1}, {Integer.MAX_VALUE, -1}, + }; + } + + @DataProvider(name = "regLoad") + Object[][] regLoad() { + return new Object[][] { + {ALOAD, OPERAND}, {ILOAD, OPERAND}, {LLOAD, OPERAND}, {FLOAD, OPERAND}, {DLOAD, OPERAND}, + {ALOAD_0, 0}, {ALOAD_1, 1}, {ALOAD_2, 2}, {ALOAD_3, 3}, + {ILOAD_0, 0}, {ILOAD_1, 1}, {ILOAD_2, 2}, {ILOAD_3, 3}, + {LLOAD_0, 0}, {LLOAD_1, 1}, {LLOAD_2, 2}, {LLOAD_3, 3}, + {FLOAD_0, 0}, {FLOAD_1, 1}, {FLOAD_2, 2}, {FLOAD_3, 3}, + {DLOAD_0, 0}, {DLOAD_1, 1}, {DLOAD_2, 2}, {DLOAD_3, 3}, + {Integer.MIN_VALUE, -1}, {Integer.MAX_VALUE, -1}, + }; + } + + @Test(dataProvider = "parameterRegisters") + public void shouldGetParameterRegisters(int accessFlags, String signature, int[] expected) { + Method method = new Method(); + method.setAccessFlags(accessFlags); + + Constant[] cnst = new Constant[] { new ConstantUtf8(signature) }; + ConstantPool cp = new ConstantPool(cnst) { + + @Override + protected Object clone() throws CloneNotSupportedException { + throw new CloneNotSupportedException(); + } + + }; + method.setConstantPool(cp); + method.setSignatureIndex(0); + + int[] regs = RegisterUtils.getParameterRegisters(method); + + assertEquals(regs, expected); + } + + @Test(dataProvider = "reg_ASTORE") + public void shouldReturnOffsetWhenSeenASTORE(int seen, int expected) { + assertEquals(RegisterUtils.getAStoreReg(dbc, seen), expected); + } + + @Test(dataProvider = "reg_ALOAD") + public void shouldReturnOffsetWhenSeenALOAD(int seen, int expected) { + assertEquals(RegisterUtils.getALoadReg(dbc, seen), expected); + } + + @Test(dataProvider = "regStore") + public void shouldReturnStoreReg(int seen, int expected) { + assertEquals(RegisterUtils.getStoreReg(dbc, seen), expected); + } + + @Test(dataProvider = "regLoad") + public void shouldReturnLoadReg(int seen, int expected) { + assertEquals(RegisterUtils.getLoadReg(dbc, seen), expected); + } + +} Property changes on: trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/RegisterUtilsTest.java ___________________________________________________________________ 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 Added: trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilderTest.java =================================================================== --- trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilderTest.java (rev 0) +++ trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilderTest.java 2016-11-18 03:36:09 UTC (rev 1805) @@ -0,0 +1,68 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2016 ThrawnCA + * + * 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.utils; + +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +public class SignatureBuilderTest { + + @Test + public void shouldDefaultToVoidReturnWithNoParameters() { + assertEquals(new SignatureBuilder().build(), "()V"); + } + + @Test + public void shouldConvertClassnamesToSignatures() { + assertEquals(new SignatureBuilder().withMethodName("classNames").withParamTypes("java.lang.String").withReturnType("java/util/Collection").build(), + "classNames(Ljava/lang/String;)Ljava/util/Collection;"); + } + + @Test + public void shouldPreserveSignatures() { + assertEquals(new SignatureBuilder().withMethodName("signatures").withParamTypes("Ljava/lang/Object;").withReturnType("Ljava/util/Date;").build(), + "signatures(Ljava/lang/Object;)Ljava/util/Date;"); + } + + @Test + public void shouldOverrideExistingParamTypes() { + assertEquals(new SignatureBuilder().withMethodName("overrideParams").withParamTypes("java/lang/Object") + .withParamTypes("java/lang/String", "java/lang/Boolean").build(), "overrideParams(Ljava/lang/String;Ljava/lang/Boolean;)V"); + } + + @Test + public void shouldAcceptPrimitiveTypes() { + assertEquals(new SignatureBuilder().withMethodName("primitives").withParamTypes("B", "S", "C", "I", "J", "java.lang.Object", "Z", "F") + .withReturnType("D").build(), "primitives(BSCIJLjava/lang/Object;ZF)D"); + } + + @Test + public void shouldAcceptClasses() { + assertEquals(new SignatureBuilder().withMethodName("classes").withParamTypes(String.class, Object.class).withReturnType(Integer.class).build(), + "classes(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Integer;"); + } + + @Test + public void shouldBlankReturnTypeWhenNeeded() { + assertEquals(new SignatureBuilder().withMethodName("noReturn").withParamTypes("java.lang.Object").withoutReturnType().build(), + "noReturn(Ljava/lang/Object;)"); + } + +} Property changes on: trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilderTest.java ___________________________________________________________________ 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 Added: trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java =================================================================== --- trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java (rev 0) +++ trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java 2016-11-18 03:36:09 UTC (rev 1805) @@ -0,0 +1,112 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2016 ThrawnCA + * + * 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.utils; + +import static org.testng.Assert.assertEquals; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +public class SignatureUtilsTest { + + @DataProvider(name = "namesToSignatures") + public Object[][] namesToSignatures() { + String sigString = "Ljava/lang/String;"; + return new Object[][] { { "java.lang.String", sigString }, { "java/lang/String", sigString }, { sigString, sigString }, { "B", "B" }, { "S", "S" }, + { "C", "C" }, { "I", "I" }, { "J", "J" }, { "F", "F" }, { "D", "D" }, { "Z", "Z" }, { "", "" }, { null, null }, }; + } + + @DataProvider(name = "signaturesToSlashedNames") + public Object[][] signaturesToSlashedNames() { + String slashedString = "java/lang/String"; + return new Object[][] { { "Ljava/lang/String;", slashedString }, { slashedString, slashedString }, { "B", "B" }, { "S", "S" }, { "C", "C" }, + { "I", "I" }, { "J", "J" }, { "F", "F" }, { "D", "D" }, { "Z", "Z" }, { "", "" }, { null, null }, }; + } + + @DataProvider(name = "signaturesToDottedNames") + public Object[][] signaturesToDottedNames() { + String dottedString = "java.lang.String"; + return new Object[][] { { "Ljava/lang/String;", dottedString }, { "java/lang/String", dottedString }, { dottedString, dottedString }, { "B", "B" }, + { "S", "S" }, { "C", "C" }, { "I", "I" }, { "J", "J" }, { "F", "F" }, { "D", "D" }, { "Z", "Z" }, { "", "" }, }; + } + + @DataProvider(name = "namesToArrays") + public Object[][] namesToArrays() { + String sigStringArray = "[Ljava/lang/String;"; + return new Object[][] { { "java.lang.String", sigStringArray }, { "java/lang/String", sigStringArray }, { sigStringArray, "[[Ljava/lang/String;" }, + { "B", "[B" }, { "S", "[S" }, { "C", "[C" }, { "I", "[I" }, { "J", "[J" }, { "F", "[F" }, { "D", "[D" }, { "Z", "[Z" }, { "", "" }, + { null, null }, }; + } + + @Test + public void shouldGetParameterSlotsAndSignaturesForInstanceMethod() { + Map<Integer, String> expected = new HashMap<>(2); + expected.put(1, "I"); + expected.put(2, "Ljava/lang/Object;"); + assertEquals(SignatureUtils.getParameterSlotAndSignatures(false, "add(ILjava/lang/Object;)Ljava/lang/Object;"), expected); + } + + @Test + public void shouldGetParameterSlotsAndSignaturesForStaticMethod() { + Map<Integer, String> expected = new HashMap<>(2); + expected.put(0, "I"); + expected.put(1, "Ljava/lang/Object;"); + assertEquals(SignatureUtils.getParameterSlotAndSignatures(true, "add(ILjava/lang/Object;)Ljava/lang/Object;"), expected); + } + + @Test + public void shouldGetParameterSignatures() { + assertEquals(SignatureUtils.getParameterSignatures("add(ILjava/lang/Object;)Ljava/lang/Object;"), Arrays.asList("I", "Ljava/lang/Object;")); + } + + @Test + public void shouldCountParameterSignatures() { + assertEquals(SignatureUtils.getNumParameters("add(ILjava/lang/Object;)Ljava/lang/Object;"), 2); + } + + @Test + public void shouldIgnoreEclipseParameterSignatures() { + assertEquals(SignatureUtils.getParameterSignatures("wonky(!Ljava/lang/Object;++)Ljava/lang/Object;"), Arrays.asList("Ljava/lang/Object;")); + } + + @Test(dataProvider = "namesToSignatures") + public void shouldConvertClassnamesToSignatures(String input, String expected) { + assertEquals(SignatureUtils.classToSignature(input), expected); + } + + @Test(dataProvider = "signaturesToSlashedNames") + public void shouldConvertSignaturesToSlashedClassNames(String input, String expected) { + assertEquals(SignatureUtils.trimSignature(input), expected); + } + + @Test(dataProvider = "signaturesToDottedNames") + public void shouldConvertSignaturesToDottedClassNames(String input, String expected) { + assertEquals(SignatureUtils.stripSignature(input), expected); + } + + @Test(dataProvider = "namesToArrays") + public void shouldConvertClassnamesToArrays(String input, String expected) { + assertEquals(SignatureUtils.toArraySignature(input), expected); + } + +} Property changes on: trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java ___________________________________________________________________ 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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-11-18 03:35:11
|
Revision: 1804 http://sourceforge.net/p/fb-contrib/code/1804 Author: dbrosius Date: 2016-11-18 03:35:06 +0000 (Fri, 18 Nov 2016) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/.project trunk/fb-contrib/build.properties trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/etc/samples.fbp trunk/fb-contrib/htdocs/index.shtml trunk/fb-contrib/htdocs/repository.html trunk/fb-contrib/pom.xml trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/MethodInfo.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CloneUsability.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflatingResourcesAndFiles.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JAXRSIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseSplit.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WiringIssues.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/AttributesUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/CodeByteUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/OpcodeUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/UnmodifiableList.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/UnmodifiableSet.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/XClassUtils.java trunk/fb-contrib/src/samples/java/AIOB_Sample.java trunk/fb-contrib/src/samples/java/LO_Sample.java trunk/fb-contrib/src/samples/java/MRC_Sample.java trunk/fb-contrib/src/samples/java/SPP_Sample.java trunk/fb-contrib/yank.xls Added Paths: ----------- trunk/fb-contrib/samples.xml trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseTryWithResources.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilder.java trunk/fb-contrib/src/samples/java/SSCU_Sample.java trunk/fb-contrib/src/samples/java/UTWR_Sample.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/.classpath 2016-11-18 03:35:06 UTC (rev 1804) @@ -1,39 +1,43 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry excluding="**/*.*" kind="src" path="etc"/> - <classpathentry kind="src" path="src"/> - <classpathentry excluding="lib/" kind="src" output="target/classes/samples" path="samples"/> + <classpathentry kind="src" output="target/classes/samples" path="src/samples/java"/> + <classpathentry kind="src" path="src/main/java"/> + <classpathentry kind="src" output="target/classes/test" path="src/test/java"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="lib/backport-util-concurrent-3.1.jar"/> - <classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/> <classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/> <classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/> <classpathentry kind="lib" path="lib/javax.servlet.jsp-api-2.3.1.jar"/> - <classpathentry kind="lib" path="lib/commons-lang3-3.3.jar"/> - <classpathentry kind="lib" path="lib/slf4j-api-1.7.7.jar"/> - <classpathentry kind="lib" path="lib/guava-17.0.jar" sourcepath="lib/sources/guava-17.0-sources.jar"/> - <classpathentry kind="lib" path="lib/httpclient-cache-4.3.4.jar"/> - <classpathentry kind="lib" path="lib/httpcore-4.3.2.jar"/> - <classpathentry kind="lib" path="lib/httpclient-4.3.4.jar"/> - <classpathentry kind="lib" path="lib/annotations-3.0.0.jar" sourcepath="/home/dave/.m2/repository/com/google/code/findbugs/annotations/3.0.0/annotations-3.0.0-sources.jar"/> - <classpathentry kind="lib" path="lib/asm-debug-all-5.0.2.jar" sourcepath="/home/dave/.m2/repository/org/ow2/asm/asm-debug-all/5.0.2/asm-debug-all-5.0.2-sources.jar"/> + <classpathentry kind="lib" path="lib/asm-debug-all-5.0.2.jar" sourcepath="lib/sources/asm-debug-all-5.0.2-sources.jar"/> <classpathentry kind="lib" path="lib/bcel-findbugs-6.0.jar" sourcepath="lib/sources/bcel-findbugs-6.0-sources.jar"> <attributes> <attribute name="javadoc_location" value="http://commons.apache.org/proper/commons-bcel/apidocs/"/> </attributes> </classpathentry> - <classpathentry kind="lib" path="lib/commons-codec-1.6.jar"/> <classpathentry kind="lib" path="lib/findbugs-3.0.1.jar" sourcepath="lib/sources/findbugs-3.0.1-sources.jar"/> <classpathentry kind="lib" path="lib/junit-4.12.jar"/> - <classpathentry kind="lib" path="lib/testng-6.9.6.jar"/> <classpathentry kind="lib" path="lib/jsr311-api-1.1.1.jar" sourcepath="lib/sources/jsr311-api-1.1.1-sources.jar"/> <classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar"/> - <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar" sourcepath="lib/sources/commons-io-1.3.2-sources.jar"/> <classpathentry kind="lib" path="lib/mockito-all-2.0.2-beta.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> - <classpathentry kind="lib" path="lib/spring-beans-4.3.2.RELEASE.jar"/> - <classpathentry kind="lib" path="lib/spring-tx-4.3.2.RELEASE.jar"/> - <classpathentry kind="lib" path="lib/spring-context-4.3.2.RELEASE.jar"/> <classpathentry kind="lib" path="lib/threetenbp-1.3.2.jar"/> + <classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/> + <classpathentry kind="lib" path="lib/commons-collections-3.2.2.jar"/> + <classpathentry kind="lib" path="lib/commons-lang3-3.4.jar"/> + <classpathentry kind="lib" path="lib/findbugs-ant-3.0.0.jar"/> + <classpathentry kind="lib" path="lib/guava-19.0.jar" sourcepath="lib/sources/guava-19.0-sources.jar"/> + <classpathentry kind="lib" path="lib/httpclient-4.5.2.jar"/> + <classpathentry kind="lib" path="lib/httpclient-cache-4.5.2.jar"/> + <classpathentry kind="lib" path="lib/httpcore-4.4.5.jar"/> + <classpathentry kind="lib" path="lib/slf4j-api-1.7.21.jar"/> + <classpathentry kind="lib" path="lib/spring-beans-4.3.3.RELEASE.jar"/> + <classpathentry kind="lib" path="lib/spring-context-4.3.3.RELEASE.jar"/> + <classpathentry kind="lib" path="lib/spring-tx-4.3.3.RELEASE.jar"/> + <classpathentry kind="lib" path="lib/jena-shaded-guava-3.1.0.jar"/> + <classpathentry kind="lib" path="lib/findbugs-annotations-3.0.1.jar"/> + <classpathentry kind="lib" path="lib/testng-6.9.10.jar"/> + <classpathentry kind="lib" path="lib/jcommander-1.48.jar"/> + <classpathentry kind="lib" path="lib/commons-io-2.4.jar"/> <classpathentry kind="output" path="target/classes/main"/> </classpath> Modified: trunk/fb-contrib/.project =================================================================== --- trunk/fb-contrib/.project 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/.project 2016-11-18 03:35:06 UTC (rev 1804) @@ -32,15 +32,4 @@ <nature>org.eclipse.pde.PluginNature</nature> <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature> </natures> - <filteredResources> - <filter> - <id>1351977185587</id> - <name>samples</name> - <type>10</type> - <matcher> - <id>org.eclipse.ui.ide.multiFilter</id> - <arguments>1.0-name-matches-false-false-.svn</arguments> - </matcher> - </filter> - </filteredResources> </projectDescription> Modified: trunk/fb-contrib/build.properties =================================================================== --- trunk/fb-contrib/build.properties 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/build.properties 2016-11-18 03:35:06 UTC (rev 1804) @@ -3,9 +3,10 @@ META-INF/,\ . jars.compile.order = . -source.. = src/,\ - etc/,\ - samples/ +source.. = src/main/java,\ + src/test/java,\ + src/samples/java,\ + etc/ output.. = target/classes/main proxy.server = Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/build.xml 2016-11-18 03:35:06 UTC (rev 1804) @@ -14,21 +14,24 @@ <property file="build.properties" /> <property file="version.properties" /> - <property name="src.dir" value="${basedir}/src" /> + <property name="src.dir" value="${basedir}/src/main/java" /> <property name="lib.dir" value="${basedir}/lib" /> <property name="etc.dir" value="${basedir}/etc" /> + <property name="test.dir" value="${basedir}/src/test/java" /> <property name="target.dir" value="${basedir}/target" /> - <property name="samples.dir" value="${basedir}/samples" /> + <property name="samples.dir" value="${basedir}/src/samples/java" /> <property name="main.classes.dir" value="${target.dir}/classes/main" /> <property name="samples.classes.dir" value="${target.dir}/classes/samples" /> + <property name="test.classes.dir" value="${target.dir}/classes/test" /> <property name="javadoc.dir" value="${target.dir}/javadoc" /> <property name="htdocs.dir" value="${basedir}/htdocs" /> <property name="javac.source" value="1.7" /> <property name="javac.target" value="1.7" /> <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> + <property name="test_reports.dir" value="${target.dir}/reports/test"/> - <property name="fb-contrib.version" value="6.9.0-SNAPSHOT" /> + <property name="fb-contrib.version" value="6.8.1" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -39,15 +42,16 @@ <target name="infra_jars" description="pull jars needed to build fb-contrib to ${user.dir}/.ant/lib"> <mkdir dir="${user.home}/.ant/lib" /> - <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/1.6.1/yank-1.6.1.jar" dest="${user.home}/.ant/lib"/> + <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/1.8.0/yank-1.8.0.jar" dest="${user.home}/.ant/lib"/> <get src="https://bitbucket.org/kjlubick/bugrankcheckstyle/downloads/bug-rank-check-style-1.0.0.jar" dest="${user.home}/.ant/lib"/> <get src="http://repo1.maven.org/maven2/com/mebigfatguy/vcsversion/vcsversion/0.4.0/vcsversion-0.4.0.jar" dest="${user.home}/.ant/lib"/> - <get src="http://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.4.1/fb-delta-0.4.1.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/> + <get src="http://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.6.0/fb-delta-0.6.0.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/> + <get src="http://repo1.maven.org/maven2/com/mebigfatguy/stringliterals/stringliterals/0.2.0/stringliterals-0.2.0.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/> </target> <target name="yank" xmlns:yank="antlib:com.mebigfatguy.yank" unless="no.yank"> <mkdir dir="${lib.dir}" /> - <yank:yank yankFile="${basedir}/yank.xls" destination="${lib.dir}" proxyServer="${proxy.server}" source="true" separateClassifierTypes="true"> + <yank:yank yankFile="${basedir}/yank.xls" destination="${lib.dir}" proxyServer="${proxy.server}" source="true" separateClassifierTypes="true" checkSHADigests="true"> <server url="http://repo1.maven.org/maven2" /> <generateVersions propertyFileName="${basedir}/version.properties" /> </yank:yank> @@ -57,7 +61,8 @@ <echo message="fb-contrib - a findbugs plugin"/> <echo message=""/> <echo message=" This project requires three jars to build fb-contrib: yank, bug-rank-check-style, vcsversion and" /> - <echo message=" and optionally fb-delta, to generate delta's of bug reports"/> + <echo message=" and optionally fb-delta, to generate delta's of bug reports, as well as stringliterals to dump"/> + <echo message=" a report of all string literals used in the code"/> <echo message=""/> <echo message=" This project uses yank (https://github.com/mebigfatguy/yank) for dependency management"/> <echo message=" download yank.jar and place in ~/.ant/lib directory"/> @@ -77,6 +82,10 @@ <echo message=" and can be downloaded and placed in ~/.ant/lib as well"/> <echo message=" http://search.maven.org/#search%7Cga%7C1%7Cfb-delta"/> <echo message="===="/> + <echo message=" If you want to generate a report of all string literals used in the code base, this project also uses stringliterals to do"/> + <echo message=" that, and can be downloaded and placed in ~/.ant/lib as well"/> + <echo message=" http://search.maven.org/#search%7Cga%7C1%7Cstringliterals"/> + <echo message="===="/> <echo message=" This task can be automated by running ant infra_jars"/> </target> @@ -86,14 +95,21 @@ <target name="-init" depends="yank"> <mkdir dir="${lib.dir}" /> <mkdir dir="${main.classes.dir}" /> + <mkdir dir="${test.classes.dir}" /> <mkdir dir="${samples.classes.dir}" /> <mkdir dir="${javadoc.dir}" /> <path id="fb-contrib.classpath"> <pathelement location="${lib.dir}/findbugs-${findbugs.version}.jar" /> <pathelement location="${lib.dir}/bcel-findbugs-${bcel-findbugs.version}.jar" /> - <pathelement location="${lib.dir}/annotations-${annotations.version}.jar" /> + <pathelement location="${lib.dir}/findbugs-annotations-${findbugs-annotations.version}.jar" /> <pathelement location="${lib.dir}/asm-debug-all-${asm-debug-all.version}.jar" /> + <pathelement location="${main.classes.dir}" /> </path> + <path id="fb-contrib.test.classpath"> + <pathelement location="${lib.dir}/testng-${testng.version}.jar" /> + <pathelement location="${lib.dir}/jcommander-${jcommander.version}.jar" /> + <pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" /> + </path> <path id="fb-contrib.samples.classpath"> <pathelement location="${lib.dir}/javax.servlet.jsp-api-${javax.servlet.jsp-api.version}.jar" /> <pathelement location="${lib.dir}/junit-${junit.version}.jar" /> @@ -116,6 +132,7 @@ <pathelement location="${lib.dir}/spring-tx-${spring-tx.version}.jar" /> <pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" /> <pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" /> + <pathelement location="${lib.dir}/jena-shaded-guava-${jena-shaded-guava.version}.jar" /> </path> </target> @@ -134,11 +151,18 @@ <classpath refid="fb-contrib.classpath" /> </javac> </target> + + <target name="compile_test" depends="compile" description="compiles java test files"> + <javac srcdir="${test.dir}" destdir="${test.classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false"> + <classpath refid="fb-contrib.classpath" /> + <classpath refid="fb-contrib.test.classpath" /> + </javac> + </target> <target name="compile_samples" depends="-init" description="compiles sample problem files"> <javac srcdir="${samples.dir}" destdir="${samples.classes.dir}" source="1.7" target="1.7" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false"> <compilerarg value="-XDignore.symbol.file"/> - <classpath refid="fb-contrib.classpath" /> + <classpath refid="fb-contrib.classpath" /> <classpath refid="fb-contrib.samples.classpath" /> </javac> <delete file="${samples.dir}/SJVU_Sample.class" /> @@ -148,7 +172,19 @@ <classpath refid="fb-contrib.samples.classpath" /> </javac> </target> + + <target name="test" depends="compile_test" unless="no.test" description="runs unit tests"> + <mkdir dir="${test_reports.dir}" /> + <taskdef resource="testngtasks" classpath="${lib.dir}/testng-${testng.version}.jar"/> + <testng outputDir="${test_reports.dir}"> + <classfileset dir="${test.classes.dir}" includes="**/*.class"/> + <classpath refid="fb-contrib.classpath"/> + <classpath refid="fb-contrib.test.classpath"/> + <classpath location="${test.classes.dir}"/> + </testng> + </target> + <target name="jar" depends="compile" xmlns:vcs="antlib:com.mebigfatguy.vcsversion" description="produces the fb-contrib jar file"> <vcs:vcsversion vcs="git" revisionProperty="_rev_" dateProperty="_date_" branchProperty="_branch_" urlProperty="_url_"/> <jar destfile="${target.dir}/fb-contrib-${fb-contrib.version}.jar"> @@ -202,6 +238,7 @@ <include name="**/*.md" /> <include name="**/*.xls" /> <include name="**/*.example" /> + <include name="**/*.fbp" /> </fileset> </zip> </target> @@ -213,7 +250,7 @@ </javadoc> </target> - <target name="build" depends="clean, -init, validate_xml, compile, compile_samples, jar" description="builds the plugin jar"> + <target name="build" depends="-init, validate_xml, compile, compile_test, compile_samples, test, jar" description="builds the plugin jar"> </target> <target name="install" depends="build" description="installs the plugin into FindBugs"> @@ -225,7 +262,7 @@ </copy> </target> - <target name="sample_delta" depends="build" xmlns:fbdelta="antlib:com.mebigfatguy.fbdelta" description="compares this runs reported bugs on the sample classes set, against the stored report"> + <target name="sample_delta" depends="install" xmlns:fbdelta="antlib:com.mebigfatguy.fbdelta" description="compares this runs reported bugs on the sample classes set, against the stored report"> <taskdef resource="edu/umd/cs/findbugs/anttask/tasks.properties" classpath="${lib.dir}/findbugs-ant-${findbugs-ant.version}.jar"/> <findbugs reportlevel="low" home="${findbugs.dir}" auxClassPathRef="fb-contrib.samples.classpath" output="xml:withMessages" jvmargs="-ea -Xmx800m" projectName="Samples" outputFile="${target.dir}/samples.xml"> <class location="${samples.classes.dir}" /> @@ -239,6 +276,16 @@ <loadfile property="diff" srcFile="${target.dir}/samples_delta.xml"/> <echo>${diff}</echo> </target> + + <target name="literals" depends="jar" xmlns:stringliterals="antlib:com.mebigfatguy.stringliterals" description="generate report of string literals used in code"> + <stringliterals:stringliterals> + <classpath id="source"> + <fileset dir="${main.classes.dir}"> + <include name="**/*.class"/> + </fileset> + </classpath> + </stringliterals:stringliterals> + </target> <target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release" /> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/etc/bugrank.txt 2016-11-18 03:35:06 UTC (rev 1804) @@ -216,6 +216,8 @@ +0 BugPattern SPP_USE_ISNAN +0 BugPattern SPP_USE_MATH_CONSTANT +0 BugPattern SPP_USE_STRINGBUILDER_LENGTH ++0 BugPattern SPP_WRONG_COMMONS_TO_STRING_OBJECT ++0 BugPattern SSCU_SUSPICIOUS_SHADED_CLASS_USE +0 BugPattern STB_STACKED_TRY_BLOCKS +2 BugPattern STS_SPURIOUS_THREAD_STATES +0 BugPattern STT_STRING_PARSING_A_FIELD @@ -259,6 +261,7 @@ +0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL +0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NULL +0 BugPattern UTA_USE_TO_ARRAY ++0 BugPattern UTWR_USE_TRY_WITH_RESOURCES +0 BugPattern UVA_USE_VAR_ARGS +0 BugPattern WEM_OBSCURING_EXCEPTION +0 BugPattern WEM_WEAK_EXCEPTION_MESSAGING Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/etc/findbugs.xml 2016-11-18 03:35:06 UTC (rev 1804) @@ -2,7 +2,7 @@ <!-- Plugin descriptor for fb-contrib plugin. This plugin is enabled by default. --> <FindbugsPlugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="findbugsplugin.xsd" pluginid="com.mebigfatguy.fbcontrib" defaultenabled="true" - provider="fb-contrib project" website="http://fb-contrib.sourceforge.net"> + provider="fb-contrib project" website="http://github.com/mebigfatguy/fb-contrib"> <!-- Passes --> @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -145,7 +145,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SCRV_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_SERIALVER_SHOULD_BE_PRIVATE,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,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL" /> + 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_SERIALVER_SHOULD_BE_PRIVATE,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,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" /> @@ -305,9 +305,14 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/> - <!-- COMMENT OUT FOR POINT RELEASE --> - <!-- COMMENT OUT FOR POINT RELEASE --> + <!-- COMMENT OUT FOR POINT RELEASE + <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/> + + <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousShadedClassUse" speed="fast" reports="SSCU_SUSPICIOUS_SHADED_CLASS_USE"/> + + COMMENT OUT FOR POINT RELEASE --> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -418,6 +423,7 @@ <BugPattern abbrev="SPP" type="SPP_CONVERSION_OF_STRING_LITERAL" category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_STATIC_FORMAT_STRING" category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_OPTIONAL" category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_WRONG_COMMONS_TO_STRING_OBJECT" 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" /> @@ -574,4 +580,6 @@ <BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE"/> <BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS"/> <BugPattern abbrev="CCI" type="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY" category="CORRECTNESS"/> + <BugPattern abbrev="UTWR" type="UTWR_USE_TRY_WITH_RESOURCES" category="STYLE" experimental="true"/> + <BugPattern abbrev="SSCU" type="SSCU_SUSPICIOUS_SHADED_CLASS_USE" category="CORRECTNESS" experimental="true"/> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/etc/messages.xml 2016-11-18 03:35:06 UTC (rev 1804) @@ -362,7 +362,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayBasedCollections"> <Details> <![CDATA[ - <p>Looks for methods that use arrays for items in the keyset of a map, or as + <p>Looks for methods that use arrays for items in the keySet of a map, or as an element of a set, or in a list when using the contains method. Since arrays do not, and cannot define an equals method, reference equality is used for these collections, which is probably not desired. If it is, consider using the IdentityHashMap @@ -1233,7 +1233,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals"> <Details> <![CDATA[ - <p>This detector looks for uses for Commons-lang EqualsBuilder where the + <p>This detector looks for uses for commons-lang EqualsBuilder where the result of equals() is returned instead of calling the method isEquals().</p> <p>It is a fast detector.</p> ]]> @@ -1243,7 +1243,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode"> <Details> <![CDATA[ - <p>This detector looks for uses for Commons-lang <code>HashCodeBuilder</code> where the + <p>This detector looks for uses for commons-lang <code>HashCodeBuilder</code> where the result of <code>hashCode()</code> is returned instead of calling the method <code>toHashCode()</code>.</p> <p>It is a fast detector.</p> ]]> @@ -1253,7 +1253,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsStringBuilderToString"> <Details> <![CDATA[ - <p>This detector looks for uses for Commons-lang <code>ToStringBuilder</code> where the + <p>This detector looks for uses for commons-lang <code>ToStringBuilder</code> where the result of <code>toString()</code> is returned without an intermediate invocation of toString().</p> <p>It is a fast detector.</p> ]]> @@ -1457,7 +1457,7 @@ <Details> <![CDATA[ <p>Looks for methods that perform arithmetic operations on values representing time - where the time unit is incompatible, ie adding a millisecond value to a nanosecond value. + where the time unit is incompatible, i.e. adding a millisecond value to a nanosecond value. </p> <p>It is a fast detector.</p> ]]> @@ -1632,11 +1632,38 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues"> <Details> <![CDATA[ - <p>Looks for problems with using concurrent collecctions</p> + <p>Looks for problems with using concurrent collections + <ul> + <li>Adding a collection as a value of Concurrent map, without the use of putIfAbsent</li> + </ul> + </p> <p>It is a fast detector.</p> ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources"> + <Details> + <![CDATA[ + <p>Looks for use of auto-closeable resources in JDK 7 or later that are not using + the try-with-resources paradigm. To avoid problems, and ease the reader, use of try-with-resources + is recommended</p> + <p>It is a fast detector.</p> + ]]> + </Details> + </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousShadedClassUse"> + <Details> + <![CDATA[ + <p>Looks for use of shaded methods from 3rdparty jars, created by tools such as the maven shade plugin. + These methods are from classes that have been included in a jar, for internal use, and are copies of real 3rdparty jars. + It is likely you meant to use the real class from the real jar, but your IDE picked the wrong import to use. + </p> + <p>It is a fast detector.</p> + ]]> + </Details> + </Detector> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger"> <Details></Details> @@ -3380,6 +3407,21 @@ ]]> </Details> </BugPattern> + + <BugPattern type="SPP_WRONG_COMMONS_TO_STRING_OBJECT"> + <ShortDescription>Method does not pass an object to commons-lang's ToStringBuilder</ShortDescription> + <LongDescription>Method {1} does not pass an object to commons-lang's ToStringBuilder</LongDescription> + <Details> + <![CDATA[[ + This method uses commons-lang, or commons-lang3's ToStringBuilder to attempt to output a representation of an object. + However, no object was passed, just the style specifier, and so the output will be of the ToStringStyle object itself. + Don't forget to include the object you wish to output as the first parameter, such as + <pre> + ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); + </pre> + ]]> + </Details> + </BugPattern> <BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE"> <ShortDescription>Method assigns a variable in a larger scope than is needed</ShortDescription> @@ -4791,6 +4833,7 @@ <li>Sets.newHashSetWithExpectedSize(int)</li> <li>Maps.newHashMapWithExpectedSize(int)</li> </ul> + If not, a good estimate would be the expectedSize / {LOADING_FACTOR} which by default is 0.75 </p> ]]> </Details> @@ -5595,6 +5638,47 @@ ]]> </Details> </BugPattern> + + <BugPattern type="UTWR_USE_TRY_WITH_RESOURCES"> + <ShortDescription>Method manually handles closing an auto-closeable resource</ShortDescription> + <LongDescription>Method {1} manually handles closing an auto-closeable resource</LongDescription> + <Details> + <![CDATA[[ + <p>This method allocates and uses a auto closeable resources. However it manually closes the resource in a finally block. + While this is correct management, it doesn't rely on the Idiomatic way available to JDK 7 and above, and allows for possible + subtle problems, and complicates the reading of code, by developers expecting the use of try-with-resources. + </p> + <p>Switch to using try with resources, as: + <pre> + try (InputStream is = getAStream()) { + useTheStream(is); + } + </pre> + ]]> + </Details> + </BugPattern> + + <BugPattern type="SSCU_SUSPICIOUS_SHADED_CLASS_USE"> + <ShortDescription>Method calls a method from a class that has been shaded by a 3rdparty jar</ShortDescription> + <LongDescription>Method {1} calls a method from a class that has been shaded by a 3rdparty jar</LongDescription> + <Details> + <![CDATA[ + <p>This method calls a method found in a 3rdparty library, which appears to be shaded from another 3rdparty library. + This occurs when a jar includes other code using tools like the maven shade plugin. It is likely you wanted to use the + "first-class" class from the original jar, rather than the class with the shaded package structure, but your IDE pulled in + the wrong import.</p> + <p>An example might be, you attempted to use a method from the class: + <pre><code> + com.google.common.collect.Sets + </code></pre> + But instead, you import: + <pre><code> + org.apache.jena.ext.com.google.common.collect.Sets + </code></pre> + </p> + ]]> + </Details> + </BugPattern> <!-- BugCode --> @@ -5733,4 +5817,6 @@ <BugCode abbrev="BL">Burying Logic</BugCode> <BugCode abbrev="WI">Wiring issues</BugCode> <BugCode abbrev="CCI">Concurrent Collection Issues</BugCode> + <BugCode abbrev="UTWR">Use Try With Resources</BugCode> + <BugCode abbrev="SSCU">Suspicious Shaded Class Use</BugCode> </MessageCollection> Modified: trunk/fb-contrib/etc/samples.fbp =================================================================== --- trunk/fb-contrib/etc/samples.fbp 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/etc/samples.fbp 2016-11-18 03:35:06 UTC (rev 1804) @@ -1,24 +1,28 @@ <Project projectName="sample"> - <Jar>./././../target/classes/samples</Jar> - <AuxClasspathEntry>./././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/commons-collections-3.2.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/log4j-1.2.17.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/commons-lang3-3.3.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/slf4j-api-1.7.7.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/guava-17.0.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/httpclient-4.3.4.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/httpclient-cache-4.3.4.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/httpcore-4.3.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/commons-codec-1.6.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/commons-io-1.3.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/junit-4.12.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/testng-6.9.6.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/jsr311-api-1.1.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> + <Jar>./../target/classes/samples</Jar> <AuxClasspathEntry>./../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>../lib/threetenbp-1.3.2.jar</AuxClasspathEntry> - <SrcDir>././././.</SrcDir> + <AuxClasspathEntry>./../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/commons-codec-1.10.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/commons-collections-3.2.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/commons-lang3-3.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/guava-19.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/httpclient-4.5.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/httpcore-4.4.5.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/jsr311-api-1.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/junit-4.12.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/log4j-1.2.17.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/threetenbp-1.3.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/commons-io-2.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/testng-6.9.10.jar</AuxClasspathEntry> + <SrcDir>../src/samples/java</SrcDir> </Project> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/htdocs/index.shtml 2016-11-18 03:35:06 UTC (rev 1804) @@ -68,7 +68,7 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.0 available for download + <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.1 available for download <a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p> <p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p> <p style="font-weight: bold;">Please note that active development for this project is now done on @@ -81,7 +81,13 @@ Detectors added in git<br/> <div id="git" style="display:none;"> <ul> - <li>--none yet--</li> + <li><b>[UTWR] Use Try With Resources</b><br/> + Looks for try/finally blocks that manage resources, without using try-with-resources. + </li> + <li><b>[SSCU] Suspicious Shaded Class Use</b><br/> + Looks for use of classes that have been shaded into 3rdparty jars, rather than using the + real class, from the real jar. + </li> </ul> </div> <hr/> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/htdocs/repository.html 2016-11-18 03:35:06 UTC (rev 1804) @@ -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.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>6.8.0</td></tr> + <tr><td><b>Version:</b></td><td>6.8.1</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2016-11-18 03:30:45 UTC (rev 1803) +++ trunk/fb-contrib/pom.xml 2016-11-18 03:35:06 UTC (rev 1804) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.9.0-SNAPSHOT</version> + <version>6.8.1</version> <prerequisites> <maven>2.2.1</maven> @@ -144,8 +144,8 @@ <scope>provided</scope> </dependency> <dependency><scope>test</scope><groupId>backport-util-concurrent</groupId><artifactId>backport-util-concurrent</artifactId><version>3.1</version></dependency> - <dependency><scope>test</scope><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>17.0</version></dependency> - <dependency><scope>test</scope><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.6</version></dependency> + <dependency><scope>test</scope><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>19.0</version></dependency> + <dependency><scope>test</scope><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.10</version></dependency> <dependency><scope>test</scope><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency> <dependency><scope>test</scope><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.1</version></dependency> <dependency><scope>test</scope><groupId>javax.persistence</groupId><artifactId>persistence-api</artifactId><version>1.0.2</version></dependency> @@ -155,22 +155,22 @@ <dependency><scope>test</scope><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency> <dependency><scope>test</scope><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency> <dependency><scope>test</scope><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.3</version></dependency> - <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.3.4</version></dependency> - <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpcore</artifactId><version>4.3.2</version></dependency> - <dependency><scope>test</scope><groupId>org.mockito</groupId><artifactId>mockito-all</artifactId><version>1.10.19</version></dependency> - <dependency><scope>test</scope><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.7</version></dependency> - <dependency><scope>test</scope><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>4.3.2.RELEASE</version></dependency> + <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5.2</version></dependency> + <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpcore</artifactId><version>4.4.5</version></dependency> + <dependency><scope>test</scope><groupId>org.mockito</groupId><artifactId>mockito-all</artifactId><version>2.0.2-beta</version></dependency> + <dependency><scope>test</scope><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.21</version></dependency> + <dependency><scope>test</scope><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>4.3.3.RELEASE</version></dependency> <dependency><scope>test</scope><groupId>org.testng</groupId><artifactId>testng</artifactId><version>6.9.10</version></dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> - <version>4.3.2.RELEASE</version> + <version>4.3.3.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> - <version>4.3.2.RELEASE</version> + <version>4.3.3.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -179,11 +179,15 @@ <version>1.3.2</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.jena</groupId> + <artifactId>jena-shaded-guava</artifactId> + <version>3.1.0</version> + <scope>test</scope> + </dependency> </dependencies> <build> - <sourceDirectory>${basedir}/src</sourceDirectory> - <testSourceDirectory>${basedir}/samples</testSourceDirectory> <outputDirectory>${basedir}/target/classes/main</outputDirectory> <resources> <resource> @@ -206,8 +210,9 @@ <plugins> <plugin><artifactId>maven-clean-plugin</artifactId><version>2.6.1</version></plugin> <plugin><groupId>org.codehaus.mojo</groupId><artifactId>buildnumber-maven-plugin</artifactId><version>1.3</version></plugin> + <plugin><groupId>org.codehaus.mojo</groupId><artifactId>build-helper-maven-plugin</artifactId><version>1.9.1</version></plugin> <plugin><groupId>org.codehaus.mojo</groupId><artifactId>findbugs-maven-plugin</artifactId><version>2.5.5</version></plugin> - <plugin><artifactId>maven-compiler-plugin</artifactId><version>3.1</version></plugin> + <plugin><artifactId>maven-compiler-plugin</artifactId><version>3.3</version></plugin> <plugin><artifactId>maven-deploy-plugin</artifactId><version>2.8.2</version></plugin> <plugin><artifactId>maven-install-plugin</artifactId><version>2.5.2</version></plugin> <plugin><artifactId>maven-jar-plugin</artifactId><version>2.6</version> @@ -232,6 +237,7 @@ </archive> </configuration> </plugin> + <plugin><artifactId>maven-pmd-plugin</artifactId><version>3.5</version></plugin> <plugin><artifactId>maven-project-info-reports-plugin</artifactId><version>2.7</version></plugin> <plugin><artifactId>maven-resources-plugin</artifactId><version>2.7</version></plugin> <plugin><artifactId>maven-site-plugin</artifactId><version>3.4</version></plugin> @@ -242,14 +248,13 @@ <plugins> <plugin> - <artifactId>maven-pmd-plugin</artifactId><version>3.6</version> + <artifactId>maven-pmd-plugin</artifactId> <dependencies> <dependency><groupId>net.sourceforge.pmd</groupId><artifactId>pmd-java</artifactId><version>5.5.1</version></dependency> <dependency><groupId>net.sourceforge.pmd</groupId><artifactId>pmd-core</artifactId><version>5.5.1</version></dependency> </dependencies> <configuration> <rulesets> - <ruleset>/rulesets/java/basic.xml</ruleset> <ruleset>/rulesets/java/clone.xml</ruleset> <ruleset>/rulesets/java/finalizers.xml</ruleset> <ruleset>/rulesets/java/imports.xml</ruleset> @@ -280,6 +285,51 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId><artifactId>build-helper-maven-plugin</artifactId> + <configuration> + <sources> + <source>src/samples/java</source> + </sources> + </configuration> + <executions> + <execution> + <id>add-test-source</id> + <goals> + <goal>add-test-source</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.10</version> + <executions> + <execution> + <id>unpack-findbugs-core</id> + <phase>process-test-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>com.google.code.findbugs</groupId> + <artifactId>findbugs</artifactId> + <version>3.0.1</version> + <type>jar</type> + <overWrite>true</overWrite> + <outputDirectory> + ${project.build.directory}/findbugs-3.0.1.jar/plugin + </outputDirectory> + </artifactItem> + </artifactItems> + <overWriteReleases>true</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + </configuration> + </execution> + </executio... [truncated message content] |
From: <dbr...@us...> - 2016-11-18 03:30:52
|
Revision: 1803 http://sourceforge.net/p/fb-contrib/code/1803 Author: dbrosius Date: 2016-11-18 03:30:45 +0000 (Fri, 18 Nov 2016) Log Message: ----------- move src to match git layout Added Paths: ----------- trunk/fb-contrib/etc/samples.fbp trunk/fb-contrib/src/main/ trunk/fb-contrib/src/main/java/ trunk/fb-contrib/src/main/java/com/ trunk/fb-contrib/src/samples/ trunk/fb-contrib/src/samples/java/ trunk/fb-contrib/src/samples/java/ABC_Sample.java trunk/fb-contrib/src/samples/java/ACEM_Sample.java trunk/fb-contrib/src/samples/java/AFBR_Sample.java trunk/fb-contrib/src/samples/java/AIOB_Sample.java trunk/fb-contrib/src/samples/java/AOM_Sample.java trunk/fb-contrib/src/samples/java/AWCBR_Sample.java trunk/fb-contrib/src/samples/java/BAS_Sample.java trunk/fb-contrib/src/samples/java/BED_Sample.java trunk/fb-contrib/src/samples/java/BL_Sample.java trunk/fb-contrib/src/samples/java/BRPI_Sample.java trunk/fb-contrib/src/samples/java/BSB_Sample.java trunk/fb-contrib/src/samples/java/CAAL_Sample.java trunk/fb-contrib/src/samples/java/CAO_Sample.java trunk/fb-contrib/src/samples/java/CBC_Sample.java trunk/fb-contrib/src/samples/java/CBX_Sample.java trunk/fb-contrib/src/samples/java/CCI_Sample.java trunk/fb-contrib/src/samples/java/CCNE_Sample.java trunk/fb-contrib/src/samples/java/CEBE_EqualsToEqualsSample.java trunk/fb-contrib/src/samples/java/CE_Sample.java trunk/fb-contrib/src/samples/java/CFS_Sample.java trunk/fb-contrib/src/samples/java/CHBH_HashcodeToHashcodeSample.java trunk/fb-contrib/src/samples/java/CLI_Sample.java trunk/fb-contrib/src/samples/java/CNC_Sample.java trunk/fb-contrib/src/samples/java/COM_Sample.java trunk/fb-contrib/src/samples/java/CRF_Sample.java trunk/fb-contrib/src/samples/java/CSBTS_StringToStringSample.java trunk/fb-contrib/src/samples/java/CSI_Sample.java trunk/fb-contrib/src/samples/java/CTU_Sample.java trunk/fb-contrib/src/samples/java/CU_Sample.java trunk/fb-contrib/src/samples/java/CVAA_Sample.java trunk/fb-contrib/src/samples/java/DDC_Sample.java trunk/fb-contrib/src/samples/java/DLC_Sample.java trunk/fb-contrib/src/samples/java/DMC_Sample.java trunk/fb-contrib/src/samples/java/DRE_Sample.java trunk/fb-contrib/src/samples/java/DSOC_Sample.java trunk/fb-contrib/src/samples/java/DTEP_Sample.java trunk/fb-contrib/src/samples/java/DWI_Sample.java trunk/fb-contrib/src/samples/java/EXS_Sample.java trunk/fb-contrib/src/samples/java/FCBL_Sample.java trunk/fb-contrib/src/samples/java/FCCD_Sample.java trunk/fb-contrib/src/samples/java/FPL_Sample.java trunk/fb-contrib/src/samples/java/FP_Sample.java trunk/fb-contrib/src/samples/java/HCP_Sample.java trunk/fb-contrib/src/samples/java/HES_Sample.java trunk/fb-contrib/src/samples/java/ICA_Sample.java trunk/fb-contrib/src/samples/java/IICU_Sample.java trunk/fb-contrib/src/samples/java/IKNC_Sample.java trunk/fb-contrib/src/samples/java/IMC_Sample.java trunk/fb-contrib/src/samples/java/IOI_Sample.java trunk/fb-contrib/src/samples/java/IPU_Sample.java trunk/fb-contrib/src/samples/java/ISB_Sample.java trunk/fb-contrib/src/samples/java/ITC_Sample.java trunk/fb-contrib/src/samples/java/ITU_Sample.java trunk/fb-contrib/src/samples/java/JPAI_Sample.java trunk/fb-contrib/src/samples/java/JVR_Sample.java trunk/fb-contrib/src/samples/java/JXI_Sample.java trunk/fb-contrib/src/samples/java/LEST_Sample.java trunk/fb-contrib/src/samples/java/LGO_Sample.java trunk/fb-contrib/src/samples/java/LII_Sample.java trunk/fb-contrib/src/samples/java/LO_Sample.java trunk/fb-contrib/src/samples/java/LSC_Sample.java trunk/fb-contrib/src/samples/java/LSYC_Sample.java trunk/fb-contrib/src/samples/java/MAC_Sample.java trunk/fb-contrib/src/samples/java/MDM_Sample.java trunk/fb-contrib/src/samples/java/MOM_Sample.java trunk/fb-contrib/src/samples/java/MRC_Sample.java trunk/fb-contrib/src/samples/java/MTA_Sample.java trunk/fb-contrib/src/samples/java/MUC_Sample.java trunk/fb-contrib/src/samples/java/NAB_Sample.java trunk/fb-contrib/src/samples/java/NCMU_Sample.java trunk/fb-contrib/src/samples/java/NCS_Sample.java trunk/fb-contrib/src/samples/java/NFF_Sample.java trunk/fb-contrib/src/samples/java/NIR_Sample.java trunk/fb-contrib/src/samples/java/NMCS_Sample.java trunk/fb-contrib/src/samples/java/NOS_Sample.java trunk/fb-contrib/src/samples/java/NPMC_Sample.java trunk/fb-contrib/src/samples/java/NRTL_Sample.java trunk/fb-contrib/src/samples/java/NSE_Sample.java trunk/fb-contrib/src/samples/java/OCP_Sample.java trunk/fb-contrib/src/samples/java/OC_Sample.java trunk/fb-contrib/src/samples/java/ODN_Sample.java trunk/fb-contrib/src/samples/java/OPM_Sample.java trunk/fb-contrib/src/samples/java/PCAIL_Sample.java trunk/fb-contrib/src/samples/java/PCOA_Sample.java trunk/fb-contrib/src/samples/java/PDP_Sample.java trunk/fb-contrib/src/samples/java/PIS_Sample.java trunk/fb-contrib/src/samples/java/PL_Sample.java trunk/fb-contrib/src/samples/java/PMB_Sample.java trunk/fb-contrib/src/samples/java/PME_Sample.java trunk/fb-contrib/src/samples/java/PRMC_Sample.java trunk/fb-contrib/src/samples/java/PSC_Sample.java trunk/fb-contrib/src/samples/java/PUS_Sample.java trunk/fb-contrib/src/samples/java/ROOM_Sample.java trunk/fb-contrib/src/samples/java/S508C_Sample.java trunk/fb-contrib/src/samples/java/SACM_Sample.java trunk/fb-contrib/src/samples/java/SCA_Sample.java trunk/fb-contrib/src/samples/java/SCII_Sample.java trunk/fb-contrib/src/samples/java/SCI_Sample.java trunk/fb-contrib/src/samples/java/SCRV_Sample.java trunk/fb-contrib/src/samples/java/SCR_Sample.java trunk/fb-contrib/src/samples/java/SCSS_Sample.java trunk/fb-contrib/src/samples/java/SEC_Sample.java trunk/fb-contrib/src/samples/java/SEO_Sample.java trunk/fb-contrib/src/samples/java/SGSU_Sample.java trunk/fb-contrib/src/samples/java/SG_Sample.java trunk/fb-contrib/src/samples/java/SIL_Sample.java trunk/fb-contrib/src/samples/java/SJVU_Sample.java trunk/fb-contrib/src/samples/java/SLS_Sample.java trunk/fb-contrib/src/samples/java/SMII_Sample.java trunk/fb-contrib/src/samples/java/SNG_Sample.java trunk/fb-contrib/src/samples/java/SPP_Sample.java trunk/fb-contrib/src/samples/java/STB_Sample.java trunk/fb-contrib/src/samples/java/STS_Sample.java trunk/fb-contrib/src/samples/java/STT_Sample.java trunk/fb-contrib/src/samples/java/SUA_Sample.java trunk/fb-contrib/src/samples/java/SWCO_Sample.java trunk/fb-contrib/src/samples/java/TBP_Sample.java trunk/fb-contrib/src/samples/java/TR_Sample.java trunk/fb-contrib/src/samples/java/UAA_Sample.java trunk/fb-contrib/src/samples/java/UCC_Sample.java trunk/fb-contrib/src/samples/java/UCPM_Sample.java trunk/fb-contrib/src/samples/java/UEC_Sample.java trunk/fb-contrib/src/samples/java/UMTP_Sample.java trunk/fb-contrib/src/samples/java/UNNC_Sample.java trunk/fb-contrib/src/samples/java/UP_Sample.java trunk/fb-contrib/src/samples/java/URV_Sample.java trunk/fb-contrib/src/samples/java/USBR_Sample.java trunk/fb-contrib/src/samples/java/USS_Sample.java trunk/fb-contrib/src/samples/java/UTAO_Sample.java trunk/fb-contrib/src/samples/java/UTA_Sample.java trunk/fb-contrib/src/samples/java/UVA_Sample.java trunk/fb-contrib/src/samples/java/WEM_Sample.java trunk/fb-contrib/src/samples/java/WI_Sample.java trunk/fb-contrib/src/samples/java/WOC_Sample.java trunk/fb-contrib/src/samples/java/samples-bugs.xml Removed Paths: ------------- trunk/fb-contrib/samples/ABC_Sample.java trunk/fb-contrib/samples/ACEM_Sample.java trunk/fb-contrib/samples/AFBR_Sample.java trunk/fb-contrib/samples/AIOB_Sample.java trunk/fb-contrib/samples/AOM_Sample.java trunk/fb-contrib/samples/AWCBR_Sample.java trunk/fb-contrib/samples/BAS_Sample.java trunk/fb-contrib/samples/BED_Sample.java trunk/fb-contrib/samples/BL_Sample.java trunk/fb-contrib/samples/BRPI_Sample.java trunk/fb-contrib/samples/BSB_Sample.java trunk/fb-contrib/samples/CAAL_Sample.java trunk/fb-contrib/samples/CAO_Sample.java trunk/fb-contrib/samples/CBC_Sample.java trunk/fb-contrib/samples/CBX_Sample.java trunk/fb-contrib/samples/CCI_Sample.java trunk/fb-contrib/samples/CCNE_Sample.java trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java trunk/fb-contrib/samples/CE_Sample.java trunk/fb-contrib/samples/CFS_Sample.java trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java trunk/fb-contrib/samples/CLI_Sample.java trunk/fb-contrib/samples/CNC_Sample.java trunk/fb-contrib/samples/COM_Sample.java trunk/fb-contrib/samples/CRF_Sample.java trunk/fb-contrib/samples/CSBTS_StringToStringSample.java trunk/fb-contrib/samples/CSI_Sample.java trunk/fb-contrib/samples/CTU_Sample.java trunk/fb-contrib/samples/CU_Sample.java trunk/fb-contrib/samples/CVAA_Sample.java trunk/fb-contrib/samples/DDC_Sample.java trunk/fb-contrib/samples/DLC_Sample.java trunk/fb-contrib/samples/DMC_Sample.java trunk/fb-contrib/samples/DRE_Sample.java trunk/fb-contrib/samples/DSOC_Sample.java trunk/fb-contrib/samples/DTEP_Sample.java trunk/fb-contrib/samples/DWI_Sample.java trunk/fb-contrib/samples/EXS_Sample.java trunk/fb-contrib/samples/FCBL_Sample.java trunk/fb-contrib/samples/FCCD_Sample.java trunk/fb-contrib/samples/FPL_Sample.java trunk/fb-contrib/samples/FP_Sample.java trunk/fb-contrib/samples/HCP_Sample.java trunk/fb-contrib/samples/HES_Sample.java trunk/fb-contrib/samples/ICA_Sample.java trunk/fb-contrib/samples/IICU_Sample.java trunk/fb-contrib/samples/IKNC_Sample.java trunk/fb-contrib/samples/IMC_Sample.java trunk/fb-contrib/samples/IOI_Sample.java trunk/fb-contrib/samples/IPU_Sample.java trunk/fb-contrib/samples/ISB_Sample.java trunk/fb-contrib/samples/ITC_Sample.java trunk/fb-contrib/samples/ITU_Sample.java trunk/fb-contrib/samples/JPAI_Sample.java trunk/fb-contrib/samples/JVR_Sample.java trunk/fb-contrib/samples/JXI_Sample.java trunk/fb-contrib/samples/LEST_Sample.java trunk/fb-contrib/samples/LGO_Sample.java trunk/fb-contrib/samples/LII_Sample.java trunk/fb-contrib/samples/LO_Sample.java trunk/fb-contrib/samples/LSC_Sample.java trunk/fb-contrib/samples/LSYC_Sample.java trunk/fb-contrib/samples/MAC_Sample.java trunk/fb-contrib/samples/MDM_Sample.java trunk/fb-contrib/samples/MOM_Sample.java trunk/fb-contrib/samples/MRC_Sample.java trunk/fb-contrib/samples/MTA_Sample.java trunk/fb-contrib/samples/MUC_Sample.java trunk/fb-contrib/samples/NAB_Sample.java trunk/fb-contrib/samples/NCMU_Sample.java trunk/fb-contrib/samples/NCS_Sample.java trunk/fb-contrib/samples/NFF_Sample.java trunk/fb-contrib/samples/NIR_Sample.java trunk/fb-contrib/samples/NMCS_Sample.java trunk/fb-contrib/samples/NOS_Sample.java trunk/fb-contrib/samples/NPMC_Sample.java trunk/fb-contrib/samples/NRTL_Sample.java trunk/fb-contrib/samples/NSE_Sample.java trunk/fb-contrib/samples/OCP_Sample.java trunk/fb-contrib/samples/OC_Sample.java trunk/fb-contrib/samples/ODN_Sample.java trunk/fb-contrib/samples/OPM_Sample.java trunk/fb-contrib/samples/PCAIL_Sample.java trunk/fb-contrib/samples/PCOA_Sample.java trunk/fb-contrib/samples/PDP_Sample.java trunk/fb-contrib/samples/PIS_Sample.java trunk/fb-contrib/samples/PL_Sample.java trunk/fb-contrib/samples/PMB_Sample.java trunk/fb-contrib/samples/PME_Sample.java trunk/fb-contrib/samples/PRMC_Sample.java trunk/fb-contrib/samples/PSC_Sample.java trunk/fb-contrib/samples/PUS_Sample.java trunk/fb-contrib/samples/ROOM_Sample.java trunk/fb-contrib/samples/S508C_Sample.java trunk/fb-contrib/samples/SACM_Sample.java trunk/fb-contrib/samples/SCA_Sample.java trunk/fb-contrib/samples/SCII_Sample.java trunk/fb-contrib/samples/SCI_Sample.java trunk/fb-contrib/samples/SCRV_Sample.java trunk/fb-contrib/samples/SCR_Sample.java trunk/fb-contrib/samples/SCSS_Sample.java trunk/fb-contrib/samples/SEC_Sample.java trunk/fb-contrib/samples/SEO_Sample.java trunk/fb-contrib/samples/SGSU_Sample.java trunk/fb-contrib/samples/SG_Sample.java trunk/fb-contrib/samples/SIL_Sample.java trunk/fb-contrib/samples/SJVU_Sample.java trunk/fb-contrib/samples/SLS_Sample.java trunk/fb-contrib/samples/SMII_Sample.java trunk/fb-contrib/samples/SNG_Sample.java trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/samples/STB_Sample.java trunk/fb-contrib/samples/STS_Sample.java trunk/fb-contrib/samples/STT_Sample.java trunk/fb-contrib/samples/SUA_Sample.java trunk/fb-contrib/samples/SWCO_Sample.java trunk/fb-contrib/samples/TBP_Sample.java trunk/fb-contrib/samples/TR_Sample.java trunk/fb-contrib/samples/UAA_Sample.java trunk/fb-contrib/samples/UCC_Sample.java trunk/fb-contrib/samples/UCPM_Sample.java trunk/fb-contrib/samples/UEC_Sample.java trunk/fb-contrib/samples/UMTP_Sample.java trunk/fb-contrib/samples/UNNC_Sample.java trunk/fb-contrib/samples/UP_Sample.java trunk/fb-contrib/samples/URV_Sample.java trunk/fb-contrib/samples/USBR_Sample.java trunk/fb-contrib/samples/USS_Sample.java trunk/fb-contrib/samples/UTAO_Sample.java trunk/fb-contrib/samples/UTA_Sample.java trunk/fb-contrib/samples/UVA_Sample.java trunk/fb-contrib/samples/WEM_Sample.java trunk/fb-contrib/samples/WI_Sample.java trunk/fb-contrib/samples/WOC_Sample.java trunk/fb-contrib/samples/samples-bugs.xml trunk/fb-contrib/samples/samples.fbp trunk/fb-contrib/src/com/ Property Changed: ---------------- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/package.html Copied: trunk/fb-contrib/etc/samples.fbp (from rev 1800, trunk/fb-contrib/samples/samples.fbp) =================================================================== --- trunk/fb-contrib/etc/samples.fbp (rev 0) +++ trunk/fb-contrib/etc/samples.fbp 2016-11-18 03:30:45 UTC (rev 1803) @@ -0,0 +1,24 @@ +<Project projectName="sample"> + <Jar>./././../target/classes/samples</Jar> + <AuxClasspathEntry>./././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-collections-3.2.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/log4j-1.2.17.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-lang3-3.3.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/slf4j-api-1.7.7.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/guava-17.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/httpclient-4.3.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/httpclient-cache-4.3.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/httpcore-4.3.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-codec-1.6.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-io-1.3.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/junit-4.12.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/testng-6.9.6.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/jsr311-api-1.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>../lib/threetenbp-1.3.2.jar</AuxClasspathEntry> + <SrcDir>././././.</SrcDir> +</Project> Deleted: trunk/fb-contrib/samples/ABC_Sample.java =================================================================== --- trunk/fb-contrib/samples/ABC_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/ABC_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,42 +0,0 @@ -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -public class ABC_Sample { - public Map<String[], String> testMaps(String[] key, String value) { - Map<String[], String> m = new HashMap<String[], String>(); - m.put(key, value); - return m; - } - - public Set<String[]> testSets(String[] values) { - Set<String[]> s = new HashSet<String[]>(); - s.add(values); - return s; - } - - public boolean testLists(List<String[]> l, String[] value) { - return l.contains(value); - } - - public static class UseComparator { - private Map<byte[], byte[]> testComp; - - public UseComparator() { - testComp = new TreeMap<byte[], byte[]>(new Comparator<byte[]>() { - @Override - public int compare(byte[] b1, byte[] b2) { - return b1.length - b2.length; - } - }); - } - - public void testc() { - testComp.put(new byte[5], new byte[3]); - } - } -} Deleted: trunk/fb-contrib/samples/ACEM_Sample.java =================================================================== --- trunk/fb-contrib/samples/ACEM_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/ACEM_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,19 +0,0 @@ - -public abstract class ACEM_Sample implements Foo { - public void test() { - } - - public int test1() { - throw new UnsupportedOperationException("Not implemented"); - } - - @Override - public void doFPFoo() { - } - - -} - -interface Foo { - void doFPFoo(); -} \ No newline at end of file Deleted: trunk/fb-contrib/samples/AFBR_Sample.java =================================================================== --- trunk/fb-contrib/samples/AFBR_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/AFBR_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,57 +0,0 @@ -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -@SuppressWarnings("all") -public class AFBR_Sample { - public int test1(boolean b) { - try { - int i = 0; - } finally { - if (b) - return 0; - int j = 0; - } - return 2; - } - - public int test2() { - try { - return 0; - } finally { - throw new NullPointerException(); - } - } - - public int test3() throws Exception { - try { - return 0; - } finally { - throw new Exception(); - } - } - - public int test4() { - try { - throw new Exception(); - } catch (Exception e) { - return 1; - } finally { - return 0; - } - } - - public int test5() throws IOException { - InputStream is = null; - try { - is = new FileInputStream("test"); - return 1; - } catch (IOException ioe) { - System.out.println("error"); - } finally { - if (is != null) - is.close(); - } - return 0; - } -} \ No newline at end of file Deleted: trunk/fb-contrib/samples/AIOB_Sample.java =================================================================== --- trunk/fb-contrib/samples/AIOB_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/AIOB_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,66 +0,0 @@ -import java.util.List; - -public class AIOB_Sample { - int[] fa = new int[4]; - int[] fb; - - public void testOutOfBounds() { - int[] a = new int[4]; - - a[4] = 2; - fa[4] = 2; - } - - public void testOutOfBoundsGuard() { - int[] a = new int[4]; - - if (a.length > 4) { - a[4] = 2; - } - } - - public void testUnallocated() { - int[] b = null; - - 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; - } - - public void fpPostAllocate() { - double[] da = null; - - for (int i = 0; i < 10; i++) { - if ((i & 1) == 1) { - da[0] = 0.0; - } - - if (da == null) - da = new double[10]; - } - } - - public void fpPlusEquals(List<String> ss) { - int size = 0; - - for (String s : ss) { - size += s.length(); - } - - int[] a = new int[size]; - - a[0] = 1; - } -} Deleted: trunk/fb-contrib/samples/AOM_Sample.java =================================================================== --- trunk/fb-contrib/samples/AOM_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/AOM_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,17 +0,0 @@ -class AOM_Super { - public void test1() { - test2(); - System.out.println("test"); - } - - private void test2() { - System.out.println("test"); - } -} - -public abstract class AOM_Sample extends AOM_Super { - @Override - public abstract void test1(); - - public abstract void test2(); -} Deleted: trunk/fb-contrib/samples/AWCBR_Sample.java =================================================================== --- trunk/fb-contrib/samples/AWCBR_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/AWCBR_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,42 +0,0 @@ -import java.lang.reflect.Method; -import java.util.HashSet; -import java.util.Set; - -public class AWCBR_Sample { - public void m(int[] v) { - v[0]++; - } - - public int testuninitedalloc(int i) { - int[] data = new int[1]; - data[0] = i; - m(data); - i = data[0]; - return i; - } - - public int testinitedalloc(int i) { - int[] data = new int[] { i }; - m(data); - i = data[0]; - return i; - } - - public int testNoCall(int i) { - // while silly don't report this, as there is no arg usage - int[] data = new int[] { i }; - i = data[0]; - return i; - } - - public boolean testFPInvoke(Method m) throws Exception { - - Set<String> s = new HashSet<String>(); - Object[] args = new Object[] { s }; - m.invoke(this, args); - - s = (Set<String>) args[0]; - - return s.isEmpty(); - } -} Deleted: trunk/fb-contrib/samples/BAS_Sample.java =================================================================== --- trunk/fb-contrib/samples/BAS_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/BAS_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,254 +0,0 @@ -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ForkJoinPool; -import java.util.concurrent.Future; - -@SuppressWarnings("all") -public class BAS_Sample { - private final Map<String, String> m = new HashMap<>(); - - private long value = 0; - private Long stash = Long.valueOf(0); - - public void testIfScope(String s) { - Object o = new Object(); - if (s.equals("Foo")) { - s = o.toString(); - } - } - - public String testFPForScope(String s) { - Object o = new Object(); - while (s.length() > 0) { - o = s.substring(0, 1); - s = s.substring(1); - } - return s; - } - - public String testFP2Scopes(String s) { - Object o = new Object(); - if (s.equals("Boo")) { - s = o.toString(); - } else if (s.equals("Hoo")) { - s = o.toString(); - } - - return s; - } - - public String test2InnerScopes(String s) { - Object o = new Object(); - if (s != null) { - if (s.equals("Boo")) { - s = o.toString(); - } else if (s.equals("Hoo")) { - s = o.toString(); - } - } - - return s; - } - - public String testFPLoopCond(List<String> in) { - StringBuilder sb = new StringBuilder(); - for (String s : in) { - sb.append(s); - } - return sb.toString(); - } - - public List<String> getList() { - return null; - } - - public String testSwitch(int a) { - String v = "Test"; - - switch (a) { - case 1: - v = "Testa"; - break; - - case 2: - v = "Tesseract"; - break; - - case 3: - v = "Testy"; - break; - - default: - v = "Rossa"; - break; - } - - return null; - } - - public void testFPSync(Set<String> a, Set<String> b) { - String c, d; - - synchronized (this) { - c = a.iterator().next(); - d = b.iterator().next(); - } - - if (d.length() > 0) { - d = c; - } - } - - public int testFPObjChange(Calendar c, boolean b) { - int hour = c.get(Calendar.HOUR_OF_DAY); - c.set(2000, Calendar.JANUARY, 1); - - if (b) { - return hour; - } - - return 0; - } - - public void tstFPThisRefChange(long v, boolean b) { - long oldValue = this.value; - this.value = v; - - if (b) { - if (oldValue < 0) { - System.out.println("Negative"); - } - } - } - - public void tstFPRefChange(Holder h1, Holder h2, boolean b) { - - int h = h1.member; - h1 = h2; - - if (b) { - System.out.println(h); - } - } - - public void tstFPRefChangeThruMethodChain(Holder h1, Holder h2, boolean b) { - - String h = h1.toString().trim(); - h1 = h2; - - if (b) { - System.out.println(h); - } - } - - public Long testFPRefNull(boolean b) { - - Long save = stash; - stash = null; - - if (b) { - return save; - } - - return null; - - } - - public void testFPSrcOverwrite(int src, boolean b) { - int d = src; - src = 0; - - if (b) { - System.out.println(d); - } - } - - public void testFPRiskies1(boolean b) { - long start = System.currentTimeMillis(); - - if (b) { - long delta = System.currentTimeMillis() - start; - System.out.println(delta); - } - } - - public String testFPIteratorNext(Collection<String> c, boolean b) { - Iterator<String> it = c.iterator(); - - String s = it.next(); - - if (b) { - if (s == null) { - return "yay"; - } - } - - return it.next(); - } - - public List<String> testFPSynchronized(String s, String p) { - List<String> l = new ArrayList<>(); - String x = s; - synchronized (s) { - if (p != null) { - l.add(p); - return l; - } - } - - return null; - } - - public void testFPNestedIfs(Map<String, String> x, int i, boolean b) { - - String s = x.get("hello"); - - if (i == 0) { - if (b) { - System.out.println(s); - } - } else if (i == 1) { - System.out.println(s); - } else if (i == 2) { - System.out.println(s); - } - } - - public boolean testFPFuture(boolean b) { - ExecutorService s = new ForkJoinPool(); - Future f = s.submit(new Runnable() { - @Override - public void run() { - } - }); - if (b) { - if (f.isDone()) { - return true; - } - } - - return false; - } - - public int testFPTwoCatches(List<Integer> x) throws Exception { - String msg = "This is a test"; - try { - return x.size() * x.get(0); - } catch (NullPointerException e) { - throw new Exception(msg + "NPE", e); - } catch (IndexOutOfBoundsException e) { - throw new Exception(msg + "IIOBE", e); - } - } - - static class Holder { - int member; - } -} Deleted: trunk/fb-contrib/samples/BED_Sample.java =================================================================== --- trunk/fb-contrib/samples/BED_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/BED_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,120 +0,0 @@ -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.sql.SQLException; -import java.util.Hashtable; -import java.util.zip.DataFormatException; - -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.directory.InitialDirContext; - -@SuppressWarnings("all") -public class BED_Sample { - IOException ioe; - - public BED_Sample() throws IOException { - - } - - public BED_Sample(String name) throws NamingException { - Hashtable<String, String> env = new Hashtable<>(); - env.put("name", name); - DirContext context = new InitialDirContext(env); - } - - public void doesTheNasty() throws FileNotFoundException, IOException { - - } - - public void doesTheNasty2() throws IOException, FileNotFoundException { - - } - - public void fpJustAwful() throws IOException, Exception { - - } - - private void badThrow() throws SQLException { - - } - - public static void badStatic() throws DataFormatException { - - } - - public final void badFinal() throws ClassNotFoundException { - - } - - public static void doIt() throws SQLException, IOException { - InputStream is = new FileInputStream("c:\\temp.txt"); - } - - public static void fp() throws Exception { - InputStream is = new FileInputStream("c:\\temp.txt"); - } - - private void fpThrowField(boolean b) throws IOException { - if (b) { - throw ioe; - } else { - IOException e = ioe; - throw ioe; - } - } - - static void fpJustThrowIt(boolean permissible, String message) throws IOException { - IOException e = new FileNotFoundException(message); - if (!permissible) { - throw e; - } - } - - public Object iAmCreatingAnObject() { - return new Object() { - private byte[] iHaveToThrowAnException() throws IOException { - return BED_Sample.this.iThrowAnException(); - } - }; - } - - private byte[] iThrowAnException() throws IOException { - File.createTempFile("foo", "bar"); - return "Test".getBytes("UTF-8"); - } - - private void issue92a() throws InterruptedException { - System.out.println("test"); - } - - public static void issue92b() throws InterruptedException { - System.out.println("test"); - } - - public static Process fpInterrupted(String command) throws IOException, InterruptedException { - - Object sync = new Object(); - Process p = Runtime.getRuntime().exec(command); - synchronized (sync) { - sync.wait(); - } - - return p; - } - - static class FPAnonBase { - - FPAnonBase(InputStream is) throws IOException { - int i = is.read(); - } - - public static FPAnonBase makeAnon(InputStream is) throws IOException { - return new FPAnonBase(is) { - }; - } - } - -} Deleted: trunk/fb-contrib/samples/BL_Sample.java =================================================================== --- trunk/fb-contrib/samples/BL_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/BL_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,83 +0,0 @@ -import java.util.List; - -public class BL_Sample { - - public String testSimpleBurying() { - - List<String> details = getDetails(); - if (details != null) { - StringBuilder sb = new StringBuilder(); - - for (String d : details) { - sb.append(d); - } - - return sb.toString(); - } - - return null; - } - - public boolean fpNonAbsoluteReturn(Throwable t) { - if ((t != null) && (t.getCause() != null)) { - Throwable cause = t.getCause(); - if (cause instanceof java.lang.Error) { - return t instanceof OutOfMemoryError; - } - } - return false; - } - - public String fpNonReturnedIfChain(String name) { - if ("<clinit>".equals(name)) { - System.out.println("static initializer declared"); - } else { - System.out.println("not allowed method declared: " + name); - return "wow: " + name; - } - return null; - } - - public String fpBuryingSwitch(String data) { - switch (data) { - case "a": - return fpBuryingSwitch(data + "fe") + data; - case "b": - return fpBuryingSwitch(data + "fi") + data; - case "c": - return fpBuryingSwitch(data + "fo") + data; - case "d": - return fpBuryingSwitch(data + "fum") + data; - } - return ""; - } - - public String fpIfElseReturnChain(Object c) { - if (c instanceof String) { - return "S" + c.getClass().getName(); - } else if (c instanceof Integer) { - return "I" + c.getClass().getName(); - } else if (c instanceof Double) { - return "D" + c.getClass().getName(); - } - - return null; - } - - public String fpIfElseTailReturnChain(Object c) { - String s; - if (c instanceof String) { - s = "S" + c.getClass().getName(); - } else if (c instanceof Integer) { - s = "I" + c.getClass().getName(); - } else if (c instanceof Double) { - return "D" + c.getClass().getName(); - } - - return null; - } - - private List<String> getDetails() { - return null; - } -} Deleted: trunk/fb-contrib/samples/BRPI_Sample.java =================================================================== --- trunk/fb-contrib/samples/BRPI_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/BRPI_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,18 +0,0 @@ - -import org.threeten.bp.LocalDate; - -import edu.emory.mathcs.backport.java.util.Collections; -import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; -import edu.emory.mathcs.backport.java.util.concurrent.Executors; - -public class BRPI_Sample { - public void emory() { - Collections.emptySet(); - Executors.newCachedThreadPool(); - new ConcurrentHashMap(); - } - - public void threeten() { - LocalDate d = LocalDate.now(); - } -} Deleted: trunk/fb-contrib/samples/BSB_Sample.java =================================================================== --- trunk/fb-contrib/samples/BSB_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/BSB_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,69 +0,0 @@ -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -@SuppressWarnings("all") -public class BSB_Sample { - private Object lock = new Object(); - private Set<String> info = new HashSet<String>(); - private Map<String, Object> synchMap = Collections.synchronizedMap(new HashMap<String, Object>()); - - public void testFieldBeginBloated(int i, int j) { - synchronized (lock) { - StringBuffer sb = new StringBuffer(); - sb.append("Test"); - sb.append(i); - info.add(sb.toString()); - } - } - - public void testLocalBeginBloated(int j) { - Set<String> i = getInfo(); - synchronized (i) { - StringBuffer sb = new StringBuffer(); - sb.append("Test"); - sb.append(j); - i.add(sb.toString()); - } - } - - public void testAliasedLocalBeginBloated(int j) { - Set<String> i = getInfo(); - synchronized (info) { - StringBuffer sb = new StringBuffer(); - sb.append("Test"); - sb.append(j); - i.add(sb.toString()); - } - } - - public void testBranchCutDown(int j) { - Set<String> i = getInfo(); - synchronized (i) { - StringBuffer sb = new StringBuffer(); - if (sb.length() > 0) { - sb.append("Test"); - sb.append(j); - i.add(sb.toString()); - } - } - } - - public Set<String> getInfo() { - return info; - } - - public void accessSyncMap() { - Set keySet = synchMap.keySet(); - synchronized (synchMap) { - for (Iterator it = keySet.iterator(); it.hasNext();) { - String key = (String) it.next(); - Object obj = synchMap.get(key); - } - } - } - -} Deleted: trunk/fb-contrib/samples/CAAL_Sample.java =================================================================== --- trunk/fb-contrib/samples/CAAL_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CAAL_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,37 +0,0 @@ -import java.util.Arrays; -import java.util.List; - -public class CAAL_Sample { - - public void testCAAL(int[] v) { - List l = Arrays.asList(v); - } - - public void testCAAL(char[] v) { - List l = Arrays.asList(v); - } - - public void testCAAL(byte[] v) { - List l = Arrays.asList(v); - } - - public void testCAAL(short[] v) { - List l = Arrays.asList(v); - } - - public void testCAAL(long[] v) { - List l = Arrays.asList(v); - } - - public void testCAAL(float[] v) { - List l = Arrays.asList(v); - } - - public void testCAAL(double[] v) { - List l = Arrays.asList(v); - } - - public void testCAAL(boolean[] v) { - List l = Arrays.asList(v); - } -} Deleted: trunk/fb-contrib/samples/CAO_Sample.java =================================================================== --- trunk/fb-contrib/samples/CAO_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CAO_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,42 +0,0 @@ - -public class CAO_Sample { - public void testci(Character c) { - System.out.println("Character"); - } - - public void testci(int i) { - System.out.println("int"); - } - - public void testcj(Character c) { - System.out.println("Character"); - } - - public void testcj(long l) { - System.out.println("long"); - } - - public void testcd(Character c) { - System.out.println("Character"); - } - - public void testcd(double d) { - System.out.println("double"); - } - - public void testcf(Character c) { - System.out.println("Character"); - } - - public void testcf(float f) { - System.out.println("float"); - } - - public static void main(String[] args) { - CAO_Sample s = new CAO_Sample(); - s.testci('a'); - s.testcj('a'); - s.testcd('a'); - s.testcf('a'); - } -} \ No newline at end of file Deleted: trunk/fb-contrib/samples/CBC_Sample.java =================================================================== --- trunk/fb-contrib/samples/CBC_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CBC_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,47 +0,0 @@ - -public class CBC_Sample { - - private static final Integer ONE = Integer.valueOf(1); - private static final Integer TWO = Integer.valueOf(2); - private static final Integer THREE = Integer.valueOf(3); - - enum Giant { - Fee, Fi, Fo, Fum - }; - - public void testCBCStrings(String x) { - if (x.equals("foo") || x.equals("bar") || x.equals("baz")) { - System.out.println("yup"); - } - } - - public void testCBCClass(Class<?> x) { - if (x.equals(String.class) || x.equals(Integer.class) || x.equals(Long.class)) { - System.out.println("yup"); - } - } - - public void testCBCEnum(Giant x) { - if (x.equals(Giant.Fee) || x.equals(Giant.Fi) || x.equals(Giant.Fo) || x.equals(Giant.Fum)) { - System.out.println("yup"); - } - } - - public void testCBCEnumDoubleEquals(Giant x) { - if ((x == Giant.Fee) || (x == Giant.Fi) || (x == Giant.Fo) || (x == Giant.Fum)) { - System.out.println("yup"); - } - } - - public void testCBCInteger(Integer x) { - if (x.equals(ONE) || x.equals(TWO) || x.equals(THREE)) { - System.out.println("yup"); - } - } - - public void testCBCPrimitiveInt(int x) { - if ((x == 1) || (x == 2) || (x == 3)) { - System.out.println("yup"); - } - } -} Deleted: trunk/fb-contrib/samples/CBX_Sample.java =================================================================== --- trunk/fb-contrib/samples/CBX_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CBX_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,9 +0,0 @@ -public class CBX_Sample { - public String testBuildXML(int val, String info) { - StringBuffer sb = new StringBuffer(); - sb.append("<sample>"); - sb.append("<test name='" + val + "'>" + info + "</test>"); - sb.append("</sample>"); - return sb.toString(); - } -} Deleted: trunk/fb-contrib/samples/CCI_Sample.java =================================================================== --- trunk/fb-contrib/samples/CCI_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CCI_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,21 +0,0 @@ -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -public class CCI_Sample { - - private Map<String, Set<String>> map = new ConcurrentHashMap<>(); - - public void update(String key, String value) { - - Set<String> values = map.get(key); - - if (values == null) { - values = Collections.<String> newSetFromMap(new ConcurrentHashMap<String, Boolean>()); - map.put(key, values); - } - - values.add(value); - } -} Deleted: trunk/fb-contrib/samples/CCNE_Sample.java =================================================================== --- trunk/fb-contrib/samples/CCNE_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CCNE_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,14 +0,0 @@ -public class CCNE_Sample { - public void compareClassEquals() { - Object o = new CCNE_Sample(); - Object p = new CCNE_Sample(); - System.out.println(o.getClass().getName().equals(p.getClass().getName())); - } - - public void fpCompareAgainstString(String name) { - Object o = new CCNE_Sample(); - - if (o.getClass().getName().equals(name)) - System.out.println("booya"); - } -} Deleted: trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java =================================================================== --- trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,30 +0,0 @@ -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; - -public class CEBE_EqualsToEqualsSample { - public final String name; - public final int age; - - CEBE_EqualsToEqualsSample(String name, int age) { - this.name = name; - this.age = age; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(name).append(age).toHashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CEBE_EqualsToEqualsSample other = (CEBE_EqualsToEqualsSample) obj; - return new EqualsBuilder().append(this.name, other.name).append(this.age, other.age).equals(obj); - } - -} Deleted: trunk/fb-contrib/samples/CE_Sample.java =================================================================== --- trunk/fb-contrib/samples/CE_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CE_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,37 +0,0 @@ - -public class CE_Sample { - public void test() { - Envy e = new Envy(); - e.a(); - e.b(); - test2(); - e.c(); - e.d(); - e.e(); - e.f(); - } - - public void test2() { - - } -} - -class Envy { - public void a() { - } - - public void b() { - } - - public void c() { - } - - public void d() { - } - - public void e() { - } - - public void f() { - } -} Deleted: trunk/fb-contrib/samples/CFS_Sample.java =================================================================== --- trunk/fb-contrib/samples/CFS_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CFS_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,16 +0,0 @@ -import java.util.Date; - -public class CFS_Sample { - @SuppressWarnings("deprecation") - public Date getNextDate(Date d) { - d.setHours(0); - return d; - } - - @SuppressWarnings("deprecation") - public Date getNextDateFP(Date d) { - d = (Date) d.clone(); - d.setHours(0); - return d; - } -} Deleted: trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java =================================================================== --- trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,29 +0,0 @@ -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; - -public class CHBH_HashcodeToHashcodeSample { - public final String name; - public final int age; - - CHBH_HashcodeToHashcodeSample(String name, int age) { - this.name = name; - this.age = age; - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(name).append(age).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CHBH_HashcodeToHashcodeSample other = (CHBH_HashcodeToHashcodeSample) obj; - return new EqualsBuilder().append(this.name, other.name).append(this.age, other.age).isEquals(); - } -} Deleted: trunk/fb-contrib/samples/CLI_Sample.java =================================================================== --- trunk/fb-contrib/samples/CLI_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CLI_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,37 +0,0 @@ -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; - -@SuppressWarnings("all") -public class CLI_Sample { - public String test1(String[] sa) { - String result = ""; - for (String element : sa) - result += sa[0]; - return result; - } - - public String test2(String[] sa) { - String name = sa[0]; - String address = sa[1]; - String ss = sa[2]; - return name + address + ss; - } - - public String testFPSplit(String s) { - String[] parts = s.split(","); - String a = parts[0]; - String b = parts[1]; - 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]); - } - } -} Deleted: trunk/fb-contrib/samples/CNC_Sample.java =================================================================== --- trunk/fb-contrib/samples/CNC_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CNC_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,33 +0,0 @@ -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class CNC_Sample { - // tag CNC_COLLECTION_NAMING_CONFUSION - Map<String, String> argList; - // tag CNC_COLLECTION_NAMING_CONFUSION - Set<Integer> targetMap; - // tag CNC_COLLECTION_NAMING_CONFUSION - List<Double> bernoulliSet; - - // tag 3xCNC_COLLECTION_NAMING_CONFUSION - public void testCNC(Map<String, String> argSet, Set<String> nameList, List<String> nameMap) { - - nameList.addAll(transferData(nameMap)); - } - - private Set<String> transferData(List<String> oldList) { - if (oldList.isEmpty()) { - return Collections.emptySet(); - } - // tag CNC_COLLECTION_NAMING_CONFUSION - Set<String> newList = new HashSet<>(); - for (String s : oldList) { - newList.add(s); - } - return newList; - - } -} Deleted: trunk/fb-contrib/samples/COM_Sample.java =================================================================== --- trunk/fb-contrib/samples/COM_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/COM_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,91 +0,0 @@ -import java.util.HashSet; -import java.util.Set; - -public class COM_Sample { - - public void test1() { - } - - public String test2(int i) { - return String.valueOf(i); - } - - public Set<String> test3(String a, String b, String c) { - Set<String> ss = new HashSet<String>(); - ss.add(a); - ss.add(b); - ss.add(c); - return ss; - } - - public boolean test4(int w, double x, String y, boolean z) { - return z; - } - - protected void fpEnhanceAccess() { - } - - public static class Derived extends COM_Sample { - @Override - public void test1() { - } - - @Override - public Set<String> test3(String a, String b, String c) { - Set<String> ss = new HashSet<String>(); - ss.add(a); - ss.add(b); - ss.add(c); - return ss; - } - - @Override - public String test2(int i) { - return String.valueOf(i); - } - - @Override - public boolean test4(int w, double x, String y, boolean z) { - return super.test4(w, x, y, z); - } - - @Override - public void fpEnhanceAccess() { - } - } -} - -interface Inf { - void m1(); - - void m2(); -} - -abstract class c1 implements Inf { - @Override - public void m1() { - } -} - -abstract class c2 extends c1 { - @Override - public void m2() { - } -} - -abstract class s1 { - public static final String FOO = "foo"; - - public String getFoo() { - return FOO; - } -} - -abstract class s2 extends s1 { - public static final String FOO = "foo2"; - - @Override - public String getFoo() { - return FOO; - } -} Deleted: trunk/fb-contrib/samples/CRF_Sample.java =================================================================== --- trunk/fb-contrib/samples/CRF_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CRF_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,26 +0,0 @@ -import java.io.File; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; - -public class CRF_Sample { - - public long testFileFromCPURL() throws URISyntaxException { - - URL u = CRF_Sample.class.getResource("/CRF_Sample.class"); - File f = new File(u.toURI()); - return f.length(); - } - - public long testFileFromCPURL2() { - URL u = CRF_Sample.class.getResource("/CRF_Sample.class"); - File f = new File(u.getFile()); - return f.length(); - } - - public long testFileFromCPURL3() throws MalformedURLException { - URL u = new URL("http://www.google.com"); - File f = new File(u.getFile()); - return f.length(); - } -} Deleted: trunk/fb-contrib/samples/CSBTS_StringToStringSample.java =================================================================== --- trunk/fb-contrib/samples/CSBTS_StringToStringSample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CSBTS_StringToStringSample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,54 +0,0 @@ -import org.apache.commons.lang3.builder.ToStringBuilder; - -public class CSBTS_StringToStringSample { - static class Person { - String name; - int age; - - Person(String name, int age) { - this.name = name; - this.age = age; - } - - @Override - public String toString() { - // INCORRECT USAGE : The same as invoking Object.toString() - // return new ToStringBuilder(this).toString(); - // Consider using for non final classes to support a - // string representation for derived types - // return ToStringBuilder.reflectionToString(this); - // Use for final classes most efficient solution - return new ToStringBuilder(this).append("name", name).append("age", age).toString(); - } - } - - private enum SEX { - Male, Female; - } - - public final static class GenderPerson extends Person { - private SEX sex; - - GenderPerson(String name, int age, SEX sex) { - super(name, age); - this.sex = sex; - } - } - - public static void main(String[] args) { - Person p = new Person("John Doe", 2); - ToStringBuilder x = new ToStringBuilder(p); - ToStringBuilder y = new ToStringBuilder(p); - // INCORRECT USAGE : The same as invoking Object.toString - System.out.println("P " + new ToStringBuilder(p).toString()); - // Consider using for non final classes to support a string - // representation for derived types - System.out.println("P " + ToStringBuilder.reflectionToString(p)); - GenderPerson p2 = new GenderPerson("Jane Doe", 2, SEX.Female); - System.out.println("GP " + new ToStringBuilder(p2).append("name", p2.name).append("age", p2.age).append("sex", p2.sex).toString()); - // Y now has an append - y.append("name", p.name); - System.out.println("P - Once Again " + y.toString()); - System.out.println("P - Again " + x.toString()); - } -} Deleted: trunk/fb-contrib/samples/CSI_Sample.java =================================================================== --- trunk/fb-contrib/samples/CSI_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CSI_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,85 +0,0 @@ -import java.beans.XMLEncoder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.nio.channels.Channels; -import java.nio.charset.StandardCharsets; -import java.util.Scanner; -import java.util.logging.MemoryHandler; -import java.util.logging.StreamHandler; - -public class CSI_Sample { - - private Scanner scan; - - public void testReaderCS(String fileName) throws UnsupportedEncodingException { - - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET - try (Reader r = new InputStreamReader(new FileInputStream(fileName), "UTF-8")) { - char[] c = new char[1000]; - r.read(c); - } catch (IOException e) { - } - - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET - byte[] bytes = "test".getBytes("UTF-8"); - - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET - String oddlyConstructedString = new String(bytes, "US-ASCII"); - - // no tag - oddlyConstructedString.getBytes(StandardCharsets.UTF_16); - - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET - oddlyConstructedString = new String(bytes, 0, 10, "UTF-16"); - } - - public String testUnknownEncoding(String url) throws UnsupportedEncodingException { - // tag CSI_CHAR_SET_ISSUES_UNKNOWN_ENCODING - return URLEncoder.encode(url, "FOO"); - } - - public void testLowerCaseEncoding(String fileName) throws UnsupportedEncodingException { - try (Reader r = new InputStreamReader(new FileInputStream(fileName), "utf-8")) { - char[] c = new char[1000]; - r.read(c); - } catch (IOException e) { - } - } - - @SuppressWarnings("resource") - public void testUseConstants(File f) throws UnsupportedEncodingException, FileNotFoundException { - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - try (PrintWriter pw = new PrintWriter(f, "UTF-8")) { - pw.println("Hello world"); - } - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - try (Scanner s = new Scanner(f, "UTF-8")) { - System.out.println(s.nextLine()); - } - - if (scan == null) { - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - scan = new Scanner(new FileInputStream(f), "UTF-8"); - scan.close(); - } - - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - XMLEncoder foo = new XMLEncoder(null, "UTF-8", true, 0); - foo.close(); - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - new MemoryHandler().setEncoding("UTF-16"); - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - new StreamHandler().setEncoding("UTF-16BE"); - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - Channels.newReader(null, "UTF-8"); - // tag CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET_NAME - Channels.newWriter(null, "UTF-8"); - } -} Deleted: trunk/fb-contrib/samples/CTU_Sample.java =================================================================== --- trunk/fb-contrib/samples/CTU_Sample.java 2016-11-18 03:24:22 UTC (rev 1802) +++ trunk/fb-contrib/samples/CTU_Sample.java 2016-11-18 03:30:45 UTC (rev 1803) @@ -1,25 +0,0 @@ -import java.util.concurrent.TimeUnit; - -public class CTU_Sample { - - public long simpleMillisAndNanos() { - long millis = System.currentTimeMillis(); - long nanos = System.nanoTime(); - - return millis + nanos; - } - - public long badUseOfConvert() { - long secs = TimeUnit.SECONDS.convert(1000, TimeUnit.MILLISECONDS); - long millis = System.currentTimeMillis(); - - return secs + millis; - } - - public long fpHandConversions() { - long millis = System.currentTimeMill... [truncated message content] |
From: <dbr...@us...> - 2016-11-18 03:24:24
|
Revision: 1802 http://sourceforge.net/p/fb-contrib/code/1802 Author: dbrosius Date: 2016-11-18 03:24:22 +0000 (Fri, 18 Nov 2016) Log Message: ----------- remove samples/lib Removed Paths: ------------- trunk/fb-contrib/samples/lib/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-10-10 18:33:44
|
Revision: 1801 http://sourceforge.net/p/fb-contrib/code/1801 Author: dbrosius Date: 2016-10-10 18:33:42 +0000 (Mon, 10 Oct 2016) Log Message: ----------- Version 6.8.0 Added Paths: ----------- tags/v6_8_0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-10-10 18:28:47
|
Revision: 1800 http://sourceforge.net/p/fb-contrib/code/1800 Author: dbrosius Date: 2016-10-10 18:28:44 +0000 (Mon, 10 Oct 2016) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt 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/BRPI_Sample.java trunk/fb-contrib/samples/LEST_Sample.java trunk/fb-contrib/samples/samples.fbp trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/MethodInfo.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.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/ParallelLists.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/FQMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/OpcodeUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/ToString.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/Values.java trunk/fb-contrib/yank.xls Added Paths: ----------- trunk/fb-contrib/samples/CCI_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/.classpath 2016-10-10 18:28:44 UTC (rev 1800) @@ -34,5 +34,6 @@ <classpathentry kind="lib" path="lib/spring-beans-4.3.2.RELEASE.jar"/> <classpathentry kind="lib" path="lib/spring-tx-4.3.2.RELEASE.jar"/> <classpathentry kind="lib" path="lib/spring-context-4.3.2.RELEASE.jar"/> + <classpathentry kind="lib" path="lib/threetenbp-1.3.2.jar"/> <classpathentry kind="output" path="target/classes/main"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/build.xml 2016-10-10 18:28:44 UTC (rev 1800) @@ -28,7 +28,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="6.6.3" /> + <property name="fb-contrib.version" value="6.9.0-SNAPSHOT" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -103,6 +103,7 @@ <pathelement location="${lib.dir}/commons-lang3-${commons-lang3.version}.jar" /> <pathelement location="${lib.dir}/commons-io-${commons-io.version}.jar" /> <pathelement location="${lib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" /> + <pathelement location="${lib.dir}/threetenbp-${threetenbp.version}.jar" /> <pathelement location="${lib.dir}/slf4j-api-${slf4j-api.version}.jar" /> <pathelement location="${lib.dir}/guava-${guava.version}.jar" /> <pathelement location="${lib.dir}/httpclient-cache-${httpclient-cache.version}.jar" /> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/etc/bugrank.txt 2016-10-10 18:28:44 UTC (rev 1800) @@ -15,6 +15,7 @@ +0 BugPattern CAO_CONFUSING_AUTOBOXED_OVERLOADING +0 BugPattern CBC_CONTAINS_BASED_CONDITIONAL +0 BugPattern CBX_CUSTOM_BUILT_XML ++0 BugPattern CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY +0 BugPattern CCNE_COMPARE_CLASS_EQUALS_NAME +2 BugPattern CC_CYCLOMATIC_COMPLEXITY +0 BugPattern CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/etc/findbugs.xml 2016-10-10 18:28:44 UTC (rev 1800) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -296,17 +296,18 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuboptimalExpressionOrder" speed="fast" reports="SEO_SUBOPTIMAL_EXPRESSION_ORDER"/> <Detector class="com.mebigfatguy.fbcontrib.detect.IOIssues" speed="fast" reports="IOI_DOUBLE_BUFFER_COPY,IOI_COPY_WITH_READER"/> - - <!-- COMMENT OUT FOR POINT RELEASE - + <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousMapCollection" speed="fast" reports="DMC_DUBIOUS_MAP_COLLECTION"/> <Detector class="com.mebigfatguy.fbcontrib.detect.BuryingLogic" speed="fast" reports="BL_BURYING_LOGIC"/> <Detector class="com.mebigfatguy.fbcontrib.detect.WiringIssues" speed="fast" reports="WI_DUPLICATE_WIRED_TYPES"/> - COMMENT OUT FOR POINT RELEASE --> + <Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/> + <!-- COMMENT OUT FOR POINT RELEASE --> + <!-- COMMENT OUT FOR POINT RELEASE --> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -569,8 +570,8 @@ <BugPattern abbrev="SEO" type="SEO_SUBOPTIMAL_EXPRESSION_ORDER" category="PERFORMANCE"/> <BugPattern abbrev="IOI" type="IOI_DOUBLE_BUFFER_COPY" category="PERFORMANCE"/> <BugPattern abbrev="IOI" type="IOI_COPY_WITH_READER" category="PERFORMANCE"/> - <BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE" experimental="true" /> - <BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS" experimental="true"/> - + <BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS"/> + <BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE"/> + <BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS"/> + <BugPattern abbrev="CCI" type="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY" category="CORRECTNESS"/> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/etc/messages.xml 2016-10-10 18:28:44 UTC (rev 1800) @@ -1276,9 +1276,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers"> <Details> <![CDATA[ - <p>Detects use of Backport Utils concurrent classes. Updated/efficient versions of these - classes are available in versions of the JDK 5.0 and higher, and these - classes should only be used if you are targeting JDK 1.4 and lower.</p> + <p>Detects use of Backport Utils concurrent classes from Emory, or Time classes from ThreeTen. Updated/efficient versions of + classes from emory are available in versions of the JDK 5.0 and higher, and in JDK 8.0 and higher for ThreeTen, and these + classes should only be used if you are targeting a JDK lower than this.</p> <p>It is a fast detector.</p> ]]> </Details> @@ -1628,6 +1628,15 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues"> + <Details> + <![CDATA[ + <p>Looks for problems with using concurrent collecctions</p> + <p>It is a fast detector.</p> + ]]> + </Details> + </Detector> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger"> <Details></Details> @@ -4704,13 +4713,14 @@ </BugPattern> <BugPattern type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS"> - <ShortDescription>Method uses backport concurrency utils</ShortDescription> - <LongDescription>Method {1} backport concurrency utils</LongDescription> + <ShortDescription>Method uses backported libraries that are now built in</ShortDescription> + <LongDescription>Method {1} uses backported libraries that are now built in</LongDescription> <Details> <![CDATA[ - <p>This class uses Backport Utils concurrent classes. Updated/Efficient version of these - classes are available in versions of the JDK 5.0 and higher, and these - classes should only be used if you are targeting JDK 1.4 and lower.</p> + <p>This class uses either Backport Utils concurrent classes from Emory, or Time classes from ThreeTen Backport. + Updated/Efficient version of these classes are available in the version of the JDK that this code is compiled against; + JDK 1.5 for the concurrent classes, and JDK 1.8 for the time classes, and these + classes should only be used if you are targeting a JDK lower than this.</p> ]]> </Details> </BugPattern> @@ -5550,9 +5560,10 @@ <LongDescription>Method {1} buries logic to the right (indented) more than it needs to be</LongDescription> <Details> <![CDATA[ - <p>This method has an if statement where if the condition is false, it merely returns. The bulk of the logic - is found in the if brace code. This unnecessarily obfuscates the logic of the method. It would be more readable - if you inverted the logic of the if statement, and just returned if true.</p> + <p>Looks for relatively large if blocks of code, where you unconditionally return from them, and then follow that with an unconditional + return of a small block. This places the bulk of the logic to the right indentation-wise, making it more difficult to read than needed. + It would be better to invert the logic of the if block, and immediately return, allowing the bulk of the logic to be move to the left, + for easier reading.</p> ]]> </Details> </BugPattern> @@ -5568,6 +5579,22 @@ ]]> </Details> </BugPattern> + + <BugPattern type="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"> + <ShortDescription>Method gets and sets a value of a ConcurrentHashMap in a racy manner</ShortDescription> + <LongDescription>Method {1} gets and sets a value of a ConcurrentHashMap in a racy manner </LongDescription> + <Details> + <![CDATA[ + <p>This method retrieves the value of a key from a ConcurrentHashMap, where the value is itself a collection. It checks this + value for null, and if it is so, creates a new collection and places in the map. This may cause thread race conditions + where two threads overwrite each other's values. You should be using + <code> + ConcurrentHashMap.putIfAbsent(K, V) + </code> + instead. + ]]> + </Details> + </BugPattern> <!-- BugCode --> @@ -5705,4 +5732,5 @@ <BugCode abbrev="DMC">Dubious Map Collection</BugCode> <BugCode abbrev="BL">Burying Logic</BugCode> <BugCode abbrev="WI">Wiring issues</BugCode> + <BugCode abbrev="CCI">Concurrent Collection Issues</BugCode> </MessageCollection> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/htdocs/index.shtml 2016-10-10 18:28:44 UTC (rev 1800) @@ -68,7 +68,7 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 6.6.3 available for download + <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.0 available for download <a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p> <p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p> <p style="font-weight: bold;">Please note that active development for this project is now done on @@ -81,6 +81,14 @@ Detectors added in git<br/> <div id="git" style="display:none;"> <ul> + <li>--none yet--</li> + </ul> + </div> + <hr/> + <img id="git_image" src="flip2.gif" onClick="toggleBlock('v6_8_0', 'v6_8_0_image');" align="top"/> + Detectors added in v6.8.0<br/> + <div id="v6_8_0" style="display:block;"> + <ul> <li><b>[DMC] Dubious Map Collection</b><br/> Looks for fields that are implementations of java.util.Map, but that are only ever iterated over. This probably means that this data structure should be a List of some class that holds two values, or at the least Pair. Map was probably choosen as it was the @@ -95,14 +103,21 @@ <li><b>[WI] Wiring Issues</b><br/> Looks for various issues around @Autowired/@Inject fields in DI classes <ul> - <li>Injecting the same bean twice into the same class hierarchy, even with different field names</li> + <li>Injecting the same bean twice into the same class hierarchy, even with different field names</li> + </ul> </li> + <li><b>[CCI] Concurrent Collection Issues</b><br/> + Looks for various issues around using concurrent collections including + <ul> + <li>Using get/put with collection values, when you should use putIfAbsent</li> + </ul> + </li> </ul> </div> <hr/> - <img id="git_image" src="flip2.gif" onClick="toggleBlock('v6_6_0', 'v6_6_0_image');" align="top"/> + <img id="git_image" src="flip1.gif" onClick="toggleBlock('v6_6_0', 'v6_6_0_image');" align="top"/> Detectors added in v6.6.0<br/> - <div id="v6_6_0" style="display:block;"> + <div id="v6_6_0" style="display:none;"> <ul> <li><b>[STB] Stacked Try Blocks</b><br/> Looks for two or more try catch blocks that are consecutive and catch the @@ -148,7 +163,7 @@ </ul> </div> <hr/> - <img id="v6_2_0_image" src="flip2.gif" onClick="toggleBlock('v6_2_0', 'v6_2_0_image');" align="top"/> + <img id="v6_2_0_image" src="flip1.gif" onClick="toggleBlock('v6_2_0', 'v6_2_0_image');" align="top"/> Detectors added in v6.2.0<br/> <div id="v6_2_0" style="display:none;"> <ul> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/htdocs/repository.html 2016-10-10 18:28:44 UTC (rev 1800) @@ -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.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>6.6.3</td></tr> + <tr><td><b>Version:</b></td><td>6.8.0</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/pom.xml 2016-10-10 18:28:44 UTC (rev 1800) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.6.3</version> + <version>6.9.0-SNAPSHOT</version> <prerequisites> <maven>2.2.1</maven> @@ -173,6 +173,12 @@ <version>4.3.2.RELEASE</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.threeten</groupId> + <artifactId>threetenbp</artifactId> + <version>1.3.2</version> + <scope>test</scope> + </dependency> </dependencies> <build> Modified: trunk/fb-contrib/samples/BRPI_Sample.java =================================================================== --- trunk/fb-contrib/samples/BRPI_Sample.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/samples/BRPI_Sample.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -1,3 +1,6 @@ + +import org.threeten.bp.LocalDate; + import edu.emory.mathcs.backport.java.util.Collections; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.Executors; @@ -3,8 +6,12 @@ public class BRPI_Sample { - public static void main(String[] arg) { + public void emory() { Collections.emptySet(); Executors.newCachedThreadPool(); new ConcurrentHashMap(); } + + public void threeten() { + LocalDate d = LocalDate.now(); + } } Added: trunk/fb-contrib/samples/CCI_Sample.java =================================================================== --- trunk/fb-contrib/samples/CCI_Sample.java (rev 0) +++ trunk/fb-contrib/samples/CCI_Sample.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -0,0 +1,21 @@ +import java.util.Collections; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +public class CCI_Sample { + + private Map<String, Set<String>> map = new ConcurrentHashMap<>(); + + public void update(String key, String value) { + + Set<String> values = map.get(key); + + if (values == null) { + values = Collections.<String> newSetFromMap(new ConcurrentHashMap<String, Boolean>()); + map.put(key, values); + } + + values.add(value); + } +} Property changes on: trunk/fb-contrib/samples/CCI_Sample.java ___________________________________________________________________ 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/LEST_Sample.java =================================================================== --- trunk/fb-contrib/samples/LEST_Sample.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/samples/LEST_Sample.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -149,4 +149,14 @@ private static Exception wrapStatic(Exception e) { return new Exception(e); } + + public void testFPSuppressedLest(String s) { + try { + double d = Double.parseDouble(s); + } catch (NumberFormatException e) { + RuntimeException r = new RuntimeException(); + r.addSuppressed(e); + throw r; + } + } } Modified: trunk/fb-contrib/samples/samples.fbp =================================================================== --- trunk/fb-contrib/samples/samples.fbp 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/samples/samples.fbp 2016-10-10 18:28:44 UTC (rev 1800) @@ -1,23 +1,24 @@ <Project projectName="sample"> - <Jar>././../target/classes/samples</Jar> - <AuxClasspathEntry>././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/commons-collections-3.2.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/log4j-1.2.17.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/commons-lang3-3.3.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/slf4j-api-1.7.7.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/guava-17.0.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/httpclient-4.3.4.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/httpclient-cache-4.3.4.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/httpcore-4.3.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/commons-codec-1.6.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/commons-io-1.3.2.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/junit-4.12.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/testng-6.9.6.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/jsr311-api-1.1.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> - <AuxClasspathEntry>./../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> - <AuxClasspathEntry>../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> - <SrcDir>./././.</SrcDir> + <Jar>./././../target/classes/samples</Jar> + <AuxClasspathEntry>./././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-collections-3.2.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/log4j-1.2.17.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-lang3-3.3.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/slf4j-api-1.7.7.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/guava-17.0.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/httpclient-4.3.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/httpclient-cache-4.3.4.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/httpcore-4.3.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-codec-1.6.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/commons-io-1.3.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/junit-4.12.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/testng-6.9.6.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/jsr311-api-1.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>././../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry> + <AuxClasspathEntry>./../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry> + <AuxClasspathEntry>../lib/threetenbp-1.3.2.jar</AuxClasspathEntry> + <SrcDir>././././.</SrcDir> </Project> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -40,6 +40,9 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * a first pass detector to collect various statistics used in second pass detectors. + */ public class CollectStatistics extends BytecodeScanningDetector implements NonReportingDetector { private static final Set<String> COMMON_METHOD_SIGS = UnmodifiableSet.create( //@formatter:off @@ -59,10 +62,22 @@ private Map<QMethod, Set<CalledMethod>> selfCallTree; private QMethod curMethod; + /** + * constructs a CollectStatistics detector which clears the singleton that holds the statistics for all classes parsed in the first pass. + * + * @param bugReporter + * unused, but required by reflection contract + */ public CollectStatistics(@SuppressWarnings("unused") BugReporter bugReporter) { Statistics.getStatistics().clear(); } + /** + * implements the visitor to collect statistics on this class + * + * @param classContext + * the currently class + */ @Override public void visitClassContext(ClassContext classContext) { try { @@ -227,6 +242,9 @@ return (annotations != null) && (annotations.length > 0); } + /** + * represents a method that is called, and whether it is in the super class + */ static class CalledMethod { private QMethod callee; private boolean isSuper; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/MethodInfo.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/MethodInfo.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/MethodInfo.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -22,6 +22,9 @@ import com.mebigfatguy.fbcontrib.utils.ToString; +/** + * represents statistics including attributes, mutability and sizes of a method + */ public class MethodInfo { public static final int PUBLIC_USE = 1; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -162,7 +162,7 @@ bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); removeEarliestFinallyBlock(); - } else if (OpcodeUtils.isInvoke(seen)) { + } else if (OpcodeUtils.isStandardInvoke(seen)) { try { JavaClass cls = Repository.lookupClass(getClassConstantOperand()); Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand()); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -27,6 +27,9 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * a base detector class for when you need to precess collections, provides methods for checking collection attributes + */ public class AbstractCollectionScanningDetector extends BytecodeScanningDetector { protected final JavaClass collectionClass; protected final BugReporter bugReporter; @@ -52,6 +55,7 @@ * @param classContext * the context object of the currently parsed class */ + @Override public void visitClassContext(ClassContext classContext) { if (collectionClass == null) { if (ex != null) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -65,8 +65,8 @@ public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); - mapBugs = new ArrayList<BugInstance>(); - setBugs = new ArrayList<BugInstance>(); + mapBugs = new ArrayList<>(); + setBugs = new ArrayList<>(); hasMapComparator = false; hasSetComparator = false; super.visitClassContext(classContext); @@ -147,7 +147,7 @@ found = true; } } - } else if ("java/util/List".equals(className) && "contains".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig) + } else if (Values.SLASHED_JAVA_UTIL_LIST.equals(className) && "contains".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); String pushedSig = itm.getSignature(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -19,10 +19,15 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.List; + import org.apache.bcel.Constants; import org.apache.bcel.classfile.JavaClass; +import com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers.Backports.Library; import com.mebigfatguy.fbcontrib.utils.BugType; +import com.mebigfatguy.fbcontrib.utils.ToString; +import com.mebigfatguy.fbcontrib.utils.UnmodifiableList; import com.mebigfatguy.fbcontrib.utils.Values; import edu.umd.cs.findbugs.BugInstance; @@ -31,14 +36,25 @@ import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; /** - * Detects use of Backport concurrent classes. Updated/Efficient version of these classes are available in versions of the JDK 5.0 and higher, and these classes - * should only be used if you are targeting JDK 1.4 and lower. - * - * Finds usage of classes from backport utils package. + * Detects use of backport libraries, when the code in question is compiled in a jdk that has the functionality available. Libraries include: + * <ul> + * <li>Use of Backport concurrent classes. Updated/Efficient version of these classes are available in versions of the JDK 1.5 and higher, and these classes + * should only be used if you are targeting JDK 1.4 and lower.</li> + * <li>Use of ThreeTen time backport classes, instead of java.time packages which are now available in JDK 1.8 and higher, and these classes should only be used + * if you are targeting JDK 1.7 and lower + * </ul> */ public class BackportReusePublicIdentifiers extends OpcodeStackDetector { + private static final List<Backports> BACKPORTS = UnmodifiableList.create( + // @formatter:off + new Backports("edu/emory/mathcs/backport/", Constants.MAJOR_1_5, Library.EMORY), + new Backports("org/threeten/bp/", Constants.MAJOR_1_8, Library.THREETEN) + // @formatter:on + ); + private final BugReporter bugReporter; + private int clsVersion; /** * constructs a BRPI detector given the reporter to report bugs on @@ -59,13 +75,13 @@ @Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); - if (cls.getMajor() >= Constants.MAJOR_1_5) { - super.visitClassContext(classContext); - } + clsVersion = cls.getMajor(); + super.visitClassContext(classContext); } /** - * overrides the visitor to look for method calls to the emory backport concurrent library when the now built in versions are available + * overrides the visitor to look for method calls to the emory backport concurrent library, or threeten bp library when the now built-in versions are + * available * * @param seen * the currently parsed opcode @@ -77,8 +93,13 @@ switch (seen) { case INVOKESTATIC: { String className = getClassConstantOperand(); - if (className.startsWith("edu/emory/mathcs/backport/")) { - reportBug(); + for (Backports backport : BACKPORTS) { + if (className.startsWith(backport.getPathPrefix())) { + if (clsVersion >= backport.getMinimumJDK()) { + reportBug(backport.getLibrary()); + break; + } + } } } break; @@ -86,11 +107,19 @@ case INVOKESPECIAL: { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); - if (className.startsWith("edu/emory/mathcs/backport/") && Values.CONSTRUCTOR.equals(methodName)) { - reportBug(); + for (Backports backport : BACKPORTS) { + if (Values.CONSTRUCTOR.equals(methodName)) { + if (className.startsWith(backport.getPathPrefix())) { + if (clsVersion >= backport.getMinimumJDK()) { + reportBug(backport.getLibrary()); + break; + } + } + } } } break; + default: break; } @@ -98,9 +127,51 @@ /** * issues a new bug at this location + * + * @param library + * the type of backport library that is in use */ - private void reportBug() { + private void reportBug(Library library) { bugReporter.reportBug(new BugInstance(this, BugType.BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) - .addSourceLine(this)); + .addSourceLine(this).addString(library.name())); } + + /** + * describes a library that is a backport of a package that is now included in the jdk by default + */ + static class Backports { + + enum Library { + EMORY, THREETEN + }; + + private String pathPrefix; + private int minimumJDK; + private Library library; + + public Backports(String pathPrefix, int minimumJDK, Library library) { + super(); + this.pathPrefix = pathPrefix; + this.minimumJDK = minimumJDK; + this.library = library; + } + + public String getPathPrefix() { + return pathPrefix; + } + + public int getMinimumJDK() { + return minimumJDK; + } + + public Library getLibrary() { + return library; + } + + @Override + public String toString() { + return ToString.build(this); + } + + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -221,7 +221,7 @@ stack.precomputation(this); - if (OpcodeUtils.isInvoke(seen)) { + if (OpcodeUtils.isStandardInvoke(seen)) { String clsName = getClassConstantOperand(); if (!safeClasses.contains(clsName)) { try { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -209,7 +209,7 @@ .addClass(this).addMethod(this).addSourceLineRange(this, activeUnconditional.getStart(), activeUnconditional.getEnd())); throw new StopOpcodeParsingException(); } - } else if (!ifBlocks.isEmpty() && (getNextPC() == ifBlocks.getFirst().getEnd())) { + } else if (!ifBlocks.isEmpty() && (getNextPC() == ifBlocks.getFirst().getEnd()) && !gotoAcrossPC(getNextPC())) { activeUnconditional = ifBlocks.getFirst(); } } else if ((seen == TABLESWITCH) || (seen == LOOKUPSWITCH)) { @@ -224,6 +224,12 @@ } } + private boolean gotoAcrossPC(int pc) { + + int target = gotoBranchPCs.previousSetBit(Integer.MAX_VALUE); + return (target > pc); + } + /** * determines if this opcode couldn't be part of a conditional expression or at least is very unlikely to be so. * @@ -254,6 +260,9 @@ } } + /** + * represents the byte offset code range of code that is executed inside an if block + */ static class IfBlock { private int start; private int end; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -144,7 +144,7 @@ return; } - clsAccessCount = new HashMap<String, BitSet>(); + clsAccessCount = new HashMap<>(); super.visitCode(obj); if (clsAccessCount.size() > 0) { @@ -182,7 +182,7 @@ try { stack.precomputation(this); - if (OpcodeUtils.isInvoke(seen)) { + if (OpcodeUtils.isStandardInvoke(seen)) { String calledClass = getClassConstantOperand().replace('/', '.'); if (seen == INVOKEINTERFACE) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -29,6 +29,7 @@ import com.mebigfatguy.fbcontrib.utils.BugType; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; +import com.mebigfatguy.fbcontrib.utils.Values; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -50,7 +51,7 @@ try { MAP_CLASS = Repository.lookupClass("java/util/Map"); SET_CLASS = Repository.lookupClass("java/util/Set"); - LIST_CLASS = Repository.lookupClass("java/util/List"); + LIST_CLASS = Repository.lookupClass(Values.SLASHED_JAVA_UTIL_LIST); QUEUE_CLASS = Repository.lookupClass("java/util/Queue"); } catch (ClassNotFoundException cnfe) { MAP_CLASS = null; Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -0,0 +1,194 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2016 Bhaskar Maddala + * Copyright (C) 2005-2016 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.detect; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.bcel.Repository; +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.JavaClass; + +import com.mebigfatguy.fbcontrib.utils.BugType; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.OpcodeStack; +import edu.umd.cs.findbugs.OpcodeStack.CustomUserValue; +import edu.umd.cs.findbugs.ba.ClassContext; + +/** + * looks for various issues with concurrent collections including + * <ul> + * <li>calls to checking and inserting a collection into a key on null, instead of using putIfAbsent</li> + * </ul> + */ +@CustomUserValue +public class ConcurrentCollectionIssues extends BytecodeScanningDetector { + + private final BugReporter bugReporter; + private JavaClass collectionClass; + private JavaClass mapClass; + private OpcodeStack stack; + private Map<String, CCIUserValue> fieldUserValues; + private int endNullCheckPC; + + private enum CCIUserValue { + CONCURRENT_HASHMAP, CONCURRENT_HASHMAP_VALUE; + }; + + /** + * constructs a CCI detector given the reporter to report bugs on + * + * @param bugReporter + * the sync of bug reports + */ + public ConcurrentCollectionIssues(final BugReporter bugReporter) { + this.bugReporter = bugReporter; + + try { + collectionClass = Repository.lookupClass("java/util/Collection"); + mapClass = Repository.lookupClass("java/util/Map"); + } catch (ClassNotFoundException e) { + bugReporter.reportMissingClass(e); + } + } + + /** + * overrides the visitor to initialize the opcode stack + * + * @param classContext + * the currently parsed class + */ + @Override + public void visitClassContext(ClassContext classContext) { + + try { + if ((collectionClass == null) || (mapClass == null)) { + return; + } + stack = new OpcodeStack(); + fieldUserValues = new HashMap<>(); + classContext.getJavaClass().accept(this); + } finally { + fieldUserValues = null; + stack = null; + } + } + + /** + * implements the visitor to see if reset the opcode stack + * + * @param obj + * the context object of the currently parsed code block + */ + @Override + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + endNullCheckPC = -1; + + super.visitCode(obj); + } + + /** + * implements the visitor to look for concurrent collection issue + */ + @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_NO_DEFAULT", justification = "We don't need or want to handle every opcode") + @Override + public void sawOpcode(int seen) { + CCIUserValue userValue = null; + try { + stack.precomputation(this); + + switch (seen) { + case INVOKESPECIAL: + if ("java/util/concurrent/ConcurrentHashMap".equals(getClassConstantOperand()) && "<init>".equals(getNameConstantOperand())) { + userValue = CCIUserValue.CONCURRENT_HASHMAP; + } + break; + + case INVOKEINTERFACE: + case INVOKEVIRTUAL: + if ("get".equals(getNameConstantOperand())) { + if (stack.getStackDepth() >= 2) { + OpcodeStack.Item itm = stack.getStackItem(1); + if (itm.getUserValue() == CCIUserValue.CONCURRENT_HASHMAP) { + userValue = CCIUserValue.CONCURRENT_HASHMAP_VALUE; + } + } + } else if ("put".equals(getNameConstantOperand()) && (endNullCheckPC > getPC()) && (stack.getStackDepth() >= 3)) { + OpcodeStack.Item mapItem = stack.getStackItem(2); + + if (mapItem.getUserValue() == CCIUserValue.CONCURRENT_HASHMAP) { + OpcodeStack.Item valueItem = stack.getStackItem(0); + JavaClass valueClass = valueItem.getJavaClass(); + if ((valueClass != null) && (valueClass.instanceOf(collectionClass) || valueClass.instanceOf(mapClass))) { + + bugReporter.reportBug(new BugInstance(this, BugType.CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY.name(), NORMAL_PRIORITY) + .addClass(this).addMethod(this).addSourceLine(this)); + } + } + } + break; + + case PUTFIELD: + case PUTSTATIC: + if (stack.getStackDepth() >= 1) { + OpcodeStack.Item itm = stack.getStackItem(0); + CCIUserValue uv = (CCIUserValue) itm.getUserValue(); + if (uv != null) { + fieldUserValues.put(getNameConstantOperand(), uv); + } else { + fieldUserValues.remove(getNameConstantOperand()); + } + } + break; + + case GETFIELD: + case GETSTATIC: + userValue = fieldUserValues.get(getNameConstantOperand()); + break; + + case IFNONNULL: + if ((getBranchOffset() > 0) && (stack.getStackDepth() > 0)) { + OpcodeStack.Item itm = stack.getStackItem(0); + if (itm.getUserValue() == CCIUserValue.CONCURRENT_HASHMAP_VALUE) { + endNullCheckPC = getBranchTarget(); + } + } + break; + } + + } catch (ClassNotFoundException e) { + bugReporter.reportMissingClass(e); + } finally { + stack.sawOpcode(this, seen); + if ((userValue != null) && (stack.getStackDepth() > 0)) { + OpcodeStack.Item itm = stack.getStackItem(0); + itm.setUserValue(userValue); + } + + if (getPC() >= endNullCheckPC) { + endNullCheckPC = -1; + } + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java ___________________________________________________________________ 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/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -189,7 +189,7 @@ break; case INVOKEVIRTUAL: - if ("java/util/List".equals(getClassConstantOperand())) { + if (Values.SLASHED_JAVA_UTIL_LIST.equals(getClassConstantOperand())) { String methodName = getNameConstantOperand(); if ("get".equals(methodName)) { if (state == State.SAW_CONSTANT_0) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -119,11 +119,9 @@ */ @Override public void sawOpcode(int seen) { - if (seen == INVOKEVIRTUAL) { - if ("printStackTrace".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) { - bugReporter.reportBug(new BugInstance(this, BugType.IMC_IMMATURE_CLASS_PRINTSTACKTRACE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) - .addSourceLine(this)); - } + if ((seen == INVOKEVIRTUAL) && "printStackTrace".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) { + bugReporter.reportBug(new BugInstance(this, BugType.IMC_IMMATURE_CLASS_PRINTSTACKTRACE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) + .addSourceLine(this)); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2016-09-24 00:41:19 UTC (rev 1799) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2016-10-10 18:28:44 UTC (rev 1800) @@ -27,6 +27,8 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.Method; +import com.mebigfatguy.fbcontrib.utils.Values; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -35,10 +37,8 @@ import edu.umd.cs.findbugs.ba.XField; /** - * looks for for loops that iterate over a java.util.List using an integer - * index, and get, rather than using an Iterator. An iterator may perform better - * depending List implementation, but more importantly will allow the code to be - * converted to other collections type. + * looks for for loops that iterate over a java.util.List using an integer index, and get, rather than using an Iterator. An iterator may perform better + * depending List implementation, but more importantly will allow the code to be converted to other collections type. */ public class ListIndexedIterating extends BytecodeScanningDetector { enum State { @@ -81,7 +81,7 @@ public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); - possibleForLoops = new HashSet<ForLoop>(); + possibleForLoops = new HashSet<>(); super.visitClassContext(classContext); } finally { stack = null; @@ -135,10 +135,11 @@ */ @Override public void sawOpcode(final int seen) { - if (stage == Stage.FIND_LOOP_STAGE) + if (stage == Stage.FIND_LOOP_STAGE) { sawOpcodeLoop(seen); - else + } else { sawOpcodeBug(seen); + } } /** @@ -152,26 +153,26 @@ stack.mergeJumps(this); switch (state) { - case SAW_NOTHING: - if ((seen == IINC) && (getIntConstant() == 1)) { - loopReg = getRegisterOperand(); - state = State.SAW_IINC; - } + case SAW_NOTHING: + if ((seen == IINC) && (getIntConstant() == 1)) { + loopReg = getRegisterOperand(); + state = State.SAW_IINC; + } break; - case SAW_IINC: - if ((seen == GOTO) || (seen == GOTO_W)) { - int branchTarget = getBranchTarget(); - int pc = getPC(); - if (branchTarget < pc) { - possibleForLoops.add(new ForLoop(branchTarget, pc, loopReg)); + case SAW_IINC: + if ((seen == GOTO) || (seen == GOTO_W)) { + int branchTarget = getBranchTarget(); + int pc = getPC(); + if (branchTarget < pc) { + possibleForLoops.add(new ForLoop(branchTarget, pc, loopReg)); + } } - } - state = State.SAW_NOTHING; + state = State.SAW_NOTHING; break; } - if ((seen == INVOKEINTERFACE) && "java/util/List".equals(getClassConstantOperand()) && "size".equals(getNameConstantOperand()) + if ((seen == INVOKEINTERFACE) && Values.SLASHED_JAVA_UTIL_LIST.equals(getClassConstantOperand()) && "size".equals(getNameConstantOperand()) && "()I".equals(getSigConstantOperand())) { sawListSize = true; } @@ -194,73 +195,74 @@ while (it.hasNext()) { ForLoop fl = it.next(); switch (fl.getLoopState()) { - case LOOP_NOT_STARTED: - if (getPC() == fl.getLoopStart()) { - if ((seen == ILOAD) || ((seen >= ILOAD_0) && (seen <= ILOAD_3)) - && (getReg(seen, ILOAD, ILOAD_0) == fl.getLoopReg())) { - fl.setLoopState(LoopState.LOOP_INDEX_LOADED_FOR_TEST); - continue; + case LOOP_NOT_STARTED: + if (getPC() == fl.getLoopStart()) { + if ((seen == ILOAD) || (((seen >= ILOAD_0) && (seen <= ILOAD_3)) && (getReg(seen, ILOAD, ILOAD_0) == fl.getLoopReg()))) { + fl.setLoopState(LoopState.LOOP_INDEX_LOADED_FOR_TEST); + continue; + } + it.remove(); } - it.remove(); - } break; - case LOOP_INDEX_LOADED_FOR_TEST: - if (getPC() >= fl.getLoopEnd()) { - it.remove(); - continue; - } - if (seen == IF_ICMPGE) { - if (stack.getStackDepth() > 1) { - OpcodeStack.Item itm = stack.getStackItem(0); - if (itm.getConstant() != null) { - it.remove(); + case LOOP_INDEX_LOADED_FOR_TEST: + if (getPC() >= fl.getLoopEnd()) { + it.remove(); + continue; + } + if (seen == IF_ICMPGE) { + if (stack.getStackDepth() > 1) { + OpcodeStack.Item itm = stack.getStackItem(0); + if (itm.getConstant() != null) { + it.remove(); + continue; + } + } + int branchTarget = getBranchTarget(); + if ((branchTarget >= (fl.getLoopEnd() + 3)) && (branchTarget <= (fl.getLoopEnd() + 5))) { + fl.setLoopState(LoopState.LOOP_IN_BODY); continue; } } - int branchTarget = getBranchTarget(); - if ((branchTarget >= (fl.getLoopEnd() + 3)) && (branchTarget <= (fl.getLoopEnd() + 5))) { - fl.setLoopState(LoopState.LOOP_IN_BODY); - continue; - } - } break; - case LOOP_IN_BODY: - case LOOP_IN_BODY_WITH_GET: - if ((getPC() == fl.getLoopEnd()) && (fl.getLoopState() == LoopState.LOOP_IN_BODY_WITH_GET)) { - bugReporter.reportBug(new BugInstance(this, "LII_LIST_INDEXED_ITERATING", NORMAL_PRIORITY).addClass(this).addMethod(this) - .addSourceLineRange(this, fl.getLoopStart(), fl.getLoopEnd())); - it.remove(); - } - if (getPC() > fl.getLoopEnd()) { - it.remove(); - } + case LOOP_IN_BODY: + case LOOP_IN_BODY_WITH_GET: + if ((getPC() == fl.getLoopEnd()) && (fl.getLoopState() == LoopState.LOOP_IN_BODY_WITH_GET)) { + bugReporter.reportBug(new BugInstance(this, "LII_LIST_INDEXED_ITERATING", NORMAL_PRIORITY).addClass(this).addMethod(this) + .addSourceLineRange(this, fl.getLoopStart(), fl.getLoopEnd())); + it.remove(); + } + if (getPC() > fl.getLoopEnd()) { + it.remove(); + } - if ((seen == ILOAD) || ((seen >= ILOAD_0) && (seen <= ILOAD_3))) { - loopReg = getReg(seen, ILOAD, ILOAD_0); - if (loopReg == fl.getLoopReg()) - fl.setLoopRegLoaded(true); - } else if (fl.getLoopRegLoaded()) { - boolean sawGet = ((seen == INVOKEINTERFACE) && "java/util/List".equals(getClassConstantOperand()) - && "get".equals(getNameConstantOperand()) && "(I)Ljava/lang/Object;".equals(getSigConstantOperand())); - if (!sawGet) { - it.remove(); - } else { - fl.setLoopState(LoopState.LOOP_IN_BODY_WITH_GET); - if (stack.getStackDepth() > 1) { - OpcodeStack.Item itm = stack.getStackItem(0); - if (!itm.couldBeZero()) - it.remove(); - else { - itm = stack.getStackItem(1); - if (fl.isSecondItem(itm)) + if ((seen == ILOAD) || ((seen >= ILOAD_0) && (seen <= ILOAD_3))) { + loopReg = getReg(seen, ILOAD, ILOAD_0); + if (loopReg == fl.getLoopReg()) { + fl.setLoopRegLoaded(true); + } + ... [truncated message content] |
From: <dbr...@us...> - 2016-09-24 00:41:20
|
Revision: 1799 http://sourceforge.net/p/fb-contrib/code/1799 Author: dbrosius Date: 2016-09-24 00:41:19 +0000 (Sat, 24 Sep 2016) Log Message: ----------- Version 6.6.3 Added Paths: ----------- tags/v6_6_3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-09-24 00:37:52
|
Revision: 1798 http://sourceforge.net/p/fb-contrib/code/1798 Author: dbrosius Date: 2016-09-24 00:37:50 +0000 (Sat, 24 Sep 2016) Log Message: ----------- remove moved files Removed Paths: ------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FindCircularDependencies.java Deleted: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FindCircularDependencies.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FindCircularDependencies.java 2016-09-24 00:37:08 UTC (rev 1797) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FindCircularDependencies.java 2016-09-24 00:37:50 UTC (rev 1798) @@ -1,271 +0,0 @@ -/* - * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2016 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.detect; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.bcel.classfile.Constant; -import org.apache.bcel.classfile.ConstantClass; -import org.apache.bcel.classfile.JavaClass; - -import com.mebigfatguy.fbcontrib.utils.BugType; -import com.mebigfatguy.fbcontrib.utils.ToString; - -import edu.umd.cs.findbugs.BugInstance; -import edu.umd.cs.findbugs.BugReporter; -import edu.umd.cs.findbugs.BytecodeScanningDetector; - -/** - * looks for classes that have dependencies on each other in a circular way. Class initialization can be compromised in this scenario, and usually points to a - * bad data model. Consider using interfaces to break this hard circular dependency. - */ -public class FindCircularDependencies extends BytecodeScanningDetector { - private Map<String, Set<String>> dependencyGraph = null; - - private BugReporter bugReporter; - - private String clsName; - - /** - * constructs a FCD detector given the reporter to report bugs on - * - * @param bugReporter - * the sync of bug reports - */ - public FindCircularDependencies(BugReporter bugReporter) { - this.bugReporter = bugReporter; - this.dependencyGraph = new HashMap<>(); - } - - @Override - public void visit(JavaClass obj) { - clsName = obj.getClassName(); - } - - @Override - public void sawOpcode(int seen) { - if ((seen == INVOKESPECIAL) || (seen == INVOKESTATIC) || (seen == INVOKEVIRTUAL)) { - processInvoke(); - - } else if (seen == LDC) { - processLoadConstant(); - } - } - - private void processInvoke() { - String refClsName = getClassConstantOperand(); - refClsName = refClsName.replace('/', '.'); - if (refClsName.startsWith("java")) { - return; - } - - if (clsName.equals(refClsName)) { - return; - } - - if (isEnclosingClassName(clsName, refClsName) || isEnclosingClassName(refClsName, clsName)) { - return; - } - - if (isStaticChild(clsName, refClsName) || isStaticChild(refClsName, clsName)) { - return; - } - - Set<String> dependencies = getDependenciesForClass(clsName); - dependencies.add(refClsName); - } - - private void processLoadConstant() { - Constant c = getConstantRefOperand(); - if (c instanceof ConstantClass) { - String refClsName = getClassConstantOperand(); - if (!refClsName.equals(clsName)) { - Set<String> dependencies = getDependenciesForClass(clsName); - dependencies.add(refClsName); - } - } - } - - /** - * returns a set of dependent class names for a class, and if it doesn't exist create the set install it, and then return; - * - * @param clsName - * the class for which you are trying to get dependencies - * @return the active set of classes that are dependent on the specified class - */ - private Set<String> getDependenciesForClass(String clsName) { - Set<String> dependencies = dependencyGraph.get(clsName); - if (dependencies == null) { - dependencies = new HashSet<>(); - dependencyGraph.put(clsName, dependencies); - } - - return dependencies; - } - - private boolean isEnclosingClassName(String outerClass, String innerClass) { - return innerClass.startsWith(outerClass) && (innerClass.indexOf('$') >= 0); - } - - @Override - public void report() { - removeDependencyLeaves(); - - LoopFinder lf = new LoopFinder(); - - while (!dependencyGraph.isEmpty()) { - String className = dependencyGraph.keySet().iterator().next(); - Set<String> loop = lf.findLoop(dependencyGraph, className); - boolean pruneLeaves; - if (loop != null) { - BugInstance bug = new BugInstance(this, BugType.FCD_FIND_CIRCULAR_DEPENDENCY.name(), NORMAL_PRIORITY); - for (String loopCls : loop) { - bug.addClass(loopCls); - } - bugReporter.reportBug(bug); - pruneLeaves = removeLoopLinks(loop); - } else { - dependencyGraph.remove(className); - pruneLeaves = true; - } - if (pruneLeaves) { - removeDependencyLeaves(); - } - } - - dependencyGraph.clear(); - } - - private boolean isStaticChild(String child, String parent) { - if (!child.startsWith(parent)) { - return false; - } - - String extra = child.substring(parent.length()); - return ((extra.charAt(0) == '.') && (extra.indexOf('.', 1) < 0)); - } - - private void removeDependencyLeaves() { - boolean changed = true; - while (changed) { - changed = false; - Iterator<Set<String>> it = dependencyGraph.values().iterator(); - while (it.hasNext()) { - Set<String> dependencies = it.next(); - - boolean foundClass = false; - Iterator<String> dit = dependencies.iterator(); - while (dit.hasNext()) { - foundClass = dependencyGraph.containsKey(dit.next()); - if (!foundClass) { - dit.remove(); - changed = true; - } - } - if (dependencies.isEmpty()) { - it.remove(); - changed = true; - } - } - } - } - - private boolean removeLoopLinks(Set<String> loop) { - Set<String> dependencies = null; - for (String className : loop) { - if (dependencies != null) { - dependencies.remove(className); - } - dependencies = dependencyGraph.get(className); - } - if (dependencies != null) { - dependencies.remove(loop.iterator().next()); - } - - boolean removedClass = false; - Iterator<String> cIt = loop.iterator(); - while (cIt.hasNext()) { - String className = cIt.next(); - dependencies = dependencyGraph.get(className); - if (dependencies.isEmpty()) { - cIt.remove(); - removedClass = true; - } - } - return removedClass; - } - - static class LoopFinder { - - private Map<String, Set<String>> dGraph = null; - private String startClass = null; - private Set<String> visited = null; - private Set<String> loop = null; - - public Set<String> findLoop(Map<String, Set<String>> dependencyGraph, String startCls) { - dGraph = dependencyGraph; - startClass = startCls; - visited = new HashSet<>(); - loop = new LinkedHashSet<>(); - if (findLoop(startClass)) { - return loop; - } - return null; - } - - private boolean findLoop(String curClass) { - if (curClass.contains("$")) { - return false; - } - - Set<String> dependencies = dGraph.get(curClass); - if (dependencies == null) { - return false; - } - - visited.add(curClass); - loop.add(curClass); - for (String depClass : dependencies) { - if (depClass.equals(startClass)) { - return true; - } - - if (visited.contains(depClass)) { - continue; - } - - if (findLoop(depClass)) { - return true; - } - } - loop.remove(curClass); - return false; - } - - @Override - public String toString() { - return ToString.build(this); - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-09-24 00:37:10
|
Revision: 1797 http://sourceforge.net/p/fb-contrib/code/1797 Author: dbrosius Date: 2016-09-24 00:37:08 +0000 (Sat, 24 Sep 2016) Log Message: ----------- remove moved files Removed Paths: ------------- trunk/fb-contrib/samples/FCD_Sample.java Deleted: trunk/fb-contrib/samples/FCD_Sample.java =================================================================== --- trunk/fb-contrib/samples/FCD_Sample.java 2016-09-24 00:35:51 UTC (rev 1796) +++ trunk/fb-contrib/samples/FCD_Sample.java 2016-09-24 00:37:08 UTC (rev 1797) @@ -1,81 +0,0 @@ - -public class FCD_Sample { - Child c = new Child();; - - public void cdTest() { - c.childTest(); - } -} - -class Child { - SubChild sc = new SubChild(); - - public void childTest() { - sc.subChildTest(); - } -} - -class SubChild { - FCD_Sample cds = new FCD_Sample(); - - public void subChildTest() { - cds.toString(); - } -} - -class Mammooth { - private int x; - - static class Builder { - private int x; - - public void setX(int x) { - this.x = x; - } - - public Mammooth build() { - Mammooth m = new Mammooth(); - m.x = x; - return m; - } - } -} - -class SuspectBuilderUse { - private int data; - - public static class Builder { - - int data; - - public void setData(int data) { - this.data = data; - } - } - - public SuspectBuilderUse(Builder b) { - this.data = b.data; - } - - public int getData() { - return data; - } -} - -class GitHubIssue101 { - protected void onCreate(final String savedInstanceState) { - final Intent intent = new Intent(ChildWithUsedClassObj.class); - startActivity(intent); - } - - private void startActivity(Intent i) { - } -} - -class ChildWithUsedClassObj extends GitHubIssue101 { -} - -class Intent { - Intent(Class c) { - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-09-24 00:35:54
|
Revision: 1796 http://sourceforge.net/p/fb-contrib/code/1796 Author: dbrosius Date: 2016-09-24 00:35:51 +0000 (Sat, 24 Sep 2016) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt 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/BED_Sample.java trunk/fb-contrib/samples/BL_Sample.java trunk/fb-contrib/samples/LO_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TailRecursion.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/FQMethod.java trunk/fb-contrib/yank.xls Added Paths: ----------- trunk/fb-contrib/samples/FCCD_Sample.java trunk/fb-contrib/samples/WI_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WiringIssues.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2016-08-17 00:50:35 UTC (rev 1795) +++ trunk/fb-contrib/.classpath 2016-09-24 00:35:51 UTC (rev 1796) @@ -27,10 +27,12 @@ <classpathentry kind="lib" path="lib/junit-4.12.jar"/> <classpathentry kind="lib" path="lib/testng-6.9.6.jar"/> <classpathentry kind="lib" path="lib/jsr311-api-1.1.1.jar" sourcepath="lib/sources/jsr311-api-1.1.1-sources.jar"/> - <classpathentry kind="lib" path="lib/spring-tx-4.2.3.RELEASE.jar"/> <classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar"/> <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar" sourcepath="lib/sources/commons-io-1.3.2-sources.jar"/> <classpathentry kind="lib" path="lib/mockito-all-2.0.2-beta.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> + <classpathentry kind="lib" path="lib/spring-beans-4.3.2.RELEASE.jar"/> + <classpathentry kind="lib" path="lib/spring-tx-4.3.2.RELEASE.jar"/> + <classpathentry kind="lib" path="lib/spring-context-4.3.2.RELEASE.jar"/> <classpathentry kind="output" path="target/classes/main"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-08-17 00:50:35 UTC (rev 1795) +++ trunk/fb-contrib/build.xml 2016-09-24 00:35:51 UTC (rev 1796) @@ -28,7 +28,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="6.6.2" /> + <property name="fb-contrib.version" value="6.6.3" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -110,6 +110,8 @@ <pathelement location="${lib.dir}/httpclient-${httpclient.version}.jar" /> <pathelement location="${lib.dir}/commons-codec-${commons-codec.version}.jar" /> <pathelement location="${lib.dir}/jsr311-api-${jsr311-api.version}.jar" /> + <pathelement location="${lib.dir}/spring-beans-${spring-beans.version}.jar" /> + <pathelement location="${lib.dir}/spring-context-${spring-context.version}.jar" /> <pathelement location="${lib.dir}/spring-tx-${spring-tx.version}.jar" /> <pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" /> <pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" /> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2016-08-17 00:50:35 UTC (rev 1795) +++ trunk/fb-contrib/etc/bugrank.txt 2016-09-24 00:35:51 UTC (rev 1796) @@ -50,7 +50,7 @@ +0 BugPattern EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS +0 BugPattern EXS_EXCEPTION_SOFTENING_RETURN_FALSE +0 BugPattern FCBL_FIELD_COULD_BE_LOCAL -+2 BugPattern FCD_FIND_CIRCULAR_DEPENDENCY ++2 BugPattern FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY +0 BugPattern FPL_FLOATING_POINT_LOOPS +6 BugPattern FP_FINAL_PARAMETERS +0 BugPattern HCP_HTTP_REQUEST_RESOURCES_NOT_FREED_FIELD @@ -93,6 +93,7 @@ +0 BugPattern LGO_LINGERING_GRAPHICS_OBJECT +2 BugPattern LII_LIST_INDEXED_ITERATING +0 BugPattern LO_APPENDED_STRING_IN_FORMAT_STRING ++0 BugPattern LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING +0 BugPattern LO_EXCEPTION_WITH_LOGGER_PARMS +0 BugPattern LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS +0 BugPattern LO_INVALID_FORMATTING_ANCHOR @@ -260,5 +261,6 @@ +0 BugPattern UVA_USE_VAR_ARGS +0 BugPattern WEM_OBSCURING_EXCEPTION +0 BugPattern WEM_WEAK_EXCEPTION_MESSAGING ++0 BugPattern WI_DUPLICATE_WIRED_TYPES +0 BugPattern WOC_WRITE_ONLY_COLLECTION_FIELD +0 BugPattern WOC_WRITE_ONLY_COLLECTION_LOCAL Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-08-17 00:50:35 UTC (rev 1795) +++ trunk/fb-contrib/etc/findbugs.xml 2016-09-24 00:35:51 UTC (rev 1796) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> - COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -176,7 +176,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,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION" /> + <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,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION,LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" /> <Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" /> @@ -255,7 +255,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnusedParameter" speed="fast" reports="UP_UNUSED_PARAMETER" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.FindCircularDependencies" speed="moderate" reports="FCD_FIND_CIRCULAR_DEPENDENCY"/> + <Detector class="com.mebigfatguy.fbcontrib.detect.FindClassCircularDependencies" speed="moderate" reports="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY"/> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectMethodsReturningImmutableCollections" speed="fast" reports="" hidden="true" /> @@ -303,8 +303,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BuryingLogic" speed="fast" reports="BL_BURYING_LOGIC"/> - COMMENT OUT FOR POINT RELEASE --> + <Detector class="com.mebigfatguy.fbcontrib.detect.WiringIssues" speed="fast" reports="WI_DUPLICATE_WIRED_TYPES"/> + COMMENT OUT FOR POINT RELEASE --> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -464,6 +466,7 @@ <BugPattern abbrev="LO" type="LO_EXCEPTION_WITH_LOGGER_PARMS" category="CORRECTNESS" /> <BugPattern abbrev="LO" type="LO_APPENDED_STRING_IN_FORMAT_STRING" category="PERFORMANCE" /> <BugPattern abbrev="LO" type="LO_INVALID_STRING_FORMAT_NOTATION" category="CORRECTNESS" /> + <BugPattern abbrev="LO" type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" /> <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" /> @@ -528,7 +531,7 @@ <BugPattern abbrev="CNC" type="CNC_COLLECTION_NAMING_CONFUSION" category="STYLE" /> <BugPattern abbrev="PME" type="PME_POOR_MANS_ENUM" category="STYLE" /> <BugPattern abbrev="UP" type="UP_UNUSED_PARAMETER" category="STYLE" /> - <BugPattern abbrev="FCD" type="FCD_FIND_CIRCULAR_DEPENDENCY" category="CORRECTNESS" /> + <BugPattern abbrev="FCCD" type="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY" category="CORRECTNESS" /> <BugPattern abbrev="MUC" type="MUC_MODIFYING_UNMODIFIABLE_COLLECTION" category="CORRECTNESS" /> <BugPattern abbrev="UJM" type="UJM_UNJITABLE_METHOD" category="PERFORMANCE" /> <BugPattern abbrev="HES" type="HES_EXECUTOR_NEVER_SHUTDOWN" category="CORRECTNESS" /> @@ -568,5 +571,6 @@ <BugPattern abbrev="IOI" type="IOI_COPY_WITH_READER" category="PERFORMANCE"/> <BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS" experimental="true"/> <BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE" experimental="true" /> + <BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS" experimental="true"/> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2016-08-17 00:50:35 UTC (rev 1795) +++ trunk/fb-contrib/etc/messages.xml 2016-09-24 00:35:51 UTC (rev 1796) @@ -75,7 +75,7 @@ <Details> <![CDATA[ <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, + implemented interface or superclass 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> ]]> @@ -353,7 +353,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod"> <Details> <![CDATA[ - <p>Looks for methods that are direct copies of the implementation in the super class.</p> + <p>Looks for methods that are direct copies of the implementation in the superclass.</p> <p>It is a fast detector.</p> ]]> </Details> @@ -386,7 +386,7 @@ <Details> <![CDATA[ <p>Looks for methods that are declared as abstract that override concrete methods in a - super class. Doing this casts away the implementation of the super class, and breaks + superclass. Doing this casts away the implementation of the superclass, and breaks the contract as set forth by the parent class.</p> <p>It is a fast detector.</p> ]]> @@ -831,9 +831,9 @@ <![CDATA[ <p>Looks for methods that catch checked exceptions, and throw unchecked exceptions in their place. There are several levels of concern. Least - concerning are methods constrained by interface or super class contracts + concerning are methods constrained by interface or superclass contracts not to throw checked exceptions but appear owned by the same author. Next - are methods constrained by interface or super class contracts and throw other + are methods constrained by interface or superclass contracts and throw other types of checked exceptions. Most egregious are methods not constrained by any interface or superclass contract.</p> <p>It is a moderately fast detector.</p> @@ -1276,7 +1276,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers"> <Details> <![CDATA[ - <p>Detects use of Backport Utils concurrent classes. Updated/Efficient version of these + <p>Detects use of Backport Utils concurrent classes. Updated/efficient versions of these classes are available in versions of the JDK 5.0 and higher, and these classes should only be used if you are targeting JDK 1.4 and lower.</p> <p>It is a fast detector.</p> @@ -1403,7 +1403,7 @@ </Details> </Detector> - <Detector class="com.mebigfatguy.fbcontrib.detect.FindCircularDependencies"> + <Detector class="com.mebigfatguy.fbcontrib.detect.FindClassCircularDependencies"> <Details> <![CDATA[ <p>This detector looks circular dependencies among classes. </p> @@ -1619,6 +1619,15 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.WiringIssues"> + <Details> + <![CDATA[ + <p>Looks for various issues around @Autowired/@Inject fields in DI classes</p> + <p>It is a fast detector.</p> + ]]> + </Details> + </Detector> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger"> <Details></Details> @@ -1725,7 +1734,7 @@ <Details> <![CDATA[ <p>This method uses a synchronized collection, built from Collections.synchronizedXXXX, but accesses it - through an iterator. Since an iterator is by definition, multithreaded unsafe, this is a conflict in + through an iterator. Since an iterator is, by definition, multithreaded unsafe, this is a conflict in concept. When using iterators, you should do the synchronization manually.</p> ]]> </Details> @@ -1749,7 +1758,7 @@ <Details> <![CDATA[ <p>This method uses concrete classes for parameters when only methods defined in an implemented - interface or super class are used. Consider increasing the abstraction of the interface to + interface or superclass are used. Consider increasing the abstraction of the interface to make low impact changes easier to accomplish in the future.</p> <p>Take the following example:<br/> @@ -1871,8 +1880,8 @@ <![CDATA[ <p>This class defines a field based on java.util.List, but uses it to some extent like a Set. Since lookup type operations are performed using a linear search for Lists, the performance for large - Lists will be poor. If the list is known to only contain a small number of items, (3,4, etc) then it doesn't matter. - Otherwise, consider changing this fields implementation to a set-based one. If order of + Lists will be poor. If the list is known to only contain a small number of items, (3, 4, etc) then it + doesn't matter. Otherwise, consider changing this field's implementation to a set-based one. If order of iteration is important to maintain insert order, perhaps consider a LinkedHashSet.</p> ]]> </Details> @@ -1917,7 +1926,7 @@ as final.</p> <p>Performance gains are debatable as "the final keyword does not appear in the class file for - local variables and parameters, thus it cannot impact the runtime performance. It's only use + local variables and parameters, thus it cannot impact the runtime performance. Its only use is to clarify the coders intent that the variable not be changed (which many consider dubious reason for its usage), and dealing with anonymous inner classes." - http://stackoverflow.com/a/266981/1447621 </p> ]]> @@ -1987,7 +1996,7 @@ <![CDATA[ <p>This class defines two methods that differ only by a parameter being defined as Character vs. int, long, float or double. As autoboxing is present, it may be - assumed that a parameter of 'a' would map to the Character version, but does not.</p> + assumed that a parameter of 'a' would map to the Character version, but it does not.</p> ]]> </Details> </BugPattern> @@ -2273,7 +2282,7 @@ <LongDescription>Method {1} is implemented with an exact copy of its superclass's method</LongDescription> <Details> <![CDATA[ - <p>This method is implemented using an exact copy of its super class method's + <p>This method is implemented using an exact copy of its superclass method's implementation, which usually means that this method can just be removed.</p> ]]> </Details> @@ -2296,7 +2305,7 @@ <Details> <![CDATA[ <p>This method passes an array as the key to a Map, element in a Set, or item in a List when - the contains method is used on the List. Since arrays do not, and cannot override the equals + the contains method is used on the List. Since arrays do not and cannot override the equals method, collection inclusion is based on the reference's address, which is probably not desired. In the case that this is a TreeMap or TreeSet, consider passing a Comparator to the map's constructor.</p> @@ -2320,7 +2329,7 @@ <Details> <![CDATA[ <p>This abstract method is derived from a concrete method implementation. It is highly - suspect that the super class method's implementation would be cast away.</p> + suspect that the superclass method's implementation would be cast away.</p> ]]> </Details> </BugPattern> @@ -2332,7 +2341,7 @@ <![CDATA[ <p>This method generates an XML based string by concatenating together various XML fragments, and variable values. Doing so makes the code difficult to read, modify - and validate. It is much more clean to built XML structures in external files that are + and validate. It is much more clean to build XML structures in external files that are read in and transformed into the final product, through modification by Transformer.setParameter.</p> ]]> </Details> @@ -2345,7 +2354,7 @@ <![CDATA[ <p>This method implements a synchronized block, but the code found at the beginning of this block only accesses local variables, and not member variables, or this. - To be better performance move the code that access local variables only, above the + For better performance, move the code that accesses local variables only, above the synchronized block, and leave the synchronized block only for field accesses, or access to this object.</p> ]]> @@ -2383,7 +2392,7 @@ <LongDescription>Method {1} uses 1 element array to simulate call by reference</LongDescription> <Details> <![CDATA[ - <p>This method uses a one element array to wrap an object that is to be passed to a method as an argument + <p>This method uses a one-element array to wrap an object that is to be passed to a method as an argument to simulate call by pointer ala C++. It is better to define a proper return class type that holds all the relevant information retrieved from the called method.</p> ]]> @@ -2536,7 +2545,7 @@ <LongDescription>Method {1} creates local variable-based synchronized collection</LongDescription> <Details> <![CDATA[ - <p>This method creates a synchronized collection and store the reference to it + <p>This method creates a synchronized collection and stores the reference to it in a local variable. As local variables are by definition thread-safe, it seems questionable that this collection needs to be synchronized.</p> <p> @@ -2571,7 +2580,7 @@ <![CDATA[ <p>This method uses a synchronize block where the object that is being synchronized on, is not owned by this current instance. This means that other instances may use this same - object for synchronization for its own purposes causing synchronization confusion. It is + object for synchronization for their own purposes, causing synchronization confusion. It is always cleaner and safer to only synchronize on private fields of this class. Note that 'this' is not owned by the current instance, but is owned by whomever assigns it to a field of its class. Synchronizing on 'this' is also not a good idea.</p> @@ -2584,8 +2593,8 @@ <LongDescription>Tag library {0} is not recycleable</LongDescription> <Details> <![CDATA[ - <p>This tag library class implements an attribute who's associated backing store field - is modified at another point in the tag library. In order for a taglibrary to be + <p>This tag library class implements an attribute whose associated backing store field + is modified at another point in the tag library. In order for a tag library to be recycleable, only the container is allowed to change this attribute, through the use of the setXXX method of the taglib. By modifying the value programmatically, the container will not initialize the attribute correctly on reuse.</p> @@ -2622,8 +2631,8 @@ <LongDescription>Window {0} sets size manually, and doesn't use pack</LongDescription> <Details> <![CDATA[ - <p>This class creates a window, and sizes the window using setSize. It is better - to handle font size changes to use the pack method.</p> + <p>This class creates a window, and sizes the window using setSize. It is better, + for handling font size changes, to use the pack method.</p> ]]> </Details> </BugPattern> @@ -2669,7 +2678,7 @@ <LongDescription>Method {1} passes appended string to title/label of component</LongDescription> <Details> <![CDATA[ - <p>This method creates a component and passes a string that was build up from a number of + <p>This method creates a component and passes a string that was built up from a number of strings through appending multiple strings together. As foreign languages may order phrases differently, this will make translations difficult.</p> ]]> @@ -2707,7 +2716,7 @@ <Details> <![CDATA[ <p>This class defines a private collection member as synchronized. It appears however - that this collection isn't only modified in a static initializer, or constructor. As these + that this collection is only modified in a static initializer, or constructor. As these two areas are guaranteed to be thread safe, defining this collection as synchronized is unnecessary and a potential performance bottleneck.</p> ]]> @@ -2748,7 +2757,7 @@ parameters, on the same instance without any intervening changes to the objects. If this method does not make changes to the object, which it appears it doesn't, then making two calls is just a waste. These method calls could be combined by assigning the - result into a temporary, and using the temporary the second time.</p> + result into a temporary variable, and using the variable the second time.</p> ]]> </Details> </BugPattern> @@ -2761,7 +2770,7 @@ <p>This method manually loops over a collection, pulling each element out and storing it in an array to build an array from the collection. It is easier, and clearer to use the built in collections method toArray. Given a collection 'mycollection' of type T, use - mycollection.toArray(new T[mycollection.size()]);</p> + <code>mycollection.toArray(new T[mycollection.size()]);</code></p> ]]> </Details> </BugPattern> @@ -2878,7 +2887,7 @@ <Details> <![CDATA[ <p>This method implements Serializable but is derived from a - class that does not. The super class has fields that are not serialized + class that does not. The superclass has fields that are not serialized because this class does not take the responsibility of writing these fields out either using Serializable's writeObject method, or Externalizable's writeExternal method. Therefore when this class is read from a stream, the superclass fields @@ -2894,8 +2903,8 @@ <LongDescription>Comparator method {1} doesn't seem to return all ordering values</LongDescription> <Details> <![CDATA[ - <p>This compareTo or compare method returns constant values for to represent less than, - equals and greater than. However it does not return each type, or it unconditionally returns a non zero value. + <p>This compareTo or compare method returns constant values to represent less than, + equals, and greater than. However, it does not return each type, or it unconditionally returns a non zero value. Given that comparators are transitive, this seems incorrect.</p> ]]> </Details> @@ -3032,7 +3041,7 @@ <LongDescription>Method {1} fetches character array just to do the equivalent of the charAt method</LongDescription> <Details> <![CDATA[ - <p>This method calls the toCharArray method on a String the fetch an array of characters, only + <p>This method calls the toCharArray method on a String to fetch an array of characters, only to retrieve one of those characters by index. It is more performant to just use the charAt method.</p> ]]> </Details> @@ -3152,7 +3161,7 @@ <![CDATA[ <p>This class defines a static field 'serialVersionUID' to define the serialization version for this class. This field is marked as non private. As the serialVersionUID only - controls the current class, and doesn't effect any derived classes, defining it as non + controls the current class, and doesn't affect any derived classes, defining it as non private is confusing. It is suggested you change this variable to be private.</p> ]]> </Details> @@ -3187,8 +3196,8 @@ <LongDescription>Method {1} passes an empty string to equalsIgnoreCase or compareToIgnoreCase</LongDescription> <Details> <![CDATA[ - <p>This method passes the empty string "" to equalsIgnoreCase or compareToIgnoreCase, as the empty string - is not case-sensitive using equals is simpler. It would be even simpler to do a length() == 0 test.</p> + <p>This method passes the empty string "" to equalsIgnoreCase or compareToIgnoreCase. As the empty string + is not case-sensitive, using equals is simpler. It would be even simpler to do a length() == 0 test.</p> ]]> </Details> </BugPattern> @@ -3214,7 +3223,7 @@ <![CDATA[ <p>This method calls StringBuilder.append and assigns the results to the same StringBuilder like:</p> <code>sb = sb.append("foo")</code> - <p>StringBuilder is mutable this is not necessary. + <p>StringBuilder is mutable, so this is not necessary. This is also true of StringBuffer.</p> ]]> </Details> @@ -3343,7 +3352,7 @@ <![CDATA[ <p>This method calls String.format passing a static string as the format string that has no replacement markers (starting with %). Thus no replacement will happen, and the format method is superfluous. If parameters were intended, - add the appropriate format markers as needed, otherwise, just remove the call to String.format and use the static + add the appropriate format markers as needed; otherwise, just remove the call to String.format and use the static string as is.</p> ]]> </Details> @@ -3372,9 +3381,9 @@ <p>This method assigns a value to a variable in an outer scope compared to where the variable is actually used. Assuming this evaluation does not have side effects, the assignment can be moved into the inner scope (if block) so that its execution time isn't taken up if the if guard is false. Care should be - taken however that the right hand side of the assignment does not contain side - effects that are required to happen, or that changes are not made further down that - will effect the execution of the assignment when done later on.</p> + taken, however, that the right hand side of the assignment does not contain side + effects that are required to happen, and that changes are not made further down that + will affect the execution of the assignment when done later on.</p> ]]> </Details> </BugPattern> @@ -3400,7 +3409,7 @@ <![CDATA[ <p>This method removes items from a collection using the remove method of the collection, while at the same time iterating across the collection. Doing this will invalidate the iterator, and further - use of it, will cause ConcurrentModificationExceptions to be thrown. To avoid this, the remove + use of it will cause ConcurrentModificationExceptions to be thrown. To avoid this, the remove method of the iterator should be used.</p> ]]> </Details> @@ -3413,7 +3422,7 @@ <![CDATA[ <p>This method modifies the contents of a collection using the collection API methods, while at the same time iterating across the collection. Doing this will invalidate the iterator, and further - use of it, will cause ConcurrentModificationExceptions to be thrown.</p> + use of it will cause ConcurrentModificationExceptions to be thrown.</p> ]]> </Details> </BugPattern> @@ -3504,7 +3513,7 @@ <Details> <![CDATA[ <p>This method is not constrained by an interface or superclass, but converts a caught checked exception - to unchecked exception and thrown. It would be more appropriate just throw the checked exception, adding + to unchecked exception and thrown. It would be more appropriate just to throw the checked exception, adding the exception to the throws clause of the method.</p> ]]> </Details> @@ -3515,7 +3524,7 @@ <LongDescription>Constrained method {1} converts checked exception to unchecked instead of another allowable checked exception</LongDescription> <Details> <![CDATA[ - <p>This method's exception signature is constrained by an interface of super class to not throw a + <p>This method's exception signature is constrained by an interface of superclass not to throw a checked exception that was caught. Therefore this exception was converted to an unchecked exception and thrown. It would probably be better to throw the closest checked exception allowed, and to annotate the new exception with the original exception using the initial cause field.</p> @@ -3528,10 +3537,10 @@ <LongDescription>Constrained method {1} converts checked exception to unchecked</LongDescription> <Details> <![CDATA[ - <p>This method's exception signature is constrained by an interface or super class to not throw + <p>This method's exception signature is constrained by an interface or superclass not to throw any checked exceptions. Therefore a caught checked exception was converted to an unchecked exception - and thrown. However it appears that the class in question is owned by the same author as the constraining - interface or superclass. Consider changes the signature of this method to include the checked exception.</p> + and thrown. However, it appears that the class in question is owned by the same author as the constraining + interface or superclass. Consider changing the signature of this method to include the checked exception.</p> ]]> </Details> </BugPattern> @@ -3541,7 +3550,7 @@ <LongDescription>method {1} converts an exception into a boolean 'error code' value</LongDescription> <Details> <![CDATA[ - <p>This method catches and exception and returns a boolean that represents whether an exception occurred or not. + <p>This method catches an exception and returns a boolean that represents whether an exception occurred or not. This throws away the value of exception handling and lets code ignore the resultant 'error code' return value. You should just throw the exception to the caller instead.</p> ]]> @@ -3554,7 +3563,7 @@ <Details> <![CDATA[ <p>This method appears to modify a parameter, and then return this parameter as the - methods return value. This will be confusing to callers of this method, as it won't be + method's return value. This will be confusing to callers of this method, as it won't be apparent that the 'original' passed in parameter will be changed as well. If the purpose of this method is to change the parameter, it would be more clear to change the method to a have a void return value. If a return type is required due to interface or superclass contract, @@ -3650,7 +3659,7 @@ <![CDATA[ <p>This method evaluates a boolean expression and passes that to Assert.assertFalse / Assert.assertTrue. It is better to pass the two values that are being equated to the Assert.assertEquals method so that the - JUnit failure method is more meaningful of the intended test.</p> + JUnit failure method is more descriptive of the intended test.</p> ]]> </Details> </BugPattern> @@ -3662,7 +3671,7 @@ <![CDATA[ <p>This method evaluates a boolean expression and passes that to Assert.assertFalse / Assert.assertTrue. It is better to pass the two values that are being equated to the Assert.assertNotEquals method so that the - JUnit failure method is more meaningful of the intended test.</p> + JUnit failure method is more descriptive of the intended test.</p> ]]> </Details> </BugPattern> @@ -3755,7 +3764,7 @@ <Details> <![CDATA[ <p>This method compares an object's equality to null. It is better to use the Assert.assertNull - method so that the TestNG failure method is more meaningful of the intended test.</p> + method so that the TestNG failure method is more descriptive of the intended test.</p> ]]> </Details> </BugPattern> @@ -3766,7 +3775,7 @@ <Details> <![CDATA[ <p>This method compares an object's inequality to null. It is better to use the Assert.assertNotNull - method so that the TestNG failure method is more meaningful of the intended test.</p> + method so that the TestNG failure method is more descriptive of the intended test.</p> ]]> </Details> </BugPattern> @@ -3838,10 +3847,11 @@ <LongDescription>Method {1} throws a java.lang.Exception that wraps a more useful exception</LongDescription> <Details> <![CDATA[ - <p>This method catches an exception and generates a new exception of type java.lang.Exception, passing the - original exception as the new Exception's cause. If the original Exception was actually an java.lang.Error, this - is dubious as you should not be handling errors. If the original exception is a more specific exception, there is no - reason to wrap it in an exception of the java.lang.Exception class, and just obfuscates the type of error that is occurring. + <p>This method catches an exception and generates a new exception of type java.lang.Exception, + passing the original exception as the new Exception's cause. If the original Exception was actually + a java.lang.Error, this is dubious as you should not be handling errors. If the original exception + is a more specific exception, there is no reason to wrap it in a java.lang.Exception; + this just obfuscates the type of error that is occurring. </p> ]]> </Details> @@ -3920,9 +3930,9 @@ 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.</p> <p>This pattern is invalid: - <code>logger.error("{0} is broken", theThing);</code> + <code>LOGGER.error("{0} is broken", theThing);</code> Use instead - <code>logger.error("{} is broken", theThing);</code> + <code>LOGGER.error("{} is broken", theThing);</code> </p> ]]> </Details> @@ -3937,9 +3947,9 @@ However, SLF4J uses simple non numbered anchors such as {}, rather than anchors with percent signs in them as the code uses. Thus no parameter replacement will occur.</p> <p>This pattern is invalid: - <code>logger.error("%s is broken", theThing);</code> + <code>LOGGER.error("%s is broken", theThing);</code> Use instead - <code>logger.error("{} is broken", theThing);</code> + <code>LOGGER.error("{} is broken", theThing);</code> </p> ]]> </Details> @@ -3950,7 +3960,7 @@ <LongDescription>Method {1} passes an incorrect number of parameters to an SLF4J logging statement</LongDescription> <Details> <![CDATA[ - <p>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 + <p>This method passes the wrong number of parameters to an 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.</p> ]]> </Details> @@ -3962,8 +3972,8 @@ <Details> <![CDATA[ <p>This method passes a standard exception as a logger parameter, and expects this exception to be substituted in - an SLF4J style parameter marker '{}'. This marker will not be translated as SLF4J doesn't process the Exception class - for markers. + an SLF4J style parameter marker '{}'. This marker will not be translated as SLF4J doesn't process the Exception + class for markers. </p> ]]> </Details> @@ -3980,8 +3990,29 @@ will never be executed.</p> ]]> </Details> - </BugPattern>' - + </BugPattern> + + + <BugPattern type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING"> + <ShortDescription>Method passes a simple String.format result to an SLF4J's format string</ShortDescription> + <LongDescription>Method {1} passes a simple String.format result to an SLF4J's format string</LongDescription> + <Details> + <![CDATA[ + <p>This method uses an SLF4J logger to log a string, which was produced through a call to String.format, where + the format string passed was a constant string containing only simple format markers that could be directly handled + by slf4j. Rather than doing + <pre> + logger.error("String.format("This %s is an error", s)); + <pre> + do + <pre> + logger.error(This {} is an error", s); + </pre> + </p> + ]]> + </Details> + </BugPattern> + <BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE"> <ShortDescription>Class relies on internal API classes</ShortDescription> <LongDescription>Class {0} relies on internal API classes</LongDescription> @@ -4037,8 +4068,9 @@ <LongDescription>Method {1} declares throwing two or more exceptions related by inheritance</LongDescription> <Details> <![CDATA[ - <p>This method declares that it throws an exception that is the child of another exception that is also declared to be thrown. - Given that the parent exception is declared, there is no need for the child exception to also be declared, and just adds confusion.</p> + <p>This method declares that it throws an exception that is the child of another exception that is + also declared to be thrown. Given that the parent exception is declared, there is no need for the child + exception to also be declared; it just adds confusion.</p> ]]> </Details> </BugPattern> @@ -4072,7 +4104,7 @@ <LongDescription>Method {1} returns null for Boolean type</LongDescription> <Details> <![CDATA[ - <p>This method declares that it returns a Boolean value. However the code + <p>This method declares that it returns a Boolean value. However, the code can return a null value. As this is now three values that can be returned; Boolean.TRUE, Boolean.FALSE, null; you have changed what a Boolean means. It would be clearer to just create a new Enum that has the three values @@ -4226,7 +4258,7 @@ <![CDATA[ <p>This serializable class defines a field as both transient and final. As transient fields are not serialized across the stream, it is required that some piece of code reinitialize that field - when it is deserialized. But since constructors aren't called when deserialization, the field is not initialized. + when it is deserialized. But since constructors aren't called when deserializing, the field is not initialized. And since the field is final, no other method can initialize it as well.</p> ]]> </Details> @@ -4238,7 +4270,7 @@ <Details> <![CDATA[ <p>This method tests a field to make sure it's not null before executing a conditional block of - code. However in the conditional block it reassigns the field. It is likely that the guard + code. However, in the conditional block it reassigns the field. It is likely that the guard should have been a check to see if the field is null, not that the field was not null.</p> <p>example: <pre><code> @@ -4258,7 +4290,7 @@ <Details> <![CDATA[ <p>This method tests a local variable to make sure it's not null before executing a conditional block of - code. However in the conditional block it reassigns the local variable. It is likely that the guard + code. However, in the conditional block it reassigns the local variable. It is likely that the guard should have been a check to see if the local variable is null, not that the local variable was not null.</p> <p>example: <pre><code> @@ -4278,7 +4310,7 @@ <Details> <![CDATA[ <p>Calling <code>Runtime.exit()</code> or <code>Runtime.halt()</code> shuts down the entire Java virtual machine. - This should only been done in very rare circumstances. Such calls make it hard or impossible for your code to be + This should only be done in very rare circumstances. Such calls make it hard or impossible for your code to be invoked by other code. Consider throwing a RuntimeException instead.</p> ]]> </Details> @@ -4290,7 +4322,7 @@ <Details> <![CDATA[ <p>Manually triggering finalization can result in serious performance problems and may be masking resource cleanup bugs. - Only the garbage collector should be concerned finalization and not application code.</p> + Only the garbage collector, not application code, should be concerned with finalization.</p> ]]> </Details> </BugPattern> @@ -4300,7 +4332,7 @@ <LongDescription>Method {1} calls BigDecimal.equals(), which is normally a mistake</LongDescription> <Details> <![CDATA[ - <p><code>equals()</code> being called to compare two <code>java.math.BigDecimal</code> numbers. + <p>This method calls <code>equals()</code> to compare two <code>java.math.BigDecimal</code> numbers. This is normally a mistake, as two <code>BigDecimal</code> objects are only equal if they are equal in both value and scale, so that <i>2.0</i> is not equal to <i>2.00</i>. To compare <code>BigDecimal</code> objects for mathematical equality, use <code>compareTo()</code> instead.</p> @@ -4327,8 +4359,8 @@ <Details> <![CDATA[ <p>Do not use the <code>ServerSocket</code> constructor or <code>ServerSocketFactory.createServerSocket()</code> factory methods that - accepts connections on any network interface. By default, an application that listens on a socket will listen for connection attempts - on any network interface, which can be a security risk. Only the long form the <code>ServerSocket</code> constructor or + accept connections on any network interface. By default, an application that listens on a socket will listen for connection attempts + on any network interface, which can be a security risk. Only the long form of the <code>ServerSocket</code> constructor or <code>ServerSocketFactory.createServerSocket()</code> factory methods take a specific local address to define which network interface the socket should bind.</p> ]]> @@ -4340,8 +4372,8 @@ <LongDescription>Method {1} creates an insecure Random object, which may be a security risk</LongDescription> <Details> <![CDATA[ - <p><code>Random()</code> constructor without a seed is insecure because it defaults to easily guessable seed: - <code>System.currentTimeMillis()</code>. Initialize seed like <code>new Random(SecureRandom.getInstance("SHA1PRNG").nextLong())</code> + <p><code>Random()</code> constructor without a seed is insecure because it defaults to an easily guessable seed: + <code>System.currentTimeMillis()</code>. Initialize a seed like <code>new Random(SecureRandom.getInstance("SHA1PRNG").nextLong())</code> or replace <code>Random()</code> with <code>SecureRandom.getInstance("SHA1PRNG")</code> instead. "SHA1PRNG" is the random algorithm supported on all platforms. </p> @@ -4651,7 +4683,7 @@ <LongDescription>Method {1} returns the result of invoking toString() without intermediate invocation of append() in ToStringBuilder</LongDescription> <Details> <![CDATA[ - <p>This method returns the result of toString() on ToStringBuilder without an + <p>This method returns the result of toString() on a ToStringBuilder without an intermediate invocation of append().</p> ]]> </Details> @@ -4713,9 +4745,9 @@ <![CDATA[ <p>This class implements the Cloneable interface but defines its clone method to still return a CloneNotSupportedException. Since you are implementing clone() it would make sense that the method - in question will <em>not</em> throw that exception, so annotating your method with it just makes client use - of your more painful as they have to handle an exception that will never happen. Just remove the - throws clause from your method.</p> + in question will <em>not</em> throw that exception, so annotating your method with it just makes clients' + use of your class more painful as they have to handle an exception that will never happen. + Just remove the throws clause from your method.</p> ]]> </Details> </BugPattern> @@ -4727,7 +4759,7 @@ <![CDATA[ <p>This method passes an array of primitive values to the Array.asList call. As primitive values in arrays aren't automatically promoted to boxed primitives in arrays, the asList call - cannot convert this array in a list of boxed primitives. It therefore just creates an array + cannot convert this array to a list of boxed primitives. It therefore just creates an array with one item in it, the array itself. This is rarely what is desired.</p> ]]> </Details> @@ -4739,7 +4771,7 @@ <Details> <![CDATA[ <p>This method allocates a collection using the default constructor even though it is known - a priori how many items are going to be placed in the collection (or at least a reasonable guess) + a priori how many items are going to be placed in the collection (or at least can be reasonably guessed) and thus needlessly causes intermediate reallocations of the collection.</p> <p>You can use the constructor that takes an initial size and that will be much better, but due to the loadFactor of Maps and Sets, even this will not be a correct estimate.</p> @@ -4771,7 +4803,7 @@ <LongDescription>Method {1} ignores return value of a non mutating method</LongDescription> <Details> <![CDATA[ - <p>This method ignores the return value of a common method that is assumed to be none mutating. + <p>This method ignores the return value of a common method that is assumed to be non-mutating. If this method does in fact not modify the object it is called on, there is no reason to call this method, and it can be removed.</p> ]]> @@ -4783,8 +4815,8 @@ <LongDescription>Method {1} attempts to access an array element outside the array's size</LongDescription> <Details> <![CDATA[ - <p>This method access an array element using a literal index that is know to be outside the size of the specified - array. This will cause an ArrayIndexOutOfBoundsException at runtime.</p> + <p>This method accesses an array element using a literal index that is known to be outside the size + of the specified array. This will cause an ArrayIndexOutOfBoundsException at runtime.</p> ]]> </Details> </BugPattern> @@ -4794,7 +4826,7 @@ <LongDescription>Method {1} attempts to store an array element to an array that does not appear to be allocated</LongDescription> <Details> <![CDATA[ - <p>This method attempts to store an array element into an array that appears to not have been allocated.</p> + <p>This method attempts to store an array element into an array that appears not to have been allocated.</p> ]]> </Details> </BugPattern> @@ -4843,14 +4875,14 @@ <p>This method defines parameters that are never used. As this method is either static or private, and can't be derived from, it is safe to remove these parameters and simplify your method. You should consider, while unlikely, that this method may be used reflectively, and thus you will - want to change that call as well. It is likely once you remove the parameter, there will be - a chain of method calls that have spent time creating this parameter and passing it down the line. - All of this may be able to be removed.</p> + want to change that call as well. In this case, it is likely that once you remove the parameter, + there will be a chain of method calls that have spent time creating this parameter and passing it + down the line. All of this may be able to be removed.</p> ]]> </Details> </BugPattern> - <BugPattern type="FCD_FIND_CIRCULAR_DEPENDENCY"> + <BugPattern type="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY"> <ShortDescription>Class has a circular dependency with other classes</ShortDescription> <LongDescription>Class {0} has a circular dependency with other classes</LongDescription> <Details> @@ -4961,7 +4993,7 @@ <![CDATA[ <p>FindBugs has detected an <code>org.apache.http.HttpRequest</code> (e.g. <code>HttpGet</code>, <code>HttpPost</code>, etc) that didn't release its associated resources. Code like the following: <br/> -<pre><code> +<pre>code> private HttpGet httpGet; public String requestInfo(URI u) { @@ -4978,9 +5010,9 @@ will freeze after a few requests, usually with no indication as to why. </p> <p> - The reason this code freezes is because <code>org.apache.http.HttpRequest</code>s need explicitly release their connection + The reason this code freezes is because <code>org.apache.http.HttpRequest</code>s need to explicitly release their connection with a call to either <code>reset()</code> or <code>releaseConnection()</code>. The above example can be easily fixed:<br/> -<code> +<pre><code> private HttpGet httpGet; ... public String requestInfo(URI u) { @@ -4996,7 +5028,7 @@ }</b> return null; }<br/> -</code> +</code></pre> </p> ]]> </Details> @@ -5024,7 +5056,7 @@ will freeze after a few requests, usually with no indication as to why. </p> <p> - The reason this code freezes is because <code>org.apache.http.HttpRequest</code>s need explicitly release their connection + The reason this code freezes is because <code>org.apache.http.HttpRequest</code>s need to explicitly release their connection with a call to either <code>reset()</code> or <code>releaseConnection()</code>, <b>even if the request is a local</b>. The garbage collector will not release these resources, leading to the frustrating freezing scenario described above. @@ -5056,7 +5088,7 @@ <![CDATA[ <p>This method is longer than 8000 bytes. By default the JIT will not attempt to compile this method no matter how hot it is, and so this method will always be interpreted. If performance is important, you should consider - breaking this method up in smaller chunks. (And probably a good idea for readability too!).</p> + breaking this method up into smaller chunks. (And probably a good idea for readability too!)</p> ]]> </Details> </BugPattern> @@ -5066,7 +5098,7 @@ <LongDescription>This method {1} performs arithmetic operations on time values with different units</LongDescription> <Details> <![CDATA[ - <p>This method takes two values that appear to be representing time, and performs arithmetic operations on this + <p>This method takes two values that appear to be representing time, and performs arithmetic operations on these two values directly, even though it appears that the two values are representing different time units, such as adding a millisecond value to a nanosecond value. You should convert the two values to the same time unit before performing this calculation in order for it to be meaningful.</p> @@ -5079,7 +5111,7 @@ <LongDescription>This method "{3}" needlessly uses a String literal to define an encoding. A built-in Charset could be used instead like: {4}</LongDescription> <Details> <![CDATA[ - <p>This method uses a string literal to specify a <code>Charset</code> encoding. However the method invoked has an + <p>This method uses a string literal to specify a <code>Charset</code> encoding. However, the method invoked has an alternative signature that takes a <code>Charset</code> object. You should use this signature, as this class is compiled with JDK 7 (or better), and the <code>Charset</code> in question is available as a constant from the <code>java.nio.charset.StandardCharsets</code> class.</p> @@ -5113,7 +5145,7 @@ <![CDATA[ <p>This method specifies a <code>Charset</code> encoding with a String literal that is not recognized by the current JDK. It's possible that this application will only be deployed on a JVM that does recognize this encoding, but - it seem dubious that this is the case.</p> + it seems dubious that this is the case.</p> <p> The standard JDK encodings (for Java 8) are "UTF-8", "US-ASCII", "ISO-8859-1", "UTF-16BE", "UTF-16LE", "UTF-16". These are all case-sensitive. </p> @@ -5127,7 +5159,7 @@ <Details> <![CDATA[ <p>This method uses an overly complex if expression made up of multiple conditions joined by OR, where the same - local variable is compared to a static value. When the number of conditions grow it is much cleaner + local variable is compared to a static value. When the number of conditions grows, it is much cleaner to build a static set of the possible values, and use the contains method on that set. This will shorten the code, and make it more self documenting.</p> ]]> @@ -5186,7 +5218,7 @@ <LongDescription>This method {1} continues a loop after finding an equality condition</LongDescription> <Details> <![CDATA[ - <p>This method continues with a loop, and does not break out of it, after finding an setting a variable in an if + <p>This method continues with a loop, and does not break out of it, after finding and setting a variable in an if condition based on equality. Since continuing on in the loop would seem to be unlikely to find the item again, breaking at this point would seem to be the proper action.</p> <p>Example: @@ -5209,7 +5241,7 @@ <Details> <![CDATA[ <p>This method fetches a resource from a URL, and uses the File API to manipulate it. If this resource is a - classpath resource, it will work if the resource is a file in a directory. If however the file is inside a JAR file + classpath resource, it will work if the resource is a file in a directory. If, however, the file is inside a JAR file this will fail. To avoid this confusing inconsistency, use the URL.openStream API instead to access the data of the classpath resource. </p> ]]> @@ -5222,7 +5254,7 @@ <Details> <![CDATA[ <p>This class which has instance fields has no equals(Object o) method. It is possible that this - class is never used in a context where this is required, it is often assumed, however, from clients + class is never used in a context where this is required; it is often assumed, however, from clients of this class that it is, so it is good to add such methods when you create them. </p> ]]> @@ -5235,7 +5267,7 @@ <Details> <![CDATA[ <p>This class which has instance fields has no hashCode() method. It is possible that this - class is never used in a context where this is required, it is often assumed, however, from clients + class is never used in a context where this is required; it is often assumed, however, from clients of this class that it is, so it is good to add such methods when you create them. </p> ]]> @@ -5249,7 +5281,7 @@ <![CDATA[ <p>This class has been created in the default package. Classes should be defined in a proper package structure, typically defined by the reverse of the domain name of the - owner of the code base. Putting code in the default (no) package limits it usefulness, including + owner of the code base. Putting code in the default (no) package limits its usefulness, including: <ol> <li>Not being able to import this class into classes with packages</li> <li>Leaving it open to name collisions with other packages.</li> @@ -5277,7 +5309,7 @@ <LongDescription>Method {1} uses IDE generated parameter names</LongDescription> <Details> <![CDATA[ - <p>This method appears to have been generated from an interface or super class using an IDE. + <p>This method appears to have been generated from an interface or superclass using an IDE. As such the IDE generated generic names (arg0, arg1, arg2) for parameters for this method, and the author of this method did not change them to be meaningful. For better understandability it is recommended that you name these parameters with regard to their function.</p> @@ -5388,7 +5420,7 @@ <LongDescription>Method {1} annotated with @Transactional is called from a non Spring proxy</LongDescription> <Details> <![CDATA[ - <p>This method call is to a method that has a @Transactional annotation on it. However since this call is from the + <p>This method call is to a method that has a @Transactional annotation on it. However, since this call is from the same class, it is not going through any Spring proxy, and thus the transactional quality of this method is completely lost. @Transactional method must always be called through a Spring bean that is autowired.</p> ]]> @@ -5428,7 +5460,7 @@ <![CDATA[ <p>This method declares that it throws one or more non-runtime exceptions. It also is annotated with a @Transactional annotation but fails to describe whether to rollback the transaction or not based on this - thrown exception. use 'rollbackFor' or 'noRollbackFor' attributes of the Transactional annotation to + thrown exception. Use 'rollbackFor' or 'noRollbackFor' attributes of the Transactional annotation to document this.</p> ]]> </Details> @@ -5440,8 +5472,8 @@ <Details> <![CDATA[ <p>This method declares that it either rolls back or does not rollback a transaction based on an - expected exception being thrown. However this... [truncated message content] |
From: <dbr...@us...> - 2016-08-17 00:50:37
|
Revision: 1795 http://sourceforge.net/p/fb-contrib/code/1795 Author: dbrosius Date: 2016-08-17 00:50:35 +0000 (Wed, 17 Aug 2016) Log Message: ----------- Version 6.6.2 Added Paths: ----------- tags/v6_6_2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-08-17 00:36:41
|
Revision: 1794 http://sourceforge.net/p/fb-contrib/code/1794 Author: dbrosius Date: 2016-08-17 00:36:37 +0000 (Wed, 17 Aug 2016) 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/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FindCircularDependencies.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorMansEnum.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/SluggishGui.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/QMethod.java Added Paths: ----------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/StopOpcodeParsingException.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/build.xml 2016-08-17 00:36:37 UTC (rev 1794) @@ -28,7 +28,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="6.7.0-SNAPSHOT" /> + <property name="fb-contrib.version" value="6.6.2" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -198,12 +198,13 @@ <include name="**/*.txt" /> <include name="**/*.md" /> <include name="**/*.xls" /> + <include name="**/*.example" /> </fileset> </zip> </target> <target name="javadoc" depends="-init" description="build the javadoc for the project"> - <javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="fb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api"> + <javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="fb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api" access="private"> <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> <bottom><![CDATA[<i>Copyright © 2005-2016 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> </javadoc> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/etc/findbugs.xml 2016-08-17 00:36:37 UTC (rev 1794) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -297,13 +297,13 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.IOIssues" speed="fast" reports="IOI_DOUBLE_BUFFER_COPY,IOI_COPY_WITH_READER"/> - <!-- COMMENT OUT FOR POINT RELEASE --> + <!-- COMMENT OUT FOR POINT RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousMapCollection" speed="fast" reports="DMC_DUBIOUS_MAP_COLLECTION"/> <Detector class="com.mebigfatguy.fbcontrib.detect.BuryingLogic" speed="fast" reports="BL_BURYING_LOGIC"/> - <!-- COMMENT OUT FOR POINT RELEASE --> + COMMENT OUT FOR POINT RELEASE --> <!-- BugPattern --> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/htdocs/index.shtml 2016-08-17 00:36:37 UTC (rev 1794) @@ -68,7 +68,7 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 6.6.1 available for download + <p style="font-weight: bold;">The latest version of fb-contrib is 6.6.2 available for download <a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p> <p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p> <p style="font-weight: bold;">Please note that active development for this project is now done on Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/htdocs/repository.html 2016-08-17 00:36:37 UTC (rev 1794) @@ -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.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>6.6.1</td></tr> + <tr><td><b>Version:</b></td><td>6.6.2</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/pom.xml 2016-08-17 00:36:37 UTC (rev 1794) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.7.0-SNAPSHOT</version> + <version>6.6.2</version> <prerequisites> <maven>2.2.1</maven> @@ -77,6 +77,9 @@ <contributor> <name>Richard Fearn</name> </contributor> + <contributor> + <name>Mikkel Kjeldsen</name> + </contributor> </contributors> <licenses> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -18,6 +18,10 @@ */ package com.mebigfatguy.fbcontrib.collect; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; import java.util.Set; import org.apache.bcel.Constants; @@ -25,12 +29,15 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; +import org.objectweb.asm.Type; +import com.mebigfatguy.fbcontrib.utils.QMethod; import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.NonReportingDetector; +import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.ba.ClassContext; public class CollectStatistics extends BytecodeScanningDetector implements NonReportingDetector { @@ -48,6 +55,9 @@ private int numMethodCalls; private boolean modifiesState; private boolean classHasAnnotation; + private OpcodeStack stack; + private Map<QMethod, Set<CalledMethod>> selfCallTree; + private QMethod curMethod; public CollectStatistics(@SuppressWarnings("unused") BugReporter bugReporter) { Statistics.getStatistics().clear(); @@ -55,10 +65,21 @@ @Override public void visitClassContext(ClassContext classContext) { - JavaClass cls = classContext.getJavaClass(); - AnnotationEntry[] annotations = cls.getAnnotationEntries(); - classHasAnnotation = (annotations != null) && (annotations.length > 0); - super.visitClassContext(classContext); + try { + JavaClass cls = classContext.getJavaClass(); + AnnotationEntry[] annotations = cls.getAnnotationEntries(); + classHasAnnotation = (annotations != null) && (annotations.length > 0); + stack = new OpcodeStack(); + selfCallTree = new HashMap<>(); + super.visitClassContext(classContext); + + performModifyStateClosure(classContext.getJavaClass()); + + } finally { + stack = null; + selfCallTree = null; + curMethod = null; + } } @Override @@ -69,6 +90,8 @@ byte[] code = obj.getCode(); if (code != null) { + stack.resetForMethodEntry(this); + curMethod = null; super.visitCode(obj); String clsName = getClassName(); Method method = getMethod(); @@ -97,25 +120,104 @@ @Override public void sawOpcode(int seen) { - switch (seen) { - case INVOKEVIRTUAL: - case INVOKEINTERFACE: - case INVOKESPECIAL: - case INVOKESTATIC: - case INVOKEDYNAMIC: - numMethodCalls++; - break; + try { + switch (seen) { + case INVOKEVIRTUAL: + case INVOKEINTERFACE: + case INVOKESPECIAL: + case INVOKESTATIC: + case INVOKEDYNAMIC: + numMethodCalls++; - case PUTSTATIC: - case PUTFIELD: - modifiesState = true; - break; + if (seen != INVOKESTATIC) { + int numParms = Type.getArgumentTypes(getSigConstantOperand()).length; + if (stack.getStackDepth() > numParms) { + OpcodeStack.Item itm = stack.getStackItem(numParms); + if (itm.getRegisterNumber() == 0) { + Set<CalledMethod> calledMethods; - default: - break; + if (curMethod == null) { + curMethod = new QMethod(getMethodName(), getMethodSig()); + calledMethods = new HashSet<>(); + selfCallTree.put(curMethod, calledMethods); + } else { + calledMethods = selfCallTree.get(curMethod); + } + + calledMethods.add(new CalledMethod(new QMethod(getNameConstantOperand(), getSigConstantOperand()), seen == INVOKESPECIAL)); + } + } + } + break; + + case PUTSTATIC: + case PUTFIELD: + modifiesState = true; + break; + + default: + break; + } + } finally { + stack.sawOpcode(this, seen); } } + private void performModifyStateClosure(JavaClass cls) { + boolean foundNewCall = true; + Statistics statistics = Statistics.getStatistics(); + + String clsName = cls.getClassName(); + while (foundNewCall && !selfCallTree.isEmpty()) { + foundNewCall = false; + + Iterator<Map.Entry<QMethod, Set<CalledMethod>>> callerIt = selfCallTree.entrySet().iterator(); + while (callerIt.hasNext()) { + Map.Entry<QMethod, Set<CalledMethod>> callerEntry = callerIt.next(); + QMethod caller = callerEntry.getKey(); + + MethodInfo callerMi = statistics.getMethodStatistics(clsName, caller.getMethodName(), caller.getSignature()); + if (callerMi == null) { + // odd, shouldn't happen + foundNewCall = true; + } else if (callerMi.getModifiesState()) { + foundNewCall = true; + } else { + + for (CalledMethod calledMethod : callerEntry.getValue()) { + + if (calledMethod.isSuper) { + callerMi.setModifiesState(true); + foundNewCall = true; + break; + } else { + MethodInfo calleeMi = statistics.getMethodStatistics(clsName, calledMethod.callee.getMethodName(), + calledMethod.callee.getSignature()); + if (calleeMi == null) { + // a super or sub class probably implements this method so just assume it modifies state + callerMi.setModifiesState(true); + foundNewCall = true; + break; + } + + if (calleeMi.getModifiesState()) { + callerMi.setModifiesState(true); + foundNewCall = true; + break; + } + } + } + } + + if (foundNewCall) { + callerIt.remove(); + } + } + } + + selfCallTree.clear(); + } + private boolean isAssociationedWithAnnotations(Method m) { if (classHasAnnotation) { return true; @@ -124,4 +226,30 @@ AnnotationEntry[] annotations = m.getAnnotationEntries(); return (annotations != null) && (annotations.length > 0); } + + static class CalledMethod { + private QMethod callee; + private boolean isSuper; + + public CalledMethod(QMethod c, boolean s) { + callee = c; + isSuper = s; + } + + @Override + public int hashCode() { + return callee.hashCode() & (isSuper ? 0 : 1); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof CalledMethod)) { + return false; + } + + CalledMethod that = (CalledMethod) obj; + + return (isSuper == that.isSuper) && callee.equals(that.callee); + } + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -31,6 +31,7 @@ import com.mebigfatguy.fbcontrib.utils.BugType; import com.mebigfatguy.fbcontrib.utils.OpcodeUtils; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException; import com.mebigfatguy.fbcontrib.utils.ToString; import edu.umd.cs.findbugs.BugInstance; @@ -73,7 +74,7 @@ try { int majorVersion = classContext.getJavaClass().getMajor(); if (majorVersion >= MAJOR_1_4) { - fbInfo = new ArrayList<FinallyBlockInfo>(); + fbInfo = new ArrayList<>(); super.visitClassContext(classContext); } } finally { @@ -102,7 +103,11 @@ } if (!fbInfo.isEmpty()) { - super.visitCode(obj); + try { + super.visitCode(obj); + } catch (StopOpcodeParsingException e) { + // no more finally blocks to check + } } } @@ -114,9 +119,6 @@ */ @Override public void sawOpcode(int seen) { - if (fbInfo.isEmpty()) { - return; - } FinallyBlockInfo fbi = fbInfo.get(0); @@ -128,7 +130,7 @@ if (OpcodeUtils.isAStore(seen)) { fbi.exReg = RegisterUtils.getAStoreReg(this, seen); } else { - fbInfo.remove(0); + removeEarliestFinallyBlock(); sawOpcode(seen); return; } @@ -140,14 +142,14 @@ } else if (seen == MONITOREXIT) { fbi.monitorCount--; if (fbi.monitorCount < 0) { - fbInfo.remove(0); + removeEarliestFinallyBlock(); sawOpcode(seen); return; } } if ((seen == ATHROW) && (loadedReg == fbi.exReg)) { - fbInfo.remove(0); + removeEarliestFinallyBlock(); sawOpcode(seen); return; } else if (OpcodeUtils.isALoad(seen)) { @@ -159,7 +161,7 @@ if (OpcodeUtils.isReturn(seen) || (seen == ATHROW)) { bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); - fbInfo.remove(0); + removeEarliestFinallyBlock(); } else if (OpcodeUtils.isInvoke(seen)) { try { JavaClass cls = Repository.lookupClass(getClassConstantOperand()); @@ -169,7 +171,7 @@ if ((et != null) && (et.getLength() > 0) && !catchBlockInFinally(fbi)) { bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), LOW_PRIORITY).addClass(this) .addMethod(this).addSourceLine(this)); - fbInfo.remove(0); + removeEarliestFinallyBlock(); } } } catch (ClassNotFoundException cnfe) { @@ -179,6 +181,16 @@ } /** + * removes the earliest finally block, as we've just concluded checking it, and if it's the last one then throw back to visitCode + */ + private void removeEarliestFinallyBlock() { + fbInfo.remove(0); + if (fbInfo.isEmpty()) { + throw new StopOpcodeParsingException(); + } + } + + /** * finds the method in specified class by name and signature * * @param cls Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -642,6 +642,8 @@ * * @param sb * the scope block to start with + * @param start + * the current pc * @param target * the target to look for * @@ -697,6 +699,10 @@ /** * finds the scope block that is the active synchronized block * + * @param sb + * the parent scope block to start with + * @param monitorEnterPC + * the pc where the current synchronized block starts * @return the scope block */ private ScopeBlock findSynchronizedScopeBlock(ScopeBlock sb, int monitorEnterPC) { @@ -933,6 +939,8 @@ * the register that was stored * @param pc * the instruction that did the store + * @param assocObject + * the the object that is associated with this store, usually the field from which this came */ public void addStore(int reg, int pc, UserObject assocObject) { if (stores == null) { @@ -1035,7 +1043,7 @@ if (assocs != null) { for (Map.Entry<UserObject, Integer> entry : assocs.entrySet()) { UserObject uo = entry.getKey(); - if ((uo.fieldFromReg == fieldFromReg) || ((uo.caller instanceof Integer) && (((Integer) uo.caller) == fieldFromReg))) { + if ((uo.fieldFromReg == fieldFromReg) || ((uo.caller instanceof Integer) && (((Integer) uo.caller).intValue() == fieldFromReg))) { Integer preWrittenFromField = entry.getValue(); if (preWrittenFromField != null) { if (stores != null) { @@ -1049,6 +1057,9 @@ /** * report stores that occur at scopes higher than associated loads that are not involved with loops + * + * @param parentUsedRegs + * the set of registers that where used by the parent scope block */ public void findBugs(Set<Integer> parentUsedRegs) { if (isLoop) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -30,6 +30,7 @@ import com.mebigfatguy.fbcontrib.utils.BugType; import com.mebigfatguy.fbcontrib.utils.OpcodeUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; +import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException; import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet; import com.mebigfatguy.fbcontrib.utils.Values; @@ -139,14 +140,18 @@ } } if (!declaredCheckedExceptions.isEmpty()) { - super.visitCode(obj); - if (!declaredCheckedExceptions.isEmpty()) { - BugInstance bi = new BugInstance(this, BugType.BED_BOGUS_EXCEPTION_DECLARATION.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) - .addSourceLine(this, 0); - for (String ex : declaredCheckedExceptions) { - bi.addString(ex.replaceAll("/", ".")); + try { + super.visitCode(obj); + if (!declaredCheckedExceptions.isEmpty()) { + BugInstance bi = new BugInstance(this, BugType.BED_BOGUS_EXCEPTION_DECLARATION.name(), NORMAL_PRIORITY).addClass(this) + .addMethod(this).addSourceLine(this, 0); + for (String ex : declaredCheckedExceptions) { + bi.addString(ex.replaceAll("/", ".")); + } + bugReporter.reportBug(bi); } - bugReporter.reportBug(bi); + } catch (StopOpcodeParsingException e) { + // no exceptions left } } } @@ -213,10 +218,6 @@ */ @Override public void sawOpcode(int seen) { - if (declaredCheckedExceptions.isEmpty()) { - return; - } - try { stack.precomputation(this); @@ -245,14 +246,14 @@ } if (!found) { - declaredCheckedExceptions.clear(); + clearExceptions(); } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); - declaredCheckedExceptions.clear(); + clearExceptions(); } } else if ("wait".equals(getNameConstantOperand())) { - declaredCheckedExceptions.remove("java.lang.InterruptedException"); + removeException("java.lang.InterruptedException"); } } else if (seen == ATHROW) { if (stack.getStackDepth() > 0) { @@ -261,7 +262,7 @@ String thrownException = SignatureUtils.stripSignature(exSig); removeThrownExceptionHierarchy(thrownException); } else { - declaredCheckedExceptions.clear(); + clearExceptions(); } } } finally { @@ -280,9 +281,9 @@ try { if (Values.DOTTED_JAVA_LANG_EXCEPTION.equals(thrownException)) { // Exception can be thrown even tho the method isn't declared to throw Exception in the case of templated Exceptions - declaredCheckedExceptions.clear(); + clearExceptions(); } else { - declaredCheckedExceptions.remove(thrownException); + removeException(thrownException); JavaClass exCls = Repository.lookupClass(thrownException); String clsName; @@ -292,13 +293,35 @@ break; } clsName = exCls.getClassName(); - declaredCheckedExceptions.remove(clsName); + removeException(clsName); } while (!declaredCheckedExceptions.isEmpty() && !Values.DOTTED_JAVA_LANG_EXCEPTION.equals(clsName) && !Values.DOTTED_JAVA_LANG_ERROR.equals(clsName)); } + } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); - declaredCheckedExceptions.clear(); + clearExceptions(); } } + + /** + * removes the declared checked exception, and if that was the last declared exception, stops opcode parsing by throwing exception + * + * @param clsName + * the name of the exception to remove + */ + private void removeException(String clsName) { + declaredCheckedExceptions.remove(clsName); + if (declaredCheckedExceptions.isEmpty()) { + throw new StopOpcodeParsingException(); + } + } + + /** + * clears all declared checked exceptions and throws an exception to stop opcode parsing + */ + private void clearExceptions() { + declaredCheckedExceptions.clear(); + throw new StopOpcodeParsingException(); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -29,6 +29,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.BugType; +import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException; import com.mebigfatguy.fbcontrib.utils.ToString; import edu.umd.cs.findbugs.BugInstance; @@ -53,7 +54,6 @@ private OpcodeStack stack; private Deque<IfBlock> ifBlocks; private IfBlock activeUnconditional; - private boolean isReported; private double lowBugRatioLimit; private double normalBugRatioLimit; private BitSet catchPCs; @@ -72,7 +72,7 @@ lowBugRatioLimit = LOW_BUG_RATIO_LIMIT; } } - } catch (Exception e) { + } catch (NumberFormatException e) { lowBugRatioLimit = LOW_BUG_RATIO_LIMIT; } @@ -86,7 +86,7 @@ normalBugRatioLimit = NORMAL_BUG_RATIO_LIMIT; } } - } catch (Exception e) { + } catch (NumberFormatException e) { normalBugRatioLimit = NORMAL_BUG_RATIO_LIMIT; } } @@ -116,7 +116,6 @@ stack.resetForMethodEntry(this); ifBlocks.clear(); activeUnconditional = null; - isReported = false; CodeException[] ces = obj.getExceptionTable(); if ((ces == null) || (ces.length == 0)) { @@ -128,14 +127,15 @@ } } gotoBranchPCs.clear(); - super.visitCode(obj); + try { + super.visitCode(obj); + } catch (StopOpcodeParsingException e) { + // reported an issue, so get out + } } @Override public void sawOpcode(int seen) { - if (isReported) { - return; - } try { @@ -181,7 +181,7 @@ bugReporter .reportBug(new BugInstance(this, BugType.BL_BURYING_LOGIC.name(), ratio > normalBugRatioLimit ? NORMAL_PRIORITY : LOW_PRIORITY) .addClass(this).addMethod(this).addSourceLineRange(this, activeUnconditional.getStart(), activeUnconditional.getEnd())); - isReported = true; + throw new StopOpcodeParsingException(); } } else if (!ifBlocks.isEmpty() && (getNextPC() == ifBlocks.getFirst().getEnd())) { activeUnconditional = ifBlocks.getFirst(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -30,8 +30,7 @@ import edu.umd.cs.findbugs.OpcodeStack; /** - * Find usage of EqualsBuilder from Apache commons, where the code invoke - * equals() on the constructed object rather than isEquals() + * Find usage of EqualsBuilder from Apache commons, where the code invoke equals() on the constructed object rather than isEquals() * * <pre> * new EqualsBuilder().append(this.name, other.name).equals(other); @@ -56,10 +55,8 @@ } /** - * implements the visitor to pass through constructors and static - * initializers to the byte code scanning code. These methods are not - * reported, but are used to build SourceLineAnnotations for fields, if - * accessed. + * implements the visitor to pass through constructors and static initializers to the byte code scanning code. These methods are not reported, but are used + * to build SourceLineAnnotations for fields, if accessed. * * @param obj * the context object of the currently parsed code attribute @@ -75,17 +72,20 @@ @Override public void sawOpcode(int seen) { - if (seen == INVOKEVIRTUAL) { - String methodName = getNameConstantOperand(); - if ("equals".equals(methodName) && "(Ljava/lang/Object;)Z".equals(getSigConstantOperand()) && (stack.getStackDepth() > 1)) { - String calledClass = stack.getStackItem(1).getSignature(); - if (LANG3_EQUALS_BUILDER.equals(calledClass) || LANG_EQUALS_BUILDER.equals(calledClass)) { - bugReporter.reportBug(new BugInstance(this, BugType.CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS.name(), HIGH_PRIORITY).addClass(this) - .addMethod(this).addSourceLine(this)); + try { + if (seen == INVOKEVIRTUAL) { + String methodName = getNameConstantOperand(); + if ("equals".equals(methodName) && "(Ljava/lang/Object;)Z".equals(getSigConstantOperand()) && (stack.getStackDepth() > 1)) { + String calledClass = stack.getStackItem(1).getSignature(); + if (LANG3_EQUALS_BUILDER.equals(calledClass) || LANG_EQUALS_BUILDER.equals(calledClass)) { + bugReporter.reportBug(new BugInstance(this, BugType.CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS.name(), HIGH_PRIORITY).addClass(this) + .addMethod(this).addSourceLine(this)); + } } } + } finally { + super.sawOpcode(seen); + stack.sawOpcode(this, seen); } - super.sawOpcode(seen); - stack.sawOpcode(this, seen); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -60,7 +60,7 @@ @Override public void afterOpcode(int seen) { super.afterOpcode(seen); - if (flag == true) { + if (flag) { stack.getStackItem(0).setUserValue(Boolean.TRUE); flag = false; } @@ -84,6 +84,5 @@ } } } - // stack.sawOpcode(this, seen); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -34,6 +34,7 @@ import com.mebigfatguy.fbcontrib.utils.OpcodeUtils; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; +import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException; import com.mebigfatguy.fbcontrib.utils.ToString; import edu.umd.cs.findbugs.BugInstance; @@ -51,7 +52,7 @@ private static final Set<String> knownImmutables; static { - Set<String> ki = new HashSet<String>(); + Set<String> ki = new HashSet<>(); ki.add("Ljava/lang/String;"); ki.add("Ljava/lang/Byte;"); ki.add("Ljava/lang/Character;"); @@ -89,7 +90,7 @@ public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); - possibleParmRegs = new HashMap<Integer, ParmUsage>(10); + possibleParmRegs = new HashMap<>(10); super.visitClassContext(classContext); } finally { stack = null; @@ -130,14 +131,18 @@ } } - if (possibleParmRegs.size() > 0) { - stack.resetForMethodEntry(this); - super.visitCode(obj); - for (ParmUsage pu : possibleParmRegs.values()) { - if ((pu.returnPC >= 0) && (pu.alteredPC >= 0)) { - bugReporter.reportBug(new BugInstance(this, BugType.CFS_CONFUSING_FUNCTION_SEMANTICS.name(), NORMAL_PRIORITY).addClass(this) - .addMethod(this).addSourceLine(this, pu.returnPC).addSourceLine(this, pu.alteredPC)); + if (!possibleParmRegs.isEmpty()) { + try { + stack.resetForMethodEntry(this); + super.visitCode(obj); + for (ParmUsage pu : possibleParmRegs.values()) { + if ((pu.returnPC >= 0) && (pu.alteredPC >= 0)) { + bugReporter.reportBug(new BugInstance(this, BugType.CFS_CONFUSING_FUNCTION_SEMANTICS.name(), NORMAL_PRIORITY).addClass(this) + .addMethod(this).addSourceLine(this, pu.returnPC).addSourceLine(this, pu.alteredPC)); + } } + } catch (StopOpcodeParsingException e) { + // no parm regs left } } } @@ -148,10 +153,6 @@ @Override public void sawOpcode(int seen) { - if (possibleParmRegs.isEmpty()) { - return; - } - try { stack.precomputation(this); @@ -176,6 +177,9 @@ } else if (OpcodeUtils.isAStore(seen)) { int reg = RegisterUtils.getAStoreReg(this, seen); possibleParmRegs.remove(Integer.valueOf(reg)); + if (possibleParmRegs.isEmpty()) { + throw new StopOpcodeParsingException(); + } } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { processInvoke(); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -38,6 +38,7 @@ import com.mebigfatguy.fbcontrib.utils.BugType; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; +import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException; import com.mebigfatguy.fbcontrib.utils.ToString; import com.mebigfatguy.fbcontrib.utils.Values; @@ -61,7 +62,6 @@ private int nextParmOffset; private boolean sawAload0; private boolean sawParentCall; - private boolean ignore; /** * constructs a COM detector given the reporter to report bugs on @@ -86,7 +86,7 @@ String superName = cls.getSuperclassName(); if (!Values.DOTTED_JAVA_LANG_OBJECT.equals(superName)) { this.classContext = clsContext; - superclassCode = new HashMap<String, CodeInfo>(); + superclassCode = new HashMap<>(); JavaClass superCls = cls.getSuperClass(); childPoolGen = new ConstantPoolGen(cls.getConstantPool()); parentPoolGen = new ConstantPoolGen(superCls.getConstantPool()); @@ -130,26 +130,29 @@ */ @Override public void visitCode(Code obj) { - Method m = getMethod(); - if ((!m.isPublic() && !m.isProtected()) || m.isAbstract() || m.isSynthetic()) { - return; - } - - CodeInfo superCode = superclassCode.remove(curMethodInfo); - if (superCode != null) { - if (sameAccess(getMethod().getAccessFlags(), superCode.getAccess()) && codeEquals(obj, superCode.getCode())) { - bugReporter.reportBug(new BugInstance(this, BugType.COM_COPIED_OVERRIDDEN_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) - .addSourceLine(classContext, this, getPC())); + try { + Method m = getMethod(); + if ((!m.isPublic() && !m.isProtected()) || m.isAbstract() || m.isSynthetic()) { return; } - parmTypes = getMethod().getArgumentTypes(); - ignore = false; - nextParmIndex = 0; - nextParmOffset = getMethod().isStatic() ? 0 : 1; - sawAload0 = nextParmOffset == 0; - sawParentCall = false; - super.visitCode(obj); + CodeInfo superCode = superclassCode.remove(curMethodInfo); + if (superCode != null) { + if (sameAccess(getMethod().getAccessFlags(), superCode.getAccess()) && codeEquals(obj, superCode.getCode())) { + bugReporter.reportBug(new BugInstance(this, BugType.COM_COPIED_OVERRIDDEN_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) + .addSourceLine(classContext, this, getPC())); + return; + } + + parmTypes = getMethod().getArgumentTypes(); + nextParmIndex = 0; + nextParmOffset = getMethod().isStatic() ? 0 : 1; + sawAload0 = nextParmOffset == 0; + sawParentCall = false; + super.visitCode(obj); + } + } catch (StopOpcodeParsingException e) { + // method is unique } } @@ -163,22 +166,19 @@ */ @Override public void sawOpcode(int seen) { - if (ignore) { - return; - } if (!sawAload0) { if (seen == ALOAD_0) { sawAload0 = true; } else { - ignore = true; + throw new StopOpcodeParsingException(); } } else if (nextParmIndex < parmTypes.length) { if (isExpectedParmInstruction(seen, nextParmOffset, parmTypes[nextParmIndex])) { nextParmOffset += SignatureUtils.getSignatureSize(parmTypes[nextParmIndex].getSignature()); nextParmIndex++; } else { - ignore = true; + throw new StopOpcodeParsingException(); } } else if (!sawParentCall) { @@ -187,7 +187,7 @@ && getSigConstantOperand().equals(getMethod().getSignature())) { sawParentCall = true; } else { - ignore = true; + throw new StopOpcodeParsingException(); } } else { int expectedInstruction = getExpectedReturnInstruction(getMethod().getReturnType()); @@ -195,7 +195,7 @@ bugReporter.reportBug( new BugInstance(this, BugType.COM_PARENT_DELEGATED_CALL.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); } else { - ignore = true; + throw new StopOpcodeParsingException(); } } } @@ -242,7 +242,9 @@ * determines if two access flags contain the same access modifiers * * @param parentAccess + * the access flags of the parent method * @param childAccess + * the access flats of the child method * @return whether the access modifiers are the same */ private static boolean sameAccess(int parentAccess, int childAccess) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -120,6 +120,7 @@ while (bbi.hasNext()) { BasicBlock bb = bbi.next(); Iterator<Edge> iei = cfg.outgoingEdgeIterator(bb); + int lastSwitchTargetBlockLabel = Integer.MIN_VALUE; while (iei.hasNext()) { Edge e = iei.next(); int edgeType = e.getType(); @@ -130,6 +131,12 @@ exceptionNodeTargets.set(nodeTarget); branches++; } + } else if ((edgeType == EdgeTypes.SWITCH_EDGE) || (edgeType == EdgeTypes.SWITCH_DEFAULT_EDGE)) { + int nodeTarget = e.getTarget().getLabel(); + if (nodeTarget != lastSwitchTargetBlockLabel) { + branches++; + } + lastSwitchTargetBlockLabel = nodeTarget; } else { branches++; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -76,7 +76,7 @@ } try { - exceptionClasses = new HashSet<JavaClass>(2); + exceptionClasses = new HashSet<>(2); exceptionClasses.add(Repository.lookupClass("java/util/concurrent/CopyOnWriteArrayList")); exceptionClasses.add(Repository.lookupClass("java/util/concurrent/CopyOnWriteArraySet")); } catch (ClassNotFoundException cnfe) { @@ -90,7 +90,7 @@ private static final Map<QMethod, Integer> modifyingMethods; static { - Map<QMethod, Integer> mm = new HashMap<QMethod, Integer>(); + Map<QMethod, Integer> mm = new HashMap<>(); mm.put(new QMethod("add", "(Ljava/lang/Object;)Z"), Values.ONE); mm.put(new QMethod("addAll", "(Ljava/util/Collection;)Z"), Values.ONE); mm.put(new QMethod("addAll", "(ILjava/util/Collection;)Z"), Values.TWO); @@ -136,9 +136,9 @@ try { stack = new OpcodeStack(); - collectionGroups = new ArrayList<GroupPair>(); - groupToIterator = new HashMap<Integer, Integer>(); - loops = new HashMap<Integer, Loop>(10); + collectionGroups = new ArrayList<>(); + groupToIterator = new HashMap<>(); + loops = new HashMap<>(10); super.visitClassContext(classContext); } finally { stack = null; @@ -383,6 +383,8 @@ * * @param couldSeePop * if the preceding instruction returns a value, and thus might need to be popped + * + * @return when a following instruction issues some sort of return */ private boolean returnFollows(boolean couldSeePop) { @@ -491,7 +493,7 @@ } private void buildVariableEndScopeMap() { - endOfScopes = new HashMap<Integer, BitSet>(); + endOfScopes = new HashMap<>(); LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt != null) { @@ -570,7 +572,7 @@ private final String colClass; public GroupPair(Comparable<?> member, String cls) { - groupMembers = new HashSet<Comparable<?>>(); + groupMembers = new HashSet<>(); groupMembers.add(member); colClass = cls; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -30,6 +30,7 @@ import com.mebigfatguy.fbcontrib.utils.BugType; import com.mebigfatguy.fbcontrib.utils.OpcodeUtils; +import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException; import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet; import com.mebigfatguy.fbcontrib.utils.Values; @@ -70,7 +71,6 @@ // @formatter:on ); - private BugReporter bugReporter; private JavaClass mapClass; private OpcodeStack stack; @@ -114,15 +114,15 @@ public void visitCode(Code obj) { isInSpecial = SPECIAL_METHODS.contains(getMethod().getName()); stack.resetForMethodEntry(this); - super.visitCode(obj); + try { + super.visitCode(obj); + } catch (StopOpcodeParsingException e) { + // no more unaccounted for map fields + } } @Override public void sawOpcode(int seen) { - if (mapFields.isEmpty()) { - return; - } - try { if ((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL)) { @@ -136,6 +136,9 @@ XField xf = item.getXField(); if (xf != null) { mapFields.remove(xf.getName()); + if (mapFields.isEmpty()) { + throw new StopOpcodeParsingException(); + } } } } else if ((seen == PUTFIELD) || (seen == PUTSTATIC)) { @@ -143,6 +146,7 @@ if (xf != null) { if (!isInSpecial) { mapFields.remove(xf.getName()); + } else { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); @@ -151,6 +155,10 @@ } } } + if (mapFields.isEmpty()) { + throw new StopOpcodeParsingException(); + } + } } @@ -180,6 +188,10 @@ String mName = getNameConstantOperand(); if (MAP_METHODS.contains(mName)) { mapFields.remove(fName); + if (mapFields.isEmpty()) { + throw new StopOpcodeParsingException(); + } + return; } @@ -190,6 +202,10 @@ if (MODIFYING_METHODS.contains(mName)) { mapFields.remove(fName); + if (mapFields.isEmpty()) { + throw new StopOpcodeParsingException(); + } + return; } } @@ -207,6 +223,10 @@ XField xf = item.getXField(); if (xf != null) { mapFields.remove(xf.getName()); + if (mapFields.isEmpty()) { + throw new StopOpcodeParsingException(); + } + } } else { return; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -320,6 +320,8 @@ * the list of active catch blocks * @param pc * the current pc + * @param seen + * the currently parsed opcode */ private void updateEndPCsOnCatchRegScope(List<CatchInfo> infos, int pc, int seen) { if (lvt != null) { @@ -363,9 +365,14 @@ /** * finds the super class or interface that constrains the types of exceptions that can be thrown from the given method * + * @param cls + * the currently parsed class * @param m * the method to check * @return a map containing the class name to a set of exceptions that constrain this method + * + * @throws ClassNotFoundException + * if a super class or super interface can't be loaded from the repository */ private Map<String, Set<String>> getConstrainingInfo(JavaClass cls, Method m) throws ClassNotFoundException { String methodName = m.getName(); @@ -436,6 +443,9 @@ * @param m * the method to add exceptions from * @return a map with one entry of a class name to a set of exceptions that constrain what can be thrown. + * + * @throws ClassNotFoundException + * if an exception class can't be loaded from the repository */ private Map<String, Set<String>> buildConstrainingInfo(JavaClass cls, Method m) throws ClassNotFoundException { Map<String, Set<String>> constraintInfo = new HashMap<>(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -96,7 +96,7 @@ @Override public void visitClassContext(ClassContext classContext) { try { - localizableFields = new HashMap<String, FieldInfo>(); + localizableFields = new HashMap<>(); visitedBlocks = new BitSet(); clsContext = classContext; clsName = clsContext.getJavaClass().getClassName(); @@ -158,7 +158,7 @@ cfg = clsContext.getCFG(obj); cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); - Set<String> uncheckedFields = new HashSet<String>(localizableFields.keySet()); + Set<String> uncheckedFields = new HashSet<>(localizableFields.keySet()); visitedBlocks.clear(); checkBlock(bb, uncheckedFields); } catch (CFGBuilderException cbe) { @@ -228,7 +228,7 @@ * the list of fields to look for */ private void checkBlock(BasicBlock bb, Set<String> uncheckedFields) { - Deque<BlockState> toBeProcessed = new ArrayDeque<BlockState>(); + Deque<BlockState> toBeProcessed = new ArrayDeque<>(); toBeProcessed.addLast(new BlockState(bb, uncheckedFields)); visitedBlocks.set(bb.getLabel()); @@ -270,8 +270,11 @@ INVOKESPECIAL is = (INVOKESPECIAL) ins; ReferenceType rt = is.getReferenceType(cpg); - if (Values.CONSTRUCTOR.equals(is.getMethodName(cpg)) - && ((rt instanceof ObjectType) && ((ObjectType) rt).getClassName().startsWith(clsContext.getJavaClass().getClassName() + '$'))) { + if (Values.CONSTRUCTOR.equals(is.getMethodName(cpg))) { + if ((rt instanceof ObjectType) && ((ObjectType) rt).getClassName().startsWith(clsContext.getJavaClass().getClassName() + '$')) { + localizableFields.clear(); + } + } else { localizableFields.clear(); } } else if (ins instanceof INVOKEVIRTUAL) { @@ -441,6 +444,9 @@ /** * return the field from the set of unchecked fields if this occurs make a copy of the set on write to reduce memory usage * + * @param field + * the field to be removed + * * @return whether the object was removed. */ public boolean removeUncheckedField(String field) { @@ -455,7 +461,7 @@ } if (fieldsAreSharedWithParent) { - uncheckedFields = new HashSet<String>(uncheckedFields); + uncheckedFields = new HashSet<>(uncheckedFields); fieldsAreSharedWithParent = false; uncheckedFields.remove(field); } else { @@ -473,15 +479,15 @@ private static class FieldModifier extends BytecodeScanningDetector { - private final Map<String, Set<String>> methodCallChain = new HashMap<String, Set<String>>(); - private final Map<String, Set<String>> mfModifiers = new HashMap<String, Set<String>>(); + private final Map<String, Set<String>> methodCallChain = new HashMap<>(); + private final Map<String, Set<String>> mfModifiers = new HashMap<>(); private String clsName; public Map<String, Set<String>> getMethodFieldModifiers() { - Map<String, Set<String>> modifiers = new HashMap<String, Set<String>>(mfModifiers.size()); + Map<String, Set<String>> modifiers = new HashMap<>(mfModifiers.size()); modifiers.putAll(mfModifiers); for (Entry<String, Set<String>> method : modifiers.entrySet()) { - modifiers.put(method.getKey(), new HashSet<String>(method.getValue())); + modifiers.put(method.getKey(), new HashSet<>(method.getValue())); } boolean modified = true; @@ -496,7 +502,7 @@ if (fields != null) { Set<String> flds = modifiers.get(methodDesc); if (flds == null) { - flds = new HashSet<String>(); + flds = new HashSet<>(); modifiers.put(methodDesc, flds); } if (flds.addAll(fields)) { @@ -523,7 +529,7 @@ String methodDesc = getMethodName() + getMethodSig(); Set<String> fields = mfModifiers.get(methodDesc); if (fields == null) { - fields = new HashSet<String>(); + fields = new HashSet<>(); mfModifiers.put(methodDesc, fields); } fields.add(getNameConstantOperand()); @@ -532,7 +538,7 @@ String methodDesc = getMethodName() + getMethodSig(); Set<String> methods = methodCallChain.get(methodDesc); if (methods == null) { - methods = new HashSet<String>(); + methods = new HashSet<>(); methodCallChain.put(methodDesc, methods); } methods.add(getNameConstantOperand() + getSigConstantOperand()); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2016-07-24 19:20:39 UTC (rev 1793) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2016-08-17 00:36:37 UTC (rev 1794) @@ -33,6 +33,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.BugType; +import com.mebigfatguy.fbc... [truncated message content] |
From: <dbr...@us...> - 2016-07-24 19:20:43
|
Revision: 1793 http://sourceforge.net/p/fb-contrib/code/1793 Author: dbrosius Date: 2016-07-24 19:20:39 +0000 (Sun, 24 Jul 2016) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.properties trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/htdocs/index.shtml trunk/fb-contrib/pom.xml trunk/fb-contrib/samples/BAS_Sample.java trunk/fb-contrib/samples/FCBL_Sample.java trunk/fb-contrib/samples/LEST_Sample.java trunk/fb-contrib/samples/LO_Sample.java trunk/fb-contrib/samples/PRMC_Sample.java trunk/fb-contrib/samples/SLS_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/MethodInfo.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.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/CharsetIssues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConflatingResourcesAndFiles.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.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/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/FieldCouldBeLocal.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/IOIssues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JAXRSIssues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JPAIssues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.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/MisleadingOverloadModel.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorMansEnum.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.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/UnboundMethodTemplateParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Unjitable.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/FQMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/OpcodeUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/Values.java Added Paths: ----------- trunk/fb-contrib/samples/BL_Sample.java trunk/fb-contrib/samples/DMC_Sample.java trunk/fb-contrib/samples/FCD_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FindCircularDependencies.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/UnmodifiableList.java Removed Paths: ------------- trunk/fb-contrib/samples/CD_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CircularDependencies.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2016-04-18 22:22:52 UTC (rev 1792) +++ trunk/fb-contrib/.classpath 2016-07-24 19:20:39 UTC (rev 1793) @@ -15,7 +15,7 @@ <classpathentry kind="lib" path="lib/httpclient-cache-4.3.4.jar"/> <classpathentry kind="lib" path="lib/httpcore-4.3.2.jar"/> <classpathentry kind="lib" path="lib/httpclient-4.3.4.jar"/> - <classpathentry kind="lib" path="lib/annotations-3.0.0.jar"/> + <classpathentry kind="lib" path="lib/annotations-3.0.0.jar" sourcepath="/home/dave/.m2/repository/com/google/code/findbugs/annotations/3.0.0/annotations-3.0.0-sources.jar"/> <classpathentry kind="lib" path="lib/asm-debug-all-5.0.2.jar" sourcepath="/home/dave/.m2/repository/org/ow2/asm/asm-debug-all/5.0.2/asm-debug-all-5.0.2-sources.jar"/> <classpathentry kind="lib" path="lib/bcel-findbugs-6.0.jar" sourcepath="lib/sources/bcel-findbugs-6.0-sources.jar"> <attributes> Modified: trunk/fb-contrib/build.properties =================================================================== --- trunk/fb-contrib/build.properties 2016-04-18 22:22:52 UTC (rev 1792) +++ trunk/fb-contrib/build.properties 2016-07-24 19:20:39 UTC (rev 1793) @@ -1,4 +1,4 @@ -jdk14.home=C:/j2sdk1.4.2_13 + bin.includes = plugin.xml,\ META-INF/,\ . Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-04-18 22:22:52 UTC (rev 1792) +++ trunk/fb-contrib/build.xml 2016-07-24 19:20:39 UTC (rev 1793) @@ -28,7 +28,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="6.6.1" /> + <property name="fb-contrib.version" value="6.7.0-SNAPSHOT" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> @@ -39,10 +39,10 @@ <target name="infra_jars" description="pull jars needed to build fb-contrib to ${user.dir}/.ant/lib"> <mkdir dir="${user.home}/.ant/lib" /> - <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/1.4.0/yank-1.4.0.jar" dest="${user.home}/.ant/lib"/> + <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/1.6.1/yank-1.6.1.jar" dest="${user.home}/.ant/lib"/> <get src="https://bitbucket.org/kjlubick/bugrankcheckstyle/downloads/bug-rank-check-style-1.0.0.jar" dest="${user.home}/.ant/lib"/> <get src="http://repo1.maven.org/maven2/com/mebigfatguy/vcsversion/vcsversion/0.4.0/vcsversion-0.4.0.jar" dest="${user.home}/.ant/lib"/> - <get src="http://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.2.0/fb-delta-0.2.0.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/> + <get src="http://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.4.1/fb-delta-0.4.1.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/> </target> <target name="yank" xmlns:yank="antlib:com.mebigfatguy.yank" unless="no.yank"> @@ -179,7 +179,7 @@ <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, com.mebigfatguy.fbcontrib.collect, com.mebigfatguy.fbcontrib.detect, com.mebigfatguy.fbcontrib.debug, com.mebigfatguy.fbcontrib.utils" /> - <attribute name="Import-Package" value="edu.umd.cs.findbugs, edu.umd.cs.findbugs.ba, edu.umd.cs.findbugs.bcel, edu.umd.cs.findbugs.visitclass, org.apache.bcel, org.apache.bcel.classfile, org.apache.bcel.generic" /> + <attribute name="Import-Package" value="edu.umd.cs.findbugs, edu.umd.cs.findbugs.ba, edu.umd.cs.findbugs.ba.generic, edu.umd.cs.findbugs.bcel, edu.umd.cs.findbugs.visitclass, edu.umd.cs.findbugs.internalAnnotations, org.apache.bcel, org.apache.bcel.classfile, org.apache.bcel.generic" /> </manifest> </jar> </target> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2016-04-18 22:22:52 UTC (rev 1792) +++ trunk/fb-contrib/etc/bugrank.txt 2016-07-24 19:20:39 UTC (rev 1793) @@ -8,6 +8,7 @@ +0 BugPattern BAS_BLOATED_ASSIGNMENT_SCOPE +0 BugPattern BED_BOGUS_EXCEPTION_DECLARATION +0 BugPattern BED_HIERARCHICAL_EXCEPTION_DECLARATION ++0 BugPattern BL_BURYING_LOGIC +0 BugPattern BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS +2 BugPattern BSB_BLOATED_SYNCHRONIZED_BLOCK +0 BugPattern CAAL_CONFUSING_ARRAY_AS_LIST @@ -16,7 +17,6 @@ +0 BugPattern CBX_CUSTOM_BUILT_XML +0 BugPattern CCNE_COMPARE_CLASS_EQUALS_NAME +2 BugPattern CC_CYCLOMATIC_COMPLEXITY -+2 BugPattern CD_CIRCULAR_DEPENDENCY +0 BugPattern CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS +0 BugPattern CEBE_COMMONS_EQUAL_BUILDER_TOEQUALS +2 BugPattern CE_CLASS_ENVY @@ -39,6 +39,7 @@ +0 BugPattern CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT +0 BugPattern DDC_DOUBLE_DATE_COMPARISON +0 BugPattern DLC_DUBIOUS_LIST_COLLECTION ++0 BugPattern DMC_DUBIOUS_MAP_COLLECTION +0 BugPattern DRE_DECLARED_RUNTIME_EXCEPTION +0 BugPattern DSOC_DUBIOUS_SET_OF_COLLECTIONS +0 BugPattern DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN @@ -49,6 +50,7 @@ +0 BugPattern EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS +0 BugPattern EXS_EXCEPTION_SOFTENING_RETURN_FALSE +0 BugPattern FCBL_FIELD_COULD_BE_LOCAL ++2 BugPattern FCD_FIND_CIRCULAR_DEPENDENCY +0 BugPattern FPL_FLOATING_POINT_LOOPS +6 BugPattern FP_FINAL_PARAMETERS +0 BugPattern HCP_HTTP_REQUEST_RESOURCES_NOT_FREED_FIELD @@ -94,6 +96,7 @@ +0 BugPattern LO_EXCEPTION_WITH_LOGGER_PARMS +0 BugPattern LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS +0 BugPattern LO_INVALID_FORMATTING_ANCHOR ++0 BugPattern LO_INVALID_STRING_FORMAT_NOTATION +0 BugPattern LO_LOGGER_LOST_EXCEPTION_STACK_TRACE +0 BugPattern LO_STUTTERED_MESSAGE +0 BugPattern LO_SUSPECT_LOG_CLASS Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-04-18 22:22:52 UTC (rev 1792) +++ trunk/fb-contrib/etc/findbugs.xml 2016-07-24 19:20:39 UTC (rev 1793) @@ -20,7 +20,7 @@ <!-- Detectors --> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/> @@ -30,7 +30,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" /> @@ -176,7 +176,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,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING" /> + <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,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION" /> <Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" /> @@ -255,7 +255,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnusedParameter" speed="fast" reports="UP_UNUSED_PARAMETER" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.CircularDependencies" speed="moderate" reports="CD_CIRCULAR_DEPENDENCY"/> + <Detector class="com.mebigfatguy.fbcontrib.detect.FindCircularDependencies" speed="moderate" reports="FCD_FIND_CIRCULAR_DEPENDENCY"/> <Detector class="com.mebigfatguy.fbcontrib.collect.CollectMethodsReturningImmutableCollections" speed="fast" reports="" hidden="true" /> @@ -298,6 +298,11 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.IOIssues" speed="fast" reports="IOI_DOUBLE_BUFFER_COPY,IOI_COPY_WITH_READER"/> <!-- COMMENT OUT FOR POINT RELEASE --> + + <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousMapCollection" speed="fast" reports="DMC_DUBIOUS_MAP_COLLECTION"/> + + <Detector class="com.mebigfatguy.fbcontrib.detect.BuryingLogic" speed="fast" reports="BL_BURYING_LOGIC"/> + <!-- COMMENT OUT FOR POINT RELEASE --> <!-- BugPattern --> @@ -458,6 +463,7 @@ <BugPattern abbrev="LO" type="LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS" category="CORRECTNESS" /> <BugPattern abbrev="LO" type="LO_EXCEPTION_WITH_LOGGER_PARMS" category="CORRECTNESS" /> <BugPattern abbrev="LO" type="LO_APPENDED_STRING_IN_FORMAT_STRING" category="PERFORMANCE" /> + <BugPattern abbrev="LO" type="LO_INVALID_STRING_FORMAT_NOTATION" 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" /> @@ -522,7 +528,7 @@ <BugPattern abbrev="CNC" type="CNC_COLLECTION_NAMING_CONFUSION" category="STYLE" /> <BugPattern abbrev="PME" type="PME_POOR_MANS_ENUM" category="STYLE" /> <BugPattern abbrev="UP" type="UP_UNUSED_PARAMETER" category="STYLE" /> - <BugPattern abbrev="CD" type="CD_CIRCULAR_DEPENDENCY" category="CORRECTNESS" /> + <BugPattern abbrev="FCD" type="FCD_FIND_CIRCULAR_DEPENDENCY" category="CORRECTNESS" /> <BugPattern abbrev="MUC" type="MUC_MODIFYING_UNMODIFIABLE_COLLECTION" category="CORRECTNESS" /> <BugPattern abbrev="UJM" type="UJM_UNJITABLE_METHOD" category="PERFORMANCE" /> <BugPattern abbrev="HES" type="HES_EXECUTOR_NEVER_SHUTDOWN" category="CORRECTNESS" /> @@ -550,15 +556,17 @@ <BugPattern abbrev="JXI" type="JXI_INVALID_CONTEXT_PARAMETER_TYPE" category="CORRECTNESS" /> <BugPattern abbrev="JXI" type="JXI_PARM_PARAM_NOT_FOUND_IN_PATH" category="CORRECTNESS" /> <BugPattern abbrev="JXI" type="JXI_UNDEFINED_PARAMETER_SOURCE_IN_ENDPOINT" category="CORRECTNESS" /> - <BugPattern abbrev="JPAI" type="JPAI_TRANSACTION_ON_NON_PUBLIC_METHOD" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="JPAI" type="JPAI_HC_EQUALS_ON_MANAGED_ENTITY" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="JPAI" type="JPAI_NON_PROXIED_TRANSACTION_CALL" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="JPAI" type="JPAI_INEFFICIENT_EAGER_FETCH" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="JPAI" type="JPAI_IGNORED_MERGE_RESULT" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="JPAI" type="JPAI_NON_SPECIFIED_TRANSACTION_EXCEPTION_HANDLING" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="JPAI" type="JPAI_UNNECESSARY_TRANSACTION_EXCEPTION_HANDLING" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="SEO" type="SEO_SUBOPTIMAL_EXPRESSION_ORDER" category="PERFORMANCE" experimental="true"/> - <BugPattern abbrev="IOI" type="IOI_DOUBLE_BUFFER_COPY" category="PERFORMANCE" experimental="true"/> - <BugPattern abbrev="IOI" type="IOI_COPY_WITH_READER" category="PERFORMANCE" experimental="true"/> + <BugPattern abbrev="JPAI" type="JPAI_TRANSACTION_ON_NON_PUBLIC_METHOD" category="CORRECTNESS"/> + <BugPattern abbrev="JPAI" type="JPAI_HC_EQUALS_ON_MANAGED_ENTITY" category="CORRECTNESS"/> + <BugPattern abbrev="JPAI" type="JPAI_NON_PROXIED_TRANSACTION_CALL" category="CORRECTNESS"/> + <BugPattern abbrev="JPAI" type="JPAI_INEFFICIENT_EAGER_FETCH" category="CORRECTNESS"/> + <BugPattern abbrev="JPAI" type="JPAI_IGNORED_MERGE_RESULT" category="CORRECTNESS"/> + <BugPattern abbrev="JPAI" type="JPAI_NON_SPECIFIED_TRANSACTION_EXCEPTION_HANDLING" category="CORRECTNESS"/> + <BugPattern abbrev="JPAI" type="JPAI_UNNECESSARY_TRANSACTION_EXCEPTION_HANDLING" category="CORRECTNESS"/> + <BugPattern abbrev="SEO" type="SEO_SUBOPTIMAL_EXPRESSION_ORDER" category="PERFORMANCE"/> + <BugPattern abbrev="IOI" type="IOI_DOUBLE_BUFFER_COPY" category="PERFORMANCE"/> + <BugPattern abbrev="IOI" type="IOI_COPY_WITH_READER" category="PERFORMANCE"/> + <BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS" experimental="true"/> + <BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE" experimental="true" /> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2016-04-18 22:22:52 UTC (rev 1792) +++ trunk/fb-contrib/etc/messages.xml 2016-07-24 19:20:39 UTC (rev 1793) @@ -36,7 +36,7 @@ <![CDATA[ <p>Looks for appending strings inside of calls to StringBuffer or StringBuilder append.</p> <pre> - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(a + b); return sb.toString(); </pre> @@ -115,6 +115,15 @@ If a RuntimeException is declared, it implies that this exception type is expected to happen, which if true should be handled in code, and not propagated. </p> <p>It is a fast detector.</p> + <p>As an example, every method could be declared like this: + <code> + public void foo() throws NullPointerException { + } + </code> + But what does that tell you? Is this method very very likely to throw NullPointerExceptions? + If it is, why isn't this method handling them so that exceptions aren't thrown. So don't do this. + If an NPE is very likely, then check for it, and handle the situation. + </p> ]]> </Details> </Detector> @@ -146,7 +155,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess"> <Details> <![CDATA[ - <p>Looks for constructors of non final classes that make method calls to non final methods. + <p>Looks for constructors of non-final classes that make method calls to non-final methods. As these methods could be overridden, the overridden method will be accessing an object that is only partially constructed, perhaps causing problems. Making these called methods final is an easy fix, where possible.</p> @@ -252,17 +261,17 @@ <p>Looks for methods that have the same signature, except where one uses a Character parameter, and the other uses an int, long, float, double parameter. Since autoboxing is available in 1.5 one might assume that - <pre> - test('a') - </pre> +<pre><code> +test('a') +</code></pre> would map to - <pre> - public void test(Character c) - </pre> +<pre><code> +public void test(Character c) +</code></pre> but instead maps to one that takes an int, long, float or double, such as - <pre> - public void test(int i) - </pre> +<pre><code> +public void test(int i) +</code></pre> </p> <p>It is a fast detector.</p> ]]> @@ -491,7 +500,7 @@ <Details> <![CDATA[ <p>Looks for uses of JDBC vendor specific classes and methods making the database - access code non portable.</p> + access code non-portable.</p> <p>It is a fast detector.</p> ]]> </Details> @@ -762,8 +771,10 @@ <Details> <![CDATA[ <p>Looks for calls to classes and methods that do not exist in the JDK for which this class is - compiled. This can happen if you specify the -source and -target options of the javac compiler, and + compiled. This can happen if you specify the <code>-source</code> and <code>-target</code> options of the javac compiler, and specify a target that is less than the JDK version of the javac compiler.</p> + <p>It relies on the system property <code>-Dfb-contrib.sjvu.jdkhome=/path/to/older/jdk/to/check"</code> to specify + what JDK to compare against. If this property is not set, this detector does nothing.</p> <p>It is a slow detector.</p> ]]> </Details> @@ -975,7 +986,7 @@ <Details> <![CDATA[ <p>Looks for methods that are declared to return a Boolean, but return a null - value. As this now allows the method to return 3 values, the use of Boolean is + value. As this now allows the method to return three values, the use of Boolean is dubious. It would be better to just define a new enumeration with three values, and return that.</p> <p>It is a fast detector.</p> @@ -1057,14 +1068,14 @@ <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use must be restricted to covariant or invariant usage.</p> - <pre> - class A {} - class B extends A {} +<pre><code> +class A {} +class B extends A {} - B[] b = new B[2]; - A[] a = b; - a[0] = new A(); // results in ArrayStoreException (Runtime) - </pre> +B[] b = new B[2]; +A[] a = b; +a[0] = new A(); // results in ArrayStoreException (Runtime) +</code></pre> <p>It is a fast detector.</p> ]]> </Details> @@ -1186,9 +1197,9 @@ <![CDATA[ <p>This detector looks for Java bean getter-setter use where the value of a property is set with the value retrieved from the same bean's correllary getter, like this:</p> - <pre> - person.setAge(person.getAge()); - </pre> +<pre><code> + person.setAge(person.getAge()); +</code></pre> <p>Typically this is a copy paste typo.</p> <p>It is a fast detector.</p> ]]> @@ -1199,7 +1210,7 @@ <Details> <![CDATA[ <p>This detector looks for creation of java.awt.Graphics object that do not have the - .dispose() method called on them when finished. These objects will be cleaned up by + <code>.dispose()</code> method called on them when finished. These objects will be cleaned up by the Garbage collector, bug given the likelihood that large numbers of these objects can be created in a short period of time, it is better to dispose them as soon as possible.</p> <p>It is a fast detector.</p> @@ -1232,8 +1243,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode"> <Details> <![CDATA[ - <p>This detector looks for uses for Commons-lang HashCodeBuilder where the - result of hashCode() is returned instead of calling the method toHashCode().</p> + <p>This detector looks for uses for Commons-lang <code>HashCodeBuilder</code> where the + result of <code>hashCode()</code> is returned instead of calling the method <code>toHashCode()</code>.</p> <p>It is a fast detector.</p> ]]> </Details> @@ -1242,8 +1253,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsStringBuilderToString"> <Details> <![CDATA[ - <p>This detector looks for uses for Commons-lang ToStringBuilder where the - result of toString() is returned without an intermediate invocation of toString().</p> + <p>This detector looks for uses for Commons-lang <code>ToStringBuilder</code> where the + result of <code>toString()</code> is returned without an intermediate invocation of toString().</p> <p>It is a fast detector.</p> ]]> </Details> @@ -1365,7 +1376,7 @@ <p>Looks for fields or local variables that are collections but the names have a different type of collection in the name. This is confusing, and is probably a left over from a type change, such as </p> - <p>List<String> mySet;</p> + <p>List<String> mySet;</p> <p>It is a fast detector.</p> ]]> </Details> @@ -1392,7 +1403,7 @@ </Details> </Detector> - <Detector class="com.mebigfatguy.fbcontrib.detect.CircularDependencies"> + <Detector class="com.mebigfatguy.fbcontrib.detect.FindCircularDependencies"> <Details> <![CDATA[ <p>This detector looks circular dependencies among classes. </p> @@ -1550,7 +1561,7 @@ <Details> <![CDATA[ <p>Looks for problems with the use of the JAX-RS specification.</p> - <p>It is a fast detector</p> + <p>It is a fast detector.</p> ]]> </Details> </Detector> @@ -1560,7 +1571,7 @@ <![CDATA[ <p>Looks for problems with the use of the JPA specification, including spring's support of JPA</p> - <p>It is a fast detector</p> + <p>It is a fast detector.</p> ]]> </Details> </Detector> @@ -1570,9 +1581,9 @@ <![CDATA[ <p>Looks for conditional expressions that are a combination of simple local variable (in)equalities and tests on the results of method calls where the method calls are done first. By placing the simple - conditions first you may elminate costly calls in certain cases. This assumes that the method calls + conditions first you may eliminate costly calls in certain cases. This assumes that the method calls do not have side effects that should happen always.</p> - <p>It is a fast detector</p> + <p>It is a fast detector.</p> ]]> </Details> </Detector> @@ -1581,10 +1592,33 @@ <Details> <![CDATA[ <p>Looks for various issues around doing I/O with streams and reader/writers.</p> - <p>It is a fast detector</p> + <p>It is a fast detector.</p> ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousMapCollection"> + <Details> + <![CDATA[ + <p>Looks for use of maps that are private fields in a List only way, that is, maps that are created in constructors + or static initializers, and are only iterated over. Often this is done because the Map allows for two values, as opposed + to a List. The Fix is to just create a List of some object that holds all the values.</p> + <p>It is a fast detector.</p> + ]]> + </Details> + </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.BuryingLogic"> + <Details> + <![CDATA[ + <p>Looks for methods that needlessly push a large chunk of code to the right through indenting with braces. + The code is basically an if/else-then-return structure. The if true test does the bulk of the logic, and the else + just returns. It is more readable if the bulk of the logic is move as far to the left in the method as is possible. + </p> + <p>It is a fast detector.</p> + ]]> + </Details> + </Detector> <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger"> <Details></Details> @@ -1603,33 +1637,33 @@ <p> Java will implicitly use StringBuilders, which can make this hard to detect or fix. For example, <br/> - <code> - StringBuilder sb = new StringBuilder();<br/> - for (Map.Entry<Integer, String> e : map.entrySet()) {<br/> - sb.append(e.getKey() + e.getValue()); //bug detected here<br/> - }<br/> - </code><br/> +<pre><code> +StringBuilder sb = new StringBuilder(); +for (Map.Entry<Integer, String> e : map.entrySet()) { + sb.append(e.getKey() + e.getValue()); //bug detected here +} +</code></pre><br/> gets automatically turned into something like: <br/> - <code> - StringBuilder sb = new StringBuilder();<br/> - for (Map.Entry<Integer, String> e : map.entrySet()) {<br/> - StringBuilder tempBuilder = new StringBuilder();<br/> - tempBuilder.append(e.getKey());<br/> - tempBuilder.append(e.getValue());<br/> - sb.append(tempBuilder.toString()); //this isn't too efficient<br/> - }<br/> - </code><br/> +<pre><code> +StringBuilder sb = new StringBuilder(); +for (Map.Entry<Integer, String> e : map.entrySet()) { + StringBuilder tempBuilder = new StringBuilder(); + tempBuilder.append(e.getKey()); + tempBuilder.append(e.getValue()); + <b>sb.append(tempBuilder.toString());</b> //this isn't too efficient +} +</code></pre><br/> which involves a temporary <code>StringBuilder</code>, which is completely unnecessary. To prevent this from happening, simply do:<br/> - <code> - StringBuilder sb = new StringBuilder();<br/> - for (Map.Entry<Integer, String> e : map.entrySet()) {<br/> - sb.append(e.getKey()); <br/> - sb.append(e.getValue());<br/> - }<br/> - </code> +<pre><code> +StringBuilder sb = new StringBuilder(); +for (Map.Entry<Integer, String> e : map.entrySet()) { + sb.append(e.getKey()); + sb.append(e.getValue()); +} +</code></pre> </p> ]]> </Details> @@ -1658,24 +1692,27 @@ does not suffer the potential for <code>NullPointerException</code>s, and is easier to read.</p> <p> - Keep in mind that Java compiles simple <code>String</code> concatenation to use <code>StringBuilder</code>s, so you may see this bug even when you don't use <code>StringBuilder</code>s explicitly. + Keep in mind that Java compiles simple <code>String</code> concatenation to use <code>StringBuilder</code>s, + so you may see this bug even when you don't use <code>StringBuilder</code>s explicitly. </p> <p> Instead of: <br/> - <code> - StringBuilder builder = ... <br/> - builder.append(someObj.toString());<br/> - ... <br/> - System.out.println("Problem with the object :" + someObj.toString());<br/> - </code> - just do: <br/> - <code> - StringBuilder builder = ... <br/> - builder.append(someObj);<br/> - ... <br/> - System.out.println("Problem with the object :" + someObj);<br/> - </code> +<pre><code> +StringBuilder builder = ...; +builder.append(someObj.toString()); +... +System.out.println("Problem with the object :" + someObj.toString()); +</code></pre> + +just do: <br/> + +<pre><code> +StringBuilder builder = ... +builder.append(someObj); +... +System.out.println("Problem with the object :" + someObj); +</code></pre> to avoid the possibility of <code>NullPointerException</code>s when someObj is <code>null</code>. </p> ]]> @@ -1716,21 +1753,21 @@ make low impact changes easier to accomplish in the future.</p> <p>Take the following example:<br/> - <code> - private void appendToList(ArrayList<String> list) {<br/> - if (list.size() < 100) {<br/> - list.add("Foo");<br/> - }<br/> - }<br/> - </code> +<pre><code> +private void appendToList(ArrayList<String> list) { + if (list.size() < 100) { + list.add("Foo"); + } +} +</code></pre> The parameter list is currently defined as an <code>ArrayList</code>, which is a concrete implementation of the <code>List</code> interface. Specifying <code>ArrayList</code> is unnecessary here, because we aren't using any <code>ArrayList</code>-specific methods (like <code>ensureCapacity()</code> or <code>trimToSize()</code>). Instead of using the concrete definition, it is better to do something like:<br/> - <code> - private void appendToList(List<String> list) {<br/> - ...<br/> - </code> +<pre><code> +private void appendToList(List<String> list) { + ... +</code></pre> If the design ever changes, e.g. a <code>LinkedList</code> is used instead, this code won't have to change. </p> @@ -1798,15 +1835,16 @@ <Details> <![CDATA[ <p>This line is in the form of <br/> - <code>String str = ...<br/> - str.equals("someOtherString");<br/> - //or<br/> - str.compareTo("someOtherString");</code></p> +<pre><code>String str = ... +str.equals("someOtherString"); +//or +str.compareTo("someOtherString");</code></pre> + </p> <p>A <code>NullPointerException</code> may occur if the String variable <code>str</code> is <code>null</code>. If instead the code was restructured to<br/> - <code>String str = ...<br/> - "someOtherString".equals(str);<br/> - //or<br/> - "someOtherString".compareTo(str);</code><br/> +<pre><code>String str = ... +"someOtherString".equals(str); +//or +"someOtherString".compareTo(str);</code></pre><br/> that is, call <code>equals()</code> or <code>compareTo()</code> on the string literal, passing the variable as an argument, this exception could never happen as both <code>equals()</code> and <code>compareTo()</code> check for <code>null</code>.</p> @@ -1833,7 +1871,8 @@ <![CDATA[ <p>This class defines a field based on java.util.List, but uses it to some extent like a Set. Since lookup type operations are performed using a linear search for Lists, the performance for large - Lists will be poor. Consider changing this fields implementation to a set based one. If order of + Lists will be poor. If the list is known to only contain a small number of items, (3,4, etc) then it doesn't matter. + Otherwise, consider changing this fields implementation to a set-based one. If order of iteration is important to maintain insert order, perhaps consider a LinkedHashSet.</p> ]]> </Details> @@ -1846,22 +1885,22 @@ <![CDATA[ <p>This class appears to maintain two or more lists or arrays whose contents are related in a parallel way. That is, you have something like:<br/> - <code> - List<String> words = new ArrayList<String>();<br/> - List<Integer> wordCounts = new ArrayList<String>();<br/> - </code> +<pre><code> +List<String> words = new ArrayList<String>(); +List<Integer> wordCounts = new ArrayList<String>(); +</code></pre> where the elements of the list at index 0 are related, the elements at index 1 are related and so on. </p> <p> Consider creating a separate class to hold all the related pieces of information, and adding instances of this class to just one list or array, or if just two values, use a Map to associate one value with the other like:<br/> - <code> - private class WordAndCount{public String word; public int count} - List<WordAndCount> wordsAndCounts = new ArrayList<WordAndCount>();<br/> - <br/> - //or, for just two elements<br/> - Map<String,Integer> wordCounts = new HashMap<String,Integer>();<br/> - </code> +<pre><code> +private class WordAndCount{public String word; public int count} + +List<WordAndCount> wordsAndCounts = new ArrayList<WordAndCount>(); +//or, for just two elements +Map<String,Integer> wordCounts = new HashMap<String,Integer>(); +</code></pre> </p> ]]> @@ -1917,6 +1956,14 @@ math is imprecise, rounding errors will accumulate over time each time the loop is executed. It is usually better to use integer indexing, and calculate the new value of the floating point number at the top of the loop body.</p> + <p>Example: +<pre><code> +for (float f = 1.0f; f <= 10.0f; f += 0.1f) { + System.out.println(f); +} +</code></pre> + The last value printed may not be 10.0, but instead might be 9.900001 or such. + </p> ]]> </Details> </BugPattern> @@ -2002,20 +2049,20 @@ <p>This method passes a primitive value retrieved from a <code>BoxedPrimitive.parseBoxedPrimitive("1")</code> call to the same class's constructor. It is simpler to just pass the string to the BoxedPrimitives constructor or, better yet, use the static valueOf.</p> <p>Instead of something like:<br/> - <code> - Boolean bo = new Boolean(Boolean.parseBoolean("true")); <br/> - Float f = new Float(Float.parseFloat("1.234"));<br/> - </code> +<pre><code> +Boolean bo = new Boolean(Boolean.parseBoolean("true")); +Float f = new Float(Float.parseFloat("1.234")); +</code></pre> Simply do: <br/> - <code> - Boolean bo = new Boolean("true"); <br/> - Float f = new Float("1.234");<br/> - </code> +<pre><code> +Boolean bo = new Boolean("true"); +Float f = new Float("1.234"); +</code></pre> or, to be more memory efficient: <br/> - <code> - Boolean bo = Boolean.valueOf("true"); <br/> - Float f = Float.valueOf("1.234");<br/> - </code> +<pre><code> +Boolean bo = Boolean.valueOf("true"); +Float f = Float.valueOf("1.234"); +</code></pre> </p> ]]> </Details> @@ -2044,21 +2091,21 @@ method. </p> <p>Instead of something like:<br/> - <code> - public int someMethod(String data) {<br/> - long l = Long.valueOf(data).longValue(); <br/> - float f = Float.valueOf(data).floatValue(); <br/> - return Integer.valueOf(data); // There is an implicit .intValue() call<br/> - }<br/> - </code> +<pre><code> +public int someMethod(String data) { +long l = Long.valueOf(data).longValue(); +float f = Float.valueOf(data).floatValue(); +return Integer.valueOf(data); // There is an implicit .intValue() call +} +</code></pre> Simply do: <br/> - <code> - public int someMethod(String data) {<br/> - long l = Long.parseLong(data); <br/> - float f = Float.parseFloat(data); <br/> - return Integer.parseInt(data); <br/> - }<br/> - </code> +<pre><code> +public int someMethod(String data) { + long l = Long.parseLong(data); + float f = Float.parseFloat(data); + return Integer.parseInt(data); +} +</code></pre> </p> ]]> @@ -2075,15 +2122,15 @@ to a boxed primitive object, it is simpler to use the BoxedPrimitive.valueOf(String) method.</p> <p>Instead of something like:<br/> - <code> - Boolean bo = Boolean.valueOf(Boolean.parseBoolean("true")); <br/> - Float f = Float.valueOf(Float.parseFloat("1.234"));<br/> - </code> +<pre><code> +Boolean bo = Boolean.valueOf(Boolean.parseBoolean("true")); +Float f = Float.valueOf(Float.parseFloat("1.234")); +</code></pre> Simply do: <br/> - <code> - Boolean bo = Boolean.valueOf("true"); <br/> - Float f = Float.valueOf("1.234");<br/> - </code> +<pre><code> +Boolean bo = Boolean.valueOf("true"); +Float f = Float.valueOf("1.234"); +</code></pre> </p> ]]> </Details> @@ -2097,15 +2144,15 @@ <p>This method constructs a Boxed Primitive from a primitive only to call the primitiveValue() method to convert it back to a primitive. Just use the primitive value instead.</p> <p>Instead of something like:<br/> - <code> - boolean bo = new Boolean(true).booleanValue(); <br/> - float f = new Float(1.234f).floatValue();<br/> - </code> +<pre><code> +boolean bo = new Boolean(true).booleanValue(); +float f = new Float(1.234f).floatValue(); +</code></pre> Simply do: <br/> - <code> - boolean bo = true; <br/> - float f = 1.234f;<br/> - </code> +<pre><code> +boolean bo = true; +float f = 1.234f; +</code></pre> </p> ]]> @@ -2120,21 +2167,21 @@ <p>This method constructs a Boxed Primitive from a primitive only to call the primitiveValue() method to cast the value to another primitive type. It is simpler to just use casting.</p> <p>Instead of something like:<br/> - <code> - double someDouble = ...<br/> - float f = new Double(someDouble).floatValue();<br/> - <br/> - int someInt = ...<br/> - byte b = new Integer(someInt).byteValue();<br/> - </code> +<pre><code> +double someDouble = ... +float f = new Double(someDouble).floatValue(); + +int someInt = ... +byte b = new Integer(someInt).byteValue(); +</code></pre> Simply do: <br/> - <code> - double someDouble = ...<br/> - float f = (float) someDouble;<br/> - <br/> - int someInt = ...<br/> - byte b = (byte)someInt;<br/> - </code> +<pre><code> +double someDouble = ... +float f = (float) someDouble; + +int someInt = ... +byte b = (byte)someInt; +</code></pre> </p> ]]> </Details> @@ -2147,37 +2194,37 @@ <![CDATA[ <p>This method assigns a Boxed boolean constant to a primitive boolean variable, or assigns a primitive boolean constant to a Boxed boolean variable. Use the correct constant for the variable desired. Use <br/> - <code> - boolean b = true;<br/> - boolean b = false;<br/> - </code> +<pre><code> +boolean b = true; +boolean b = false; +</code></pre> or <br/> - <code> - Boolean b = Boolean.TRUE;<br/> - Boolean b = Boolean.FALSE; - </code> +<pre><code> +Boolean b = Boolean.TRUE; +Boolean b = Boolean.FALSE; +</code></pre> </p> <p>Be aware that this boxing happens automatically when you might not expect it. For example, <br/> - <code> - Map<String, Boolean> statusMap = ... <br/> - <br/> - public Boolean someMethod() {<br/> - statusMap.put("foo", true); //the "true" here is boxed<br/> - return false; //the "false" here is boxed<br/> - }<br/> - </code> +<pre><code> +Map<String, Boolean> statusMap = ... + +public Boolean someMethod() { + statusMap.put("foo", true); //the "true" here is boxed + return false; //the "false" here is boxed +} +</code></pre> has two cases of this needless autoboxing. This can be made more efficient by simply substituting in the constant values: <br/> - <code> - Map<String, Boolean> statusMap = ... <br/> - <br/> - public Boolean someMethod() {<br/> - statusMap.put("foo", Boolean.TRUE); <br/> - return Boolean.FALSE; <br/> - }<br/> - </code> +<pre><code> +Map<String, Boolean> statusMap = ... + +public Boolean someMethod() { + statusMap.put("foo", Boolean.TRUE); + return Boolean.FALSE; +} +</code></pre> </p> ]]> </Details> @@ -2193,26 +2240,29 @@ assigned to the local variable, directly.</p> <p> Instead of the following: <br/> - <code> - public float average(int[] arr) { <br/> - float sum = 0;<br/> - for (int i = 0; i < arr.length; i++) {<br/> - sum += arr[i];<br/> - }<br/> - float ave = sum / arr.length;<br/> - return ave;<br/> - }<br/> - </code> - simply change the method to return the result of the division: <br/> - <code> - public float average(int[] arr) {<br/> - float sum = 0;<br/> - for (int i = 0; i < arr.length; i++) {<br/> - sum += arr[i];<br/> - }<br/> - <b>return sum / arr.length;</b><br/> - } - </code> + +<pre><code> +public float average(int[] arr) { + float sum = 0; + for (int i = 0; i < arr.length; i++) { + sum += arr[i]; + } + float ave = sum / arr.length; + return ave; +} +</code></pre> + + Simply change the method to return the result of the division: <br/> + +<pre><code> +public float average(int[] arr) { + float sum = 0; + for (int i = 0; i < arr.length; i++) { + sum += arr[i]; + } + <b>return sum / arr.length;</b> //Change +} +</code></pre> </p> ]]> </Details> @@ -2373,31 +2423,40 @@ <![CDATA[ <p>This method compares dates with two comparisons, rather than using the reverse comparison. So this pattern</p> - <code> - if ((date1.equals( date2 )) || (date1.after( date2 )))<br/> - </code> + +<pre><code> +if ((date1.equals( date2 )) || (date1.after( date2 ))) +</code></pre> + could become:<br/> - <code> - if (date1.compareTo( date2 ) >= 0) <br/> - </code> - <br/> + +<pre><code> +if (date1.compareTo( date2 ) >= 0) +</code></pre><br/> + and<br/> - <code> - if ((date1.equals( date2 )) || (date1.before( date2 ))) <br/> - </code> + +<pre><code> +if ((date1.equals( date2 )) || (date1.before( date2 ))) +</code></pre> + could become <br/> - <code> - if (date1.compareTo( date2 ) <= 0) <br/> - </code> - <br/> + +<pre><code> +if (date1.compareTo( date2 ) <= 0) +</code></pre><br/> + and<br/> - <code> - if ((date1.before( date2 )) || (date1.after( date2 ))) <br/> - </code> + +<pre><code> +if ((date1.before( date2 )) || (date1.after( date2 ))) +</code></pre> + could become<br/> - <code> - if (!date1.equals( date2 ))<br/> - </code> + +<pre><code> +if (!date1.equals( date2 )) +</code></pre> ]]> </Details> </BugPattern> @@ -2440,17 +2499,17 @@ a potential cause of memory bloat.</p> <p> - If this collection is a list, set or otherwise of static things (e.g. a List<String> for month names), consider + If this collection is a list, set or otherwise of static things (e.g. a List>String> for month names), consider adding all of the elements in a static initializer, which can only be called once:<br/> - <code> - private static List<String> monthNames = new ArrayList<String>();<br/> - static {<br/> - monthNames.add("January");<br/> - monthNames.add("February");<br/> - monthNames.add("March");<br/> - ...<br/> - } - </code> +<pre><code> +private static List<String> monthNames = new ArrayList<String>(); +static { + monthNames.add("January"); + monthNames.add("February"); + monthNames.add("March"); + ... +} +</code></pre> </p> ]]> @@ -2715,7 +2774,15 @@ <p>This method catches an exception, and throws a different exception, without incorporating the original exception. Doing so hides the original source of the exception making debugging and fixing these problems difficult. It is better to use the constructor of this new exception that takes an - original exception so that this detail can be passed along to the user.</p> + original exception so that this detail can be passed along to the user. If this exception has no constructor + that takes an initial cause parameter, use the initCause method to initialize it instead.</p> + <p> +<pre><code> +catch (IOException e) { + throw new MySpecialException("Failed to open configuration", e); +} +</code></pre> + </p> ]]> </Details> </BugPattern> @@ -2731,26 +2798,26 @@ <p> Instead of making calls like: <br/> - <code> - String myString = ... <br/> - if (myString.indexOf("e") != -1) {<br/> - int i = myString.lastIndexOf("e");<br/> - System.out.println(myString + ":" + i); //the Java compiler will use a StringBuilder internally here [builder.append(":")]<br/> - ...<br/> - return myString.replace("m","z");<br/> - }<br/> - </code> +<pre><code> +String myString = ... +if (myString.indexOf("e") != -1) { + int i = myString.lastIndexOf("e"); + System.out.println(myString + ":" + i); //the Java compiler will use a StringBuilder internally here [builder.append(":")] + ... + return myString.replace("m","z"); +} +</code></pre> Replace the single letter <code>String</code>s with their <code>char</code> equivalents like so:<br/> - <code> - String myString = ... <br/> - if (myString.indexOf('e') != -1) {<br/> - int i = myString.lastIndexOf('e');<br/> - System.out.println(myString + ':' + i); //the Java compiler will use a StringBuilder internally here [builder.append(':')]<br/> - ...<br/> - return myString.replace('m','z');<br/> - }<br/> - </code> +<pre><code> +String myString = ... +if (myString.indexOf('e') != -1) { + int i = myString.lastIndexOf('e'); + System.out.println(myString + ':' + i); //the Java compiler will use a StringBuilder internally here [builder.append(':')] + ... + return myString.replace('m','z'); +} +</code></pre> </p> ]]> </Details> @@ -2948,13 +3015,13 @@ <p>This method attempts to check for null by just referring to the variable name as would be done in C++. This ordinarily would be considered a compile error, except the variable in question is a Boolean, which does an auto unbox to boolean. - <code><br/> - if (b && b.booleanValue())<br/> - </code> +<pre><code> +if (b && b.booleanValue()) +</code></pre> should be<br/> - <code> - if ((b != null) && b.booleanValue())<br/> - </code> +<pre><code> +if ((b != null) && b.booleanValue()) +</code></pre> </p> ]]> </Details> @@ -2990,27 +3057,27 @@ <![CDATA[ <p>This method tests a string, and groups null values with real strings, leaving empty strings as another case. That is, FindBugs has detected a structure like: <br/> - <code> - String a = null, b = "", c = "someString"; <br/> - ...<br/> - String testStr = ...; //one of a, b or c<br/> - if (<b>FLAWED_TEST_LOGIC</b>) { <br/> - // Strings a and c fall into this branch... which is not typical. <br/> - } else { <br/> - // String b falls into this branch. <br/> - } <br/> - </code> +<pre><code> +String a = null, b = "", c = "someString"; + +String testStr = ...; //one of a, b or c +if ({{FLAWED_TEST_LOGIC}}) { + // Strings a and c fall into this branch... which is not typical. +} else { + // String b falls into this branch. +} +</code></pre> This might be perfectly valid, but normally, null strings and empty strings are logically handled the same way, and so this test may be flawed.</p> <p>Pattern found is one of the following: <ul> - <li><code>if ((s == null) || (s.length() > 0))</code> --- did you mean + <li><code>if ((s == null) || (s.length() > 0))</code> --- did you mean <code>((s == null) || (s.length() == 0))</code>?</li> <li><code>if ((s == null) || (s.length() != 0))</code> -- did you mean <code>((s == null) || (s.length() == 0))</code>? </li> <li><code>if ((s != null) && (s.length() == 0))</code> -- did you mean - <code>((s != null) && (s.length() > 0))</code> or perhaps + <code>((s != null) && (s.length() > 0))</code> or perhaps <code>((s == null) || (s.length() == 0))</code>? </li> </ul> </p> @@ -3171,24 +3238,24 @@ <![CDATA[ <p>This method appends two literal strings to a <code>StringBuilder</code> back to back. Modern compilers will optimize something like:<br/> - <code> - public static final string CONST_VAL = "there";<br/> - ...<br/> - String str = "Hello" + " "+ CONST_VAL + " " +"world!";<br/> - </code> +<pre><code> +public static final string CONST_VAL = "there"; +... +String str = "Hello" + " "+ CONST_VAL + " " +"world!"; +</code></pre> to: <br/> - <code> - public static final string CONST_VAL = "there";<br/> - ...<br/> - String str = "Hello there world!";<br/> - </code> +<pre><code> +public static final string CONST_VAL = "there"; +... +String str = "Hello there world!"; +</code></pre> This means the concatenation is done during compile time, not at runtime, so there's <b>no need</b> to do: <br/> - <code> - public static final string CONST_VAL = "there";<br/> - ...<br/> - StringBuilder sb = new StringBuilder("Hello").append(" ").append(CONST_VAL).append(" ").append("world!");<br/> - String str = sb.toString();<br/> - </code> +<pre><code> +public static final string CONST_VAL = "there"; +... +StringBuilder sb = new StringBuilder("Hello").append(" ").append(CONST_VAL).append(" ").append("world!"); +String str = sb.toString(); +</code></pre> which is harder to read and will result in more complex bytecode. </p> @@ -3242,14 +3309,15 @@ <p> For example, instead of :<br/> - <code> - return "ThisIsAConstantString ".toLowerCase().trim(); <br/> - </code> +<pre><code> +return "ThisIsAConstantString".toLowerCase().trim(); +</code></pre> just do <br/> - <code> - return "thisisaconstantstring"; <br/> - </code> - for shorter and easier to read code. An exception might be made when locale-specific transformations need to be done (in the case of <code>toUpperCase()</code> and <code>toLowerCase()</code>. +<pre><code> +return "thisisaconstantstring"; +</code></pre> + for shorter and easier to read code. An exception might be made when locale-specific transformations need + to be done (in the case of <code>toUpperCase()</code> and <code>toLowerCase()</code>. </p> ]]> </Details> @@ -3361,11 +3429,11 @@ <p>PLEASE NOTE: String.split will return an array of 1 element when passed the empty string, as opposed to using StringTokenizer which returns false on the first hasMoreElements/hasMoreTokens call. So you may need to use:</p> - <code> - if (s.length() > 0) <br/> - return s.split(";");<br/> - return new String[0];<br/> - </code> +<pre><code> +if (s.length() > 0) <br/> + return s.split(";");<br/> +return new String[0];<br/> +</code></pre> ]]> </Details> </BugPattern> @@ -3780,8 +3848,8 @@ </BugPattern> <BugPattern type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT"> - <ShortDescription>Method modifies http session attribute without calling setAttribute</ShortDescription> - <LongDescription>Method {1} modifies http session attribute without calling setAttribute</LongDescription> + <ShortDescription>Method modifies an http session attribute without calling setAttribute</ShortDescription> + <LongDescription>Method {1} modifies an http session attribute without calling setAttribute</LongDescription> <Details> <![CDATA[ <p>This method fetches a complex object from an HttpSession object, modifies this object, but does @@ -3851,9 +3919,31 @@ <p>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.</p> + <p>This pattern is invalid: + <code>logger.error("{0} is broken", theThing);</code> + Use instead + <code>logger.error("{} is broken", theThing);</code> + </p> ]]> </Details> </BugPattern> + + <BugPattern type="LO_INVALID_STRING_FORMAT_NOTATION"> + <ShortDescription>Method attempts to log using String.format notation</ShortDescription> + <LongDescription>Method {1} attempts to log using String.format notation</LongDescription> + <Details> + <![CDATA[ + <p>This method attempts to use an SLF4J logger to log a parameterized expression using String.format notation. + However, SLF4J uses simple non numbered anchors such as {}, rather than anchors with percent signs in them as the + code uses. Thus no parameter replacement will occur.</p> + <p>This pattern is invalid: + <code>logger.error("%s is broken", theThing);</code> + Use instead + <code>logger.error("{} is broken", theThing);</code> + </p> + ]]> + </Details> + </BugPattern> <BugPattern type="LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS"> <ShortDescription>Method passes an incorrect number of parameters to an SLF4J logging statement</ShortDescription> @@ -4071,6 +4161,21 @@ symmetry rule of equivalence is maintained, that being if a equals b, then b equals a. It does not appear that the class that is being compared to this class knows about this class, and doesn't compare itself to this.</p> + <p> + Here's an example of a BAD equals method, do NOT do this: +<pre><code> +class Person { + public boolean equals(Object o) { + if (o instanceof Person) { + return name.equals(((Person) o).name); + } else if (o instanceof String) { + return name.equals(o); + } + return false; + } +} +</code></pre> + </p> ]]> </Details> </BugPattern> @@ -4083,13 +4188,13 @@ <p>This method contains a contravariant array assignment. Since arrays are mutable data structures, their use must be restricted to covariant or invariant usage.</p> - <code> - class A {}<br/> - class B extends A {}<br/> - <br/> - B[] b = new B[2];<br/> - A[] a = b;<br/> - </code> +<pre><code> +class A {} +class B extends A {} + +B[] b = new B[2]; +A[] a = b; +</code></pre> ]]> </Details> </BugPattern> @@ -4102,14 +4207,14 @@ <p>This method contains a contravariant array element assignment. Since arrays are mutable data structures, their use must be restricted to covariant or invariant usage.</p> - <code> - class A {}<br/> - class B extends A {}<br/> - <br/> - B[] b = new B[2];<br/> - A[] a = b;<br/> - a[0] = new A(); // results in ArrayStoreException (Runtime)<br/> - </code> +<pre><code> +class A {} +class B extends A {} + +B[] b = new B[2]; +A[] a = b; +a[0] = new A(); // results in ArrayStoreException (Runtime) +</code></pre> ]]> </Details> </BugPattern> @@ -4135,6 +4240,14 @@ <p>This method tests a field to make sure it's not null before executing a conditional block of code. However in the conditional block it reassigns the field. It is likely that the guard should have been a check to see if the field is null, not that the field was not null.</p> + <p>example: +<pre><code> +if (name != null) { + name = person.getName(); +} +</code></pre> + It is possible this is correct, but it seems likely the guard was meant to be <code>if (name == null)</code> + </p> ]]> ... [truncated message content] |
From: <dbr...@us...> - 2016-04-18 22:22:53
|
Revision: 1792 http://sourceforge.net/p/fb-contrib/code/1792 Author: dbrosius Date: 2016-04-18 22:22:52 +0000 (Mon, 18 Apr 2016) Log Message: ----------- Version 6.6.1 Added Paths: ----------- tags/v6_6_1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2016-04-18 22:19:59
|
Revision: 1791 http://sourceforge.net/p/fb-contrib/code/1791 Author: dbrosius Date: 2016-04-18 22:19:54 +0000 (Mon, 18 Apr 2016) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/etc/bugrank.txt trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/htdocs/index.shtml trunk/fb-contrib/htdocs/mbfg_menu.shtml trunk/fb-contrib/htdocs/repository.html trunk/fb-contrib/pom.xml trunk/fb-contrib/samples/BAS_Sample.java trunk/fb-contrib/samples/CD_Sample.java trunk/fb-contrib/samples/IMC_Sample.java trunk/fb-contrib/samples/UTAO_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/Debug.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.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/BackportReusePublicIdentifiers.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/CharsetIssues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CircularDependencies.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConflatingResourcesAndFiles.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.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/ContainsBasedConditional.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.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/DubiousSetOfCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IOIssues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JPAIssues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.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/ManualArrayCopy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorMansEnum.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.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/ReflectionOnObjectMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/BugType.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/FQMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/QMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/ToString.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/UnmodifiableSet.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/XClassUtils.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/.classpath 2016-04-18 22:19:54 UTC (rev 1791) @@ -31,5 +31,6 @@ <classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar"/> <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar" sourcepath="lib/sources/commons-io-1.3.2-sources.jar"/> <classpathentry kind="lib" path="lib/mockito-all-2.0.2-beta.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> <classpathentry kind="output" path="target/classes/main"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/build.xml 2016-04-18 22:19:54 UTC (rev 1791) @@ -28,7 +28,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="6.6.0" /> + <property name="fb-contrib.version" value="6.6.1" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/etc/bugrank.txt 2016-04-18 22:19:54 UTC (rev 1791) @@ -65,6 +65,7 @@ +2 BugPattern IMC_IMMATURE_CLASS_NO_HASHCODE +0 BugPattern IMC_IMMATURE_CLASS_NO_PACKAGE +2 BugPattern IMC_IMMATURE_CLASS_NO_TOSTRING ++0 BugPattern IMC_IMMATURE_CLASS_PRINTSTACKTRACE +0 BugPattern IOI_COPY_WITH_READER +0 BugPattern IOI_DOUBLE_BUFFER_COPY +0 BugPattern IPU_IMPROPER_PROPERTIES_USE Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/etc/findbugs.xml 2016-04-18 22:19:54 UTC (rev 1791) @@ -285,7 +285,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.StringifiedTypes" speed="fast" reports="STT_STRING_PARSING_A_FIELD,STT_TOSTRING_STORED_IN_FIELD" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.JAXRSIssues" speed="fast" reports="JXI_GET_ENDPOINT_CONSUMES_CONTENT,JXI_INVALID_CONTEXT_PARAMETER_TYPE,JXI_PARM_PARAM_NOT_FOUND_IN_PATH,JXI_UNDEFINED_PARAMETER_SOURCE_IN_ENDPOINT" /> @@ -545,6 +545,7 @@ <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_HASHCODE" category="STYLE" /> <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_PACKAGE" category="STYLE" /> <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_TOSTRING" category="STYLE" /> + <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_PRINTSTACKTRACE" category="STYLE" /> <BugPattern abbrev="JXI" type="JXI_GET_ENDPOINT_CONSUMES_CONTENT" category="CORRECTNESS" /> <BugPattern abbrev="JXI" type="JXI_INVALID_CONTEXT_PARAMETER_TYPE" category="CORRECTNESS" /> <BugPattern abbrev="JXI" type="JXI_PARM_PARAM_NOT_FOUND_IN_PATH" category="CORRECTNESS" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/etc/messages.xml 2016-04-18 22:19:54 UTC (rev 1791) @@ -1535,7 +1535,10 @@ <p>Looks for classes that are not fully complete from a usability point of view. Making them more difficult to use than it should be. Things such as <ul> + <li>Using the default package</li> + <li>Missing hashCode/equals</li> <li>Missing toString() method</li> + <li>Using autogenerated parameter names</li> </ul> </p> <p>It is a moderately fast detector.</p> @@ -5032,7 +5035,7 @@ <![CDATA[ <p>This method fetches a resource from a URL, and uses the File API to manipulate it. If this resource is a classpath resource, it will work if the resource is a file in a directory. If however the file is inside a JAR file - this will fail. Use the URL.openStream API instead to access the data of the classpath resource. + this will fail. To avoid this confusing inconsistency, use the URL.openStream API instead to access the data of the classpath resource. </p> ]]> </Details> @@ -5083,8 +5086,8 @@ <LongDescription>Class {0} does not implement a toString method</LongDescription> <Details> <![CDATA[ - <p>This class which has instance fields has no toString() method, which will make debugging with this - class more difficult than it could be. Consider adding a method. Using libraries like commons-lang3 + <p>This class, which has instance fields, has no toString() method which will make debugging with this + class more difficult than it could be. Consider adding a toString() method. Using libraries like commons-lang3 ToStringBuilder makes this process easy. </p> ]]> @@ -5104,6 +5107,18 @@ </Details> </BugPattern> + <BugPattern type="IMC_IMMATURE_CLASS_PRINTSTACKTRACE"> + <ShortDescription>Method prints the stack trace to the console</ShortDescription> + <LongDescription>Method {1} prints the stack trace to the console</LongDescription> + <Details> + <![CDATA[ + <p>This method prints a stack trace to the console. This is non configurable, and causes an + application to look unprofessional. Switch to using loggers so that users can control what + is logged and where. + ]]> + </Details> + </BugPattern> + <BugPattern type="JXI_GET_ENDPOINT_CONSUMES_CONTENT"> <ShortDescription>JAX-RS Method implements a GET request but consumes input</ShortDescription> <LongDescription>JAX-RS Method {1} implements a GET request but consumes input</LongDescription> @@ -5247,7 +5262,7 @@ <Details> <![CDATA[ <p>This method declares that it either rolls back or does not rollback a transaction based on an - expected transaction being thrown. However this exception can not be thrown from this method, and so the + expected exception being thrown. However this exception, nor any derived exceptions can not be thrown from this method, and so the annotation is useless.</p> ]]> </Details> @@ -5260,9 +5275,9 @@ <![CDATA[ <p>This method builds a conditional expression, for example, in an if or while statement where the expressions contain both simple local variable comparisons, as well as comparisons on method calls. The expression orders these so that the method calls - come before the simple local variable call comparisons. This causes method calls to be executed in conditions when they + come before the simple local variable comparisons. This causes method calls to be executed in conditions when they do not need to be, and thus potentially causes a lot of code to be executed for nothing. By ordering the expressions so that - the simple conditions contains local variable conditions are first, you eliminate this waste. This assumes that the method + the simple conditions containing local variable conditions are first, you eliminate this waste. This assumes that the method calls do not have side effects. If the method do have side effects, it is probably a better idea to pull these calls out of the condition and execute them first, assigning a value to a local variable. In this way you give a hint that the call may have side effects.</p> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/htdocs/index.shtml 2016-04-18 22:19:54 UTC (rev 1791) @@ -68,7 +68,7 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 6.6.0 available for download + <p style="font-weight: bold;">The latest version of fb-contrib is 6.6.1 available for download <a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p> <p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p> <p style="font-weight: bold;">Please note that active development for this project is now done on Modified: trunk/fb-contrib/htdocs/mbfg_menu.shtml =================================================================== --- trunk/fb-contrib/htdocs/mbfg_menu.shtml 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/htdocs/mbfg_menu.shtml 2016-04-18 22:19:54 UTC (rev 1791) @@ -2,8 +2,10 @@ <a id="mbfg_menu" href="#" >Other MeBigFatGuy Projects</a> <div id="mbfg_projects"> <ul> + <li><a href="https://github.com/mebigfatguy/deadmethods">DeadMethods</a></li> + <li><a href="https://github.com/mebigfatguy/hashshmash">HashShmash</a></li> <li><a href="http://beansource.sf.net">Beansource</a></li> - <li><a href="http://fb-contrib.sf.net">FB-Contrib</a></li> + <li><a href="https://github.com/mebigfatguy/fb-contrib">FB-Contrib</a></li> <li><a href="http://mongobrowser.sf.net">MongoBrowser</a></li> <li><a href="http://mysfstats.sf.net">MySFStats</a></li> <li><a href="http://patchanim.sf.net">PatchAnim</a></li> @@ -12,7 +14,6 @@ <li><a href="http://schemalizer.sf.net">Schemalizer</a></li> <li><a href="http://tomailer.sf.net">ToMailer</a></li> <li><a href="http://jd4a.sf.net">JavaDoc for Android</a></li> - <li><a href="http://damus.sf.net">Damus</a></li> <li><a href="http://www.heartofgoldfarm.com">Heart of Gold Farm</a></li> </ul> </div> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/htdocs/repository.html 2016-04-18 22:19:54 UTC (rev 1791) @@ -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.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>6.6.0</td></tr> + <tr><td><b>Version:</b></td><td>6.6.1</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/pom.xml 2016-04-18 22:19:54 UTC (rev 1791) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>6.6.0</version> + <version>6.6.1</version> <prerequisites> <maven>2.2.1</maven> @@ -140,10 +140,29 @@ <version>3.0.0</version> <scope>provided</scope> </dependency> + <dependency><scope>test</scope><groupId>backport-util-concurrent</groupId><artifactId>backport-util-concurrent</artifactId><version>3.1</version></dependency> + <dependency><scope>test</scope><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>17.0</version></dependency> + <dependency><scope>test</scope><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.6</version></dependency> + <dependency><scope>test</scope><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency> + <dependency><scope>test</scope><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.1</version></dependency> + <dependency><scope>test</scope><groupId>javax.persistence</groupId><artifactId>persistence-api</artifactId><version>1.0.2</version></dependency> + <dependency><scope>test</scope><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version></dependency> + <dependency><scope>test</scope><groupId>javax.servlet.jsp</groupId><artifactId>javax.servlet.jsp-api</artifactId><version>2.3.1</version></dependency> + <dependency><scope>test</scope><groupId>javax.ws.rs</groupId><artifactId>jsr311-api</artifactId><version>1.1.1</version></dependency> + <dependency><scope>test</scope><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency> + <dependency><scope>test</scope><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency> + <dependency><scope>test</scope><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.3</version></dependency> + <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.3.4</version></dependency> + <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpcore</artifactId><version>4.3.2</version></dependency> + <dependency><scope>test</scope><groupId>org.mockito</groupId><artifactId>mockito-all</artifactId><version>1.10.19</version></dependency> + <dependency><scope>test</scope><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.7</version></dependency> + <dependency><scope>test</scope><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>4.2.4.RELEASE</version></dependency> + <dependency><scope>test</scope><groupId>org.testng</groupId><artifactId>testng</artifactId><version>6.9.10</version></dependency> </dependencies> <build> <sourceDirectory>${basedir}/src</sourceDirectory> + <testSourceDirectory>${basedir}/samples</testSourceDirectory> <outputDirectory>${basedir}/target/classes/main</outputDirectory> <resources> <resource> @@ -221,6 +240,9 @@ <configuration> <excludeFilterFile>etc/findbugs-exclude.xml</excludeFilterFile> <effort>Max</effort> + <plugins> + <plugin><groupId>com.mebigfatguy.fb-contrib</groupId><artifactId>fb-contrib</artifactId><version>${project.version}</version></plugin> + </plugins> </configuration> <executions> <execution> Modified: trunk/fb-contrib/samples/BAS_Sample.java =================================================================== --- trunk/fb-contrib/samples/BAS_Sample.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/samples/BAS_Sample.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -123,7 +123,17 @@ System.out.println(h); } } + + public void tstFPRefChangeThruMethodChain(Holder h1, Holder h2, boolean b) { + String h = h1.toString().trim(); + h1 = h2; + + if (b) { + System.out.println(h); + } + } + public void testFPSrcOverwrite(int src, boolean b) { int d = src; src = 0; Modified: trunk/fb-contrib/samples/CD_Sample.java =================================================================== --- trunk/fb-contrib/samples/CD_Sample.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/samples/CD_Sample.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -61,3 +61,21 @@ return data; } } + +class GitHubIssue101 { + protected void onCreate(final String savedInstanceState) { + final Intent intent = new Intent(ChildWithUsedClassObj.class); + startActivity(intent); + } + + private void startActivity(Intent i) { + } +} + +class ChildWithUsedClassObj extends GitHubIssue101 { +} + +class Intent { + Intent(Class c) { + } +} Modified: trunk/fb-contrib/samples/IMC_Sample.java =================================================================== --- trunk/fb-contrib/samples/IMC_Sample.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/samples/IMC_Sample.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -1,3 +1,7 @@ +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -21,6 +25,14 @@ @SuperSecret private String dontReportMe; } + + public void psf(File f) { + try (InputStream is = new FileInputStream(f)) { + is.read(); + } catch (IOException e) { + e.printStackTrace(); + } + } } class IMCFPHasAToString { Modified: trunk/fb-contrib/samples/UTAO_Sample.java =================================================================== --- trunk/fb-contrib/samples/UTAO_Sample.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/samples/UTAO_Sample.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -1,6 +1,7 @@ import org.junit.Assert; import org.junit.Test; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import junit.framework.TestCase; @@ -103,7 +104,7 @@ } class TestNG { - @org.testng.annotations.Test + @org.testng.annotations.Test(enabled = false) public void nada() { } @@ -178,7 +179,7 @@ org.testng.Assert.assertEquals(boo, 20, 0); } - @org.testng.annotations.Test(expectedExceptions = RuntimeException.class) + @org.testng.annotations.Test(expectedExceptions = RuntimeException.class, enabled = false) public void fpNoAssertsWithNGExpects() { throw new RuntimeException(); } @@ -197,9 +198,55 @@ realObject = new Object(); } - @org.testng.annotations.Test + @org.testng.annotations.Test(enabled = false) public void fpShouldNotEqualMockObject() { org.testng.Assert.assertNotEquals(realObject, mockObject); } } + +class GitHubIssue109 { + private static final String UUID = "some uuid"; + + @Mock + private Repo repository; + @Mock + private Object domainObject; + + @org.testng.annotations.Test + public void shouldReturnDomainObjectForUuid() throws Exception { + MockitoAnnotations.initMocks(this); + + StrutsAction action = new StrutsAction(repository); + Mockito.when(repository.findByUuid(UUID)).thenReturn(domainObject); + + action.setUuid(UUID); + org.testng.Assert.assertEquals(action.execute(), Action.SUCCESS); + // this assertion triggers the detector + Assert.assertEquals(action.getDomainObject(), domainObject); + } + + enum Action { + SUCCESS, FAILURE + }; + + class StrutsAction { + public StrutsAction(Object repo) { + } + + public Object execute() { + return null; + } + + public Object getDomainObject() { + return null; + } + + void setUuid(String uuid) { + } + } + + interface Repo { + Object findByUuid(String uuid); + } +} Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2016 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 @@ -36,8 +36,7 @@ import edu.umd.cs.findbugs.ba.ClassContext; /** - * collects methods that return a collection that could be created thru an - * immutable method such as Arrays.aslist, etc. + * collects methods that return a collection that could be created thru an immutable method such as Arrays.aslist, etc. */ @CustomUserValue public class CollectMethodsReturningImmutableCollections extends BytecodeScanningDetector implements NonReportingDetector { @@ -70,7 +69,7 @@ /** * constructs a CMRIC detector given the reporter to report bugs on - * + * * @param reporter * the sync of bug reports */ @@ -90,9 +89,8 @@ } /** - * overrides the visitor to reset the stack for the new method, then checks - * if the immutability field is set to immutable and if so reports it - * + * overrides the visitor to reset the stack for the new method, then checks if the immutability field is set to immutable and if so reports it + * * @param obj * the context object of the currently parsed method */ @@ -116,9 +114,8 @@ } /** - * overrides the visitor to look for calls to static methods that are known - * to return immutable collections It records those variables, and documents - * if what the method returns is one of those objects. + * overrides the visitor to look for calls to static methods that are known to return immutable collections It records those variables, and documents if + * what the method returns is one of those objects. */ @Override public void sawOpcode(int seen) { @@ -127,83 +124,87 @@ stack.precomputation(this); switch (seen) { - case INVOKESTATIC: { - String className = getClassConstantOperand(); - String methodName = getNameConstantOperand(); + case INVOKESTATIC: { + String className = getClassConstantOperand(); + String methodName = getNameConstantOperand(); - if (IMMUTABLE_PRODUCING_METHODS.contains(className + '.' + methodName)) { - seenImmutable = ImmutabilityType.IMMUTABLE; + if (IMMUTABLE_PRODUCING_METHODS.contains(className + '.' + methodName)) { + seenImmutable = ImmutabilityType.IMMUTABLE; + break; + } + } + //$FALL-THROUGH$ + case INVOKEINTERFACE: + case INVOKESPECIAL: + case INVOKEVIRTUAL: { + String className = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + String signature = getSigConstantOperand(); + + MethodInfo mi = Statistics.getStatistics().getMethodStatistics(className, methodName, signature); + seenImmutable = mi.getImmutabilityType(); + if (seenImmutable == ImmutabilityType.UNKNOWN) { + seenImmutable = null; + } + } + break; + + case ARETURN: { + processARreturn(); break; } + default: + break; } - //$FALL-THROUGH$ - case INVOKEINTERFACE: - case INVOKESPECIAL: - case INVOKEVIRTUAL: { - String className = getClassConstantOperand(); - String methodName = getNameConstantOperand(); - String signature = getSigConstantOperand(); - MethodInfo mi = Statistics.getStatistics().getMethodStatistics(className, methodName, signature); - seenImmutable = mi.getImmutabilityType(); - if (seenImmutable == ImmutabilityType.UNKNOWN) - seenImmutable = null; + } finally { + stack.sawOpcode(this, seen); + if ((seenImmutable != null) && (stack.getStackDepth() > 0)) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(seenImmutable); } - break; + } + } - case ARETURN: { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - ImmutabilityType type = (ImmutabilityType) item.getUserValue(); - if (type == null) - type = ImmutabilityType.UNKNOWN; + private void processARreturn() { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + ImmutabilityType type = (ImmutabilityType) item.getUserValue(); + if (type == null) { + type = ImmutabilityType.UNKNOWN; + } - switch (imType) { - case UNKNOWN: + switch (imType) { + case UNKNOWN: - switch (type) { + switch (type) { case IMMUTABLE: imType = ImmutabilityType.IMMUTABLE; - break; + break; case POSSIBLY_IMMUTABLE: imType = ImmutabilityType.POSSIBLY_IMMUTABLE; - break; + break; default: imType = ImmutabilityType.MUTABLE; - break; - } break; + } + break; - case IMMUTABLE: - if (type != ImmutabilityType.IMMUTABLE) { - imType = ImmutabilityType.POSSIBLY_IMMUTABLE; - } - break; + case IMMUTABLE: + if (type != ImmutabilityType.IMMUTABLE) { + imType = ImmutabilityType.POSSIBLY_IMMUTABLE; + } + break; - case POSSIBLY_IMMUTABLE: - break; + case POSSIBLY_IMMUTABLE: + break; - case MUTABLE: - if (type == ImmutabilityType.IMMUTABLE) { - imType = ImmutabilityType.POSSIBLY_IMMUTABLE; - } - break; + case MUTABLE: + if (type == ImmutabilityType.IMMUTABLE) { + imType = ImmutabilityType.POSSIBLY_IMMUTABLE; } - } break; } - default: - break; - } - - } finally { - stack.sawOpcode(this, seen); - if (seenImmutable != null) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - item.setUserValue(seenImmutable); - } - } } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -36,11 +36,11 @@ public class CollectStatistics extends BytecodeScanningDetector implements NonReportingDetector { private static final Set<String> COMMON_METHOD_SIGS = UnmodifiableSet.create( //@formatter:off - "\\<init\\>\\(\\)V", - "toString\\(\\)Ljava/lang/String;", - "hashCode\\(\\)I", - "clone\\(\\).*", - "values\\(\\).*", + "\\<init\\>\\(\\)V", + "toString\\(\\)Ljava/lang/String;", + "hashCode\\(\\)I", + "clone\\(\\).*", + "values\\(\\).*", "main\\(\\[Ljava/lang/String;\\)V" //@formatter:on ); @@ -56,7 +56,7 @@ public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); AnnotationEntry[] annotations = cls.getAnnotationEntries(); - classHasAnnotation = (annotations != null) && (annotations.length > 0); + classHasAnnotation = annotations != null && annotations.length > 0; super.visitClassContext(classContext); } @@ -73,7 +73,7 @@ int accessFlags = method.getAccessFlags(); MethodInfo mi = Statistics.getStatistics().addMethodStatistics(clsName, getMethodName(), getMethodSig(), accessFlags, obj.getLength(), numMethodCalls); - if (clsName.contains("$") || ((accessFlags & (ACC_ABSTRACT | ACC_INTERFACE | ACC_ANNOTATION)) != 0)) { + if (clsName.contains("$") || (accessFlags & (ACC_ABSTRACT | ACC_INTERFACE | ACC_ANNOTATION)) != 0) { mi.addCallingAccess(Constants.ACC_PUBLIC); } else if ((accessFlags & Constants.ACC_PRIVATE) == 0) { if (isAssociationedWithAnnotations(method)) { @@ -111,6 +111,6 @@ } AnnotationEntry[] annotations = m.getAnnotationEntries(); - return (annotations != null) && (annotations.length > 0); + return annotations != null && annotations.length > 0; } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/Debug.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/Debug.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/Debug.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -33,7 +33,8 @@ static { try { out = new PrintStream( - new BufferedOutputStream(new FileOutputStream(new File(System.getProperty("java.io.tmpdir"), "fb-contrib.txt").getPath(), true)), false, StandardCharsets.UTF_8.name()); + new BufferedOutputStream(new FileOutputStream(new File(System.getProperty("java.io.tmpdir"), "fb-contrib.txt").getPath(), true)), false, + StandardCharsets.UTF_8.name()); out.println("===== fb-contrib console ====="); } catch (IOException e) { throw new RuntimeException(e); @@ -53,17 +54,16 @@ /** * Like println, but will print PC, if it's passed in - * - * e.g. Debug.println(getPC(), "Hello world"); will print [PC:42] Hello - * world - * + * + * e.g. Debug.println(getPC(), "Hello world"); will print [PC:42] Hello world + * * @param pc * the program counter * @param obj * the object to output */ public static void println(int pc, Object obj) { - out.printf("[PC:%d] %s%n", pc, obj); + out.printf("[PC:%d] %s%n", Integer.valueOf(pc), obj); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -43,12 +43,14 @@ private PrintWriter pw = null; public OCSDebugger(@SuppressWarnings("unused") BugReporter bugReporter) { + // no bugs are reported, so not storing the bugReporter } @Override public void visitClassContext(ClassContext classContext) { - if ((OUTPUT_FILE_NAME != null) && (METHOD_DESC != null)) + if (OUTPUT_FILE_NAME != null && METHOD_DESC != null) { super.visitClassContext(classContext); + } } @Override @@ -63,6 +65,7 @@ super.visitCode(obj); } catch (IOException e) { + // ignore } finally { pw.close(); pw = null; @@ -74,6 +77,7 @@ public void sawOpcode(int seen) { stack.precomputation(this); stack.sawOpcode(this, seen); - pw.println(String.format("After executing: %-16s at PC: %-5d Stack Size: %-3d", Constants.OPCODE_NAMES[getOpcode()], getPC(), stack.getStackDepth())); + pw.println(String.format("After executing: %-16s at PC: %-5d Stack Size: %-3d", Constants.OPCODE_NAMES[getOpcode()], Integer.valueOf(getPC()), + Integer.valueOf(stack.getStackDepth()))); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -50,7 +50,7 @@ /** * constructs a AFBR detector given the reporter to report bugs on. - * + * * @param bugReporter * the sync of bug reports */ @@ -98,7 +98,7 @@ CodeException[] exc = obj.getExceptionTable(); if (exc != null) { for (CodeException ce : exc) { - if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) { + if (ce.getCatchType() == 0 && ce.getStartPC() == ce.getHandlerPC()) { fbInfo.add(new FinallyBlockInfo(ce.getStartPC())); } } @@ -146,7 +146,7 @@ } } - if ((seen == ATHROW) && (loadedReg == fbi.exReg)) { + if (seen == ATHROW && loadedReg == fbi.exReg) { fbInfo.remove(0); sawOpcode(seen); return; @@ -155,22 +155,20 @@ else loadedReg = -1; - if (((seen >= IRETURN) && (seen <= RETURN)) || (seen == ATHROW)) { + if (seen >= IRETURN && seen <= RETURN || seen == ATHROW) { bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); fbInfo.remove(0); - } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE) || (seen == INVOKESPECIAL) || (seen == INVOKESTATIC)) { + } else if (seen == INVOKEVIRTUAL || seen == INVOKEINTERFACE || seen == INVOKESPECIAL || seen == INVOKESTATIC) { try { JavaClass cls = Repository.lookupClass(getClassConstantOperand()); Method m = findMethod(cls, getNameConstantOperand(), getSigConstantOperand()); if (m != null) { ExceptionTable et = m.getExceptionTable(); - if ((et != null) && (et.getLength() > 0)) { - if (!catchBlockInFinally(fbi)) { - bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), LOW_PRIORITY).addClass(this) - .addMethod(this).addSourceLine(this)); - fbInfo.remove(0); - } + if (et != null && et.getLength() > 0 && !catchBlockInFinally(fbi)) { + bugReporter.reportBug(new BugInstance(this, BugType.AFBR_ABNORMAL_FINALLY_BLOCK_RETURN.name(), LOW_PRIORITY).addClass(this) + .addMethod(this).addSourceLine(this)); + fbInfo.remove(0); } } } catch (ClassNotFoundException cnfe) { @@ -216,15 +214,16 @@ private boolean catchBlockInFinally(FinallyBlockInfo fBlockInfo) { CodeException[] catchExceptions = getCode().getExceptionTable(); - if ((catchExceptions == null) || (catchExceptions.length == 0)) + if (catchExceptions == null || catchExceptions.length == 0) { return false; + } int pc = getPC(); for (CodeException ex : catchExceptions) { - if ((ex.getStartPC() <= pc) && (ex.getEndPC() >= pc)) { - if (ex.getStartPC() >= fBlockInfo.startPC) { - return true; - } + if (ex.getStartPC() <= pc + && ex.getEndPC() >= pc + && ex.getStartPC() >= fBlockInfo.startPC) { + return true; } } @@ -256,4 +255,4 @@ return ToString.build(this); } } -} \ No newline at end of file +} Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2016 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 @@ -63,7 +63,7 @@ /** * constructs a ACEM detector given the reporter to report bugs on - * + * * @param bugReporter * the sync of bug reports */ @@ -73,7 +73,7 @@ /** * overrides the visitor to check for abstract classes. - * + * * @param classContext * the context object that holds the JavaClass being parsed */ @@ -84,7 +84,7 @@ if (cls.isAbstract()) { interfaceMethods = collectInterfaceMethods(cls); super.visitClassContext(classContext); - } + } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { @@ -94,7 +94,7 @@ /** * overrides the visitor to grab the method name and reset the state. - * + * * @param obj * the method being parsed */ @@ -106,7 +106,7 @@ /** * overrides the visitor to filter out constructors. - * + * * @param obj * the code to parse */ @@ -114,7 +114,7 @@ public void visitCode(Code obj) { if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) return; - + if (!interfaceMethods.contains(new QMethod(methodName, getMethod().getSignature()))) { super.visitCode(obj); } @@ -123,7 +123,7 @@ /** * overrides the visitor to look for empty methods or simple exception * throwers. - * + * * @param seen * the opcode currently being parsed */ @@ -139,7 +139,7 @@ } else if (seen == NEW) { String newClass = getClassConstantOperand(); JavaClass exCls = Repository.lookupClass(newClass); - if ((EXCEPTION_CLASS != null) && exCls.instanceOf(EXCEPTION_CLASS)) + if (EXCEPTION_CLASS != null && exCls.instanceOf(EXCEPTION_CLASS)) state = State.SAW_NEW; else state = State.SAW_DONE; @@ -155,14 +155,14 @@ break; case SAW_DUP: - if (((seen == LDC) || (seen == LDC_W)) && (getConstantRefOperand() instanceof ConstantString)) + if ((seen == LDC || seen == LDC_W) && getConstantRefOperand() instanceof ConstantString) state = State.SAW_LDC; else state = State.SAW_DONE; break; case SAW_LDC: - if ((seen == INVOKESPECIAL) && Values.CONSTRUCTOR.equals(getNameConstantOperand())) + if (seen == INVOKESPECIAL && Values.CONSTRUCTOR.equals(getNameConstantOperand())) state = State.SAW_INVOKESPECIAL; else state = State.SAW_DONE; @@ -184,7 +184,7 @@ state = State.SAW_DONE; } } - + private Set<QMethod> collectInterfaceMethods(JavaClass cls) throws ClassNotFoundException { Set<QMethod> methods = new HashSet<QMethod>(); for (JavaClass inf : cls.getAllInterfaces()) { @@ -192,7 +192,7 @@ methods.add(new QMethod(m.getName(), m.getSignature())); } } - + return methods; } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2016-01-25 22:44:19 UTC (rev 1790) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2016-04-18 22:19:54 UTC (rev 1791) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2016 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 @@ -34,10 +34,8 @@ import edu.umd.cs.findbugs.ba.ClassContext; /** - * looks for methods that use arrays for items in the keyset of a map, or as an - * element of a set, or in a list when using the contains method. Since arrays - * do not, and cannot define an equals method, reference equality is used for - * these collections, which is probably not desired. + * looks for methods that use arrays for items in the keyset of a map, or as an element of a set, or in a list when using the contains method. Since arrays do + * not, and cannot define an equals method, reference equality is used for these collections, which is probably not desired. */ public class ArrayBasedCollections extends BytecodeScanningDetector { private BugReporter bugReporter; @@ -49,7 +47,7 @@ /** * constructs a ABC detector given the reporter to report bugs on - * + * * @param bugReporter * the sync of bug reports */ @@ -59,7 +57,7 @@ /** * implement the visitor to report bugs if no Tree comparators were found - * + * * @param classContext * the context object for the class currently being parsed */ @@ -92,7 +90,7 @@ /** * implements the visitor to reset the stack of opcodes - * + * * @param obj * the context object for the currently parsed code block */ @@ -103,9 +101,8 @@ } /** - * implements the visitor to find accesses to maps, sets and lists using - * arrays - * + * implements the visitor to find accesses to maps, sets and lists using arrays + * * @param seen * the currently visitor opcode */ @@ -115,68 +112,78 @@ stack.precomputation(this); if (seen == INVOKEINTERFACE) { - String className = getClassConstantOperand(); - String methodName = getNameConstantOperand(); - String methodSig = getSigConstantOperand(); - boolean found = false; - List<BugInstance> bugList = null; + processInvokeInterface(); - if ("java/util/Map".equals(className) && "put".equals(methodName) - && "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;".equals(methodSig)) { - if (stack.getStackDepth() > 1) { - OpcodeStack.Item itm = stack.getStackItem(1); - String pushedSig = itm.getSignature(); - if ((pushedSig.length() > 0) && (pushedSig.charAt(0) == '[')) { - bugList = mapBugs; - found = true; - } - } - } else if ("java/util/Set".equals(className) && "add".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item itm = stack.getStackItem(0); - String pushedSig = itm.getSignature(); - if (pushedSig.charAt(0) == '[') { - bugList = setBugs; - found = true; - } - } - } else if ("java/util/List".equals(className) && "contains".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item itm = stack.getStackItem(0); - String pushedSig = itm.getSignature(); - if (pushedSig.charAt(0) == '[') - found = true; - } - } + } else if (seen == INVOKESPECIAL) { + processInvokeSpecial(); + } + } finally { + stack.sawOpcode(this, seen); + } + } - if (found) { - BugInstance bi = new BugInstance(this, BugType.ABC_ARRAY_BASED_COLLECTIONS.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) - .addSourceLine(this); - if (bugList != null) - bugList.add(bi); - else - bugReporter.reportBug(bi); + private void processInvokeInterface() { + String className = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + String methodSig = getSigConstantOperand(); + boolean found = false; + List<BugInstance> bugList = null; + + if ("java/util/Map".equals(className) && "put".equals(methodName) && "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;".equals(methodSig)) { + if (stack.getStackDepth() > 1) { + OpcodeStack.Item itm = stack.getStackItem(1); + String pushedSig = itm.getSignature(); + if ((pushedSig.length() > 0) && (pushedSig.charAt(0) == '[')) { + bugList = mapBugs; + found = true; } + } + } else if ("java/util/Set".equals(className) && "add".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig)) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item itm = stack.getStackItem(0); + String pushedSig = itm.getSignature(); + if (pushedSig.charAt(0) == '[') { + bugList = setBugs; + found = true; + } + } + } else if ("java/util/List".equals(className) && "contains".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig) + && (stack.getStackDepth() > 0)) { + OpcodeStack.Item itm = stack.getStackItem(0); + String pushedSig = itm.getSignature(); + if (pushedSig.charAt(0) == '[') { + found = true; + } + } - } else if (seen == INVOKESPECIAL) { - String className = getClassConstantOperand(); - String methodName = getNameConstantOperand(); - String sig = getSigConstantOperand(); + if (found) { + BugInstance bi = new BugInstance(this, BugType.ABC_ARRAY_BASED_COLLECTIONS.name(), N... [truncated message content] |