fb-contrib-commit Mailing List for fb-contrib (Page 6)
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...> - 2012-07-04 23:24:34
|
Revision: 1715 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1715&view=rev Author: dbrosius Date: 2012-07-04 23:24:26 +0000 (Wed, 04 Jul 2012) Log Message: ----------- update from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/samples/PCAIL_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2012-02-03 23:16:26 UTC (rev 1714) +++ trunk/fb-contrib/.classpath 2012-07-04 23:24:26 UTC (rev 1715) @@ -5,15 +5,23 @@ <classpathentry excluding="lib/" kind="src" path="samples"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="lib" path="lib/annotations-2.0.0.jar"/> - <classpathentry kind="lib" path="lib/asm-tree-3.3.1.jar"/> - <classpathentry kind="lib" path="lib/bcel-2.0.0.jar"/> - <classpathentry kind="lib" path="lib/findbugs-2.0.0.jar" sourcepath="findbugs-2.0.0-source.zip"/> - <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/> <classpathentry kind="lib" path="samples/lib/jsp-api-2.2.1.jar"/> <classpathentry kind="lib" path="samples/lib/junit-4.10.jar"/> <classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/> <classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/> - <classpathentry kind="lib" path="samples/lib/backport-util-concurrent-3.1.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-3.3.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-analysis-3.3.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-commons-3.3.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-tree-3.3.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-util-3.3.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/bcel.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/dom4j-1.6.1.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/findbugs.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jaxen-1.1.1.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jFormatString.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jsr305.jar"/> + <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/> + <classpathentry kind="lib" path="samples/lib/backport-concurrent-3.1.jar"/> + <classpathentry kind="lib" path="samples/lib/commons-collection-${commons-collection.version}.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-02-03 23:16:26 UTC (rev 1714) +++ trunk/fb-contrib/build.xml 2012-07-04 23:24:26 UTC (rev 1715) @@ -1,294 +1,224 @@ -<!-- - fb-contrib Ant build script. - Dave Brosius ---> +<!-- fb-contrib Ant build script. Dave Brosius --> <project name="fb-contrib" default="install"> - <property file="build.properties"/> + <property file="build.properties" /> - <property name="src.dir" value="${basedir}/src"/> - <property name="classes.dir" value="${basedir}/classes"/> - <property name="lib.dir" value="${basedir}/lib"/> - <property name="etc.dir" value="${basedir}/etc"/> - <property name="samples.dir" value="${basedir}/samples"/> - <property name="sampleslib.dir" value="${samples.dir}/lib"/> - <property name="javadoc.dir" value="${basedir}/javadoc"/> - <property name="htdocs.dir" value="${basedir}/htdocs"/> - <property name="javac.source" value="1.5"/> - <property name="javac.target" value="1.5"/> - <property name="javac.deprecation" value="on"/> - <property name="javac.debug" value="on"/> + <property name="src.dir" value="${basedir}/src" /> + <property name="classes.dir" value="${basedir}/classes" /> + <property name="lib.dir" value="${basedir}/lib" /> + <property name="etc.dir" value="${basedir}/etc" /> + <property name="samples.dir" value="${basedir}/samples" /> + <property name="sampleslib.dir" value="${samples.dir}/lib" /> + <property name="javadoc.dir" value="${basedir}/javadoc" /> + <property name="htdocs.dir" value="${basedir}/htdocs" /> + <property name="javac.source" value="1.5" /> + <property name="javac.target" value="1.5" /> + <property name="javac.deprecation" value="on" /> + <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.7.0"/> - - <property name="findbugs.version" value="2.0.0"/> - <property name="findbugs-bcel.version" value="2.0.0"/> - <property name="annotations.version" value="2.0.0"/> - <property name="asm-tree.version" value="3.3.1"/> - - <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar"/> - <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar"/> - <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar"/> - <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar"/> + <property name="fb-contrib.version" value="4.7.0" /> - <!-- properties for samples lib dependencies --> - <property name="commons-lang3.version" value="3.1"/> - <property name="jsp-api.version" value="2.2.1" /> - <property name="junit.version" value="4.10" /> - <property name="log4j.version" value="1.2.16" /> - <property name="servlet-api.version" value="3.0.1" /> + <property name="findbugs.version" value="2.0.0" /> + <property name="findbugs-bcel.version" value="2.0.0" /> + <property name="annotations.version" value="2.0.0" /> + <property name="asm-tree.version" value="3.3.1" /> + + <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar" /> + <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar" /> + <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar" /> + <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar" /> + + <!-- properties for samples lib dependencies --> + <property name="commons-lang3.version" value="3.1" /> + <property name="jsp-api.version" value="2.2.1" /> + <property name="junit.version" value="4.10" /> + <property name="log4j.version" value="1.2.16" /> + <property name="servlet-api.version" value="3.0.1" /> <property name="backport-concurrent.version" value="3.1" /> + <property name="commons-collections.version" value="3.2.1" /> - <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar"/> - <property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" /> - <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/> - <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"/> - <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar"/> - <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-concurrent.version}/backport-util-concurrent-${backport-concurrent.version}.jar" /> + <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar" /> + <property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" /> + <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" /> + <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" /> + <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" /> + <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-concurrent.version}/backport-util-concurrent-${backport-concurrent.version}.jar" /> + <property name="commons-collection-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" /> + <target name="check"> + <available file="${dest}/${name}-${version}.jar" property="jar-exists" /> + </target> + + <target name="_pull" depends="check" unless="jar-exists"> + <get src="${url}" dest="${dest}/${name}-${version}.jar" verbose="true" ignoreerrors="true" /> + </target> + + <macrodef name="pull"> + <attribute name="url" /> + <attribute name="dest" /> + <attribute name="name" /> + <attribute name="version" /> + + <sequential> + <antcall target="_pull"> + <param name="url" value="@{url}" /> + <param name="dest" value="@{dest}" /> + <param name="name" value="@{name}" /> + <param name="version" value="@{version}" /> + </antcall> + </sequential> + </macrodef> + + <target name="pullall"> + <pull url="${findbugs-url}" dest="${lib.dir}" name="findbugs" version="${findbugs.version}" /> + <pull url="${findbugs-bcel-url}" dest="${lib.dir}" name="findbugs-bcel" version="${findbugs-bcel.version}" /> + <pull url="${annotations-url}" dest="${lib.dir}" name="annotations" version="${annotations.version}" /> + <pull url="${asm-tree-url}" dest="${lib.dir}" name="asm-tree" version="${asm-tree.version}" /> + <pull url="${commons-lang3-url}" dest="${sampleslib.dir}" name="commons-lang3" version="${commons-lang3.version}" /> + <pull url="${jsp-api-url}" dest="${sampleslib.dir}" name="jsp-api" version="${jsp-api.version}" /> + <pull url="${junit-url}" dest="${sampleslib.dir}" name="junit" version="${junit.version}" /> + <pull url="${log4j-url}" dest="${sampleslib.dir}" name="log4j" version="${log4j.version}" /> + <pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" /> + <pull url="${backport-concurrent-url}" dest="${sampleslib.dir}" name="backport-concurrent" version="${backport-concurrent.version}" /> + <pull url="${commons-collection-url}" dest="${sampleslib.dir}" name="commons-collection" version="${commons-collection.version}" /> + </target> + <target name="clean" description="removes all generated collateral"> - <delete dir="${classes.dir}"/> - <delete dir="${javadoc.dir}"/> - <delete file="${htdocs.dir}/bugdescriptions.html"/> - <delete file="${basedir}/fb-contrib-${fb-contrib.version}.jar"/> - <delete file="${basedir}/fb-contrib-src-${fb-contrib.version}.zip"/> + <delete dir="${classes.dir}" /> + <delete dir="${javadoc.dir}" /> + <delete file="${htdocs.dir}/bugdescriptions.html" /> + <delete file="${basedir}/fb-contrib-${fb-contrib.version}.jar" /> + <delete file="${basedir}/fb-contrib-src-${fb-contrib.version}.zip" /> <delete> <fileset dir="${samples.dir}"> - <include name="**/*.class"/> + <include name="**/*.class" /> </fileset> </delete> - <delete dir="${basedir}/plugin"/> + <delete dir="${basedir}/plugin" /> </target> <target name="-init" description="prepares repository for a build"> - <mkdir dir="${lib.dir}"/> - <mkdir dir="${sampleslib.dir}"/> - <mkdir dir="${classes.dir}"/> - <mkdir dir="${javadoc.dir}"/> + <mkdir dir="${lib.dir}" /> + <mkdir dir="${sampleslib.dir}" /> + <mkdir dir="${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.version}.jar"/> - <pathelement location="${lib.dir}/annotations-${annotations.version}.jar"/> - <pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar"/> + <pathelement location="${lib.dir}/findbugs-${findbugs.version}.jar" /> + <pathelement location="${lib.dir}/bcel-${findbugs-bcel.version}.jar" /> + <pathelement location="${lib.dir}/annotations-${annotations.version}.jar" /> + <pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar" /> </path> <path id="fb-contrib.samples.classpath"> - <pathelement location="${sampleslib.dir}/jsp-api-${jsp-api.version}.jar"/> - <pathelement location="${sampleslib.dir}/junit-${junit.version}.jar"/> - <pathelement location="${sampleslib.dir}/servlet-api-${servlet-api.version}.jar"/> - <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar"/> - <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar"/> - <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar"/> - <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-concurrent.version}.jar"/> + <pathelement location="${sampleslib.dir}/jsp-api-${jsp-api.version}.jar" /> + <pathelement location="${sampleslib.dir}/junit-${junit.version}.jar" /> + <pathelement location="${sampleslib.dir}/servlet-api-${servlet-api.version}.jar" /> + <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" /> + <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> + <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> + <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-concurrent.version}.jar" /> </path> - <mkdir dir="${classes.dir}/com"/> - <mkdir dir="${classes.dir}/com/mebigfatguy"/> - <mkdir dir="${classes.dir}/com/mebigfatguy/fbcontrib"/> - <mkdir dir="${classes.dir}/com/mebigfatguy/fbcontrib/detect"/> - <echo message="*.class" file="${classes.dir}/com/mebigfatguy/fbcontrib/detect/.cvsignore"/> + <mkdir dir="${classes.dir}/com" /> + <mkdir dir="${classes.dir}/com/mebigfatguy" /> + <mkdir dir="${classes.dir}/com/mebigfatguy/fbcontrib" /> + <mkdir dir="${classes.dir}/com/mebigfatguy/fbcontrib/detect" /> + <echo message="*.class" file="${classes.dir}/com/mebigfatguy/fbcontrib/detect/.cvsignore" /> </target> - - <target name="findbugs-check"> - <available file="${basedir}/lib/findbugs-${findbugs.version}.jar" property="findbugs-exists"/> - </target> - <target name="findbugs-bcel-check"> - <available file="${basedir}/lib/bcel-${findbugs-bcel.version}.jar" property="findbugs-bcel-exists"/> - </target> - - <target name="annotations-check"> - <available file="${basedir}/lib/annotations-${annotations.version}.jar" property="annotations-exists"/> - </target> - - <target name="asm-tree-check"> - <available file="${basedir}/lib/asm-tree-${asm-tree.version}.jar" property="asm-tree-exists"/> - </target> - - <target name="commons-lang3-check"> - <available file="${basedir}/samples/lib/commons-lang3-${commons-lang3.version}.jar" property="commons-lang3-exists"/> - </target> - - <target name="servlet-api-check"> - <available file="${basedir}/samples/lib/servlet-api-${servlet-api.version}.jar" property="servlet-api-exists"/> - </target> - - <target name="backport-concurrent-check"> - <available file="${basedir}/samples/lib/backport-util-concurrent-${backport-concurrent.version}.jar" property="backport-concurrent-exists" /> - </target> - - <target name="jsp-api-check"> - <available file="${basedir}/samples/lib/jsp-api-${jsp-api.version}.jar" property="jsp-api-exists"/> - </target> - - <target name="log4j-check"> - <available file="${basedir}/samples/lib/log4j-${log4j.version}.jar" property="log4j-exists"/> - </target> - - <target name="junit-check"> - <available file="${basedir}/samples/lib/junit-${junit.version}.jar" property="junit-exists"/> - </target> - - <target name="install-findbugs" depends="findbugs-check" unless="findbugs-exists" description="installs findbugs.jar into lib"> - <get src="${findbugs-url}" dest="${basedir}/lib/findbugs-${findbugs.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-findbugs-bcel" depends="findbugs-bcel-check" unless="findbugs-bcel-exists" description="installs findbugs-bcel.jar into lib"> - <get src="${findbugs-bcel-url}" dest="${basedir}/lib/bcel-${findbugs-bcel.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-annotations" depends="annotations-check" unless="annotations-exists" description="installs annotations.jar into lib"> - <get src="${annotations-url}" dest="${basedir}/lib/annotations-${annotations.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-asm-tree" depends="asm-tree-check" unless="asm-tree-exists" description="installs asm-tree.jar into lib"> - <get src="${asm-tree-url}" dest="${basedir}/lib/asm-tree-${asm-tree.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-commons-lang3" depends="commons-lang3-check" unless="commons-lang3-exists" description="installs commons-lang3 into samples/lib"> - <get src="${commons-lang3-url}" dest="${basedir}/samples/lib/commons-lang3-${commons-lang3.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-servlet-api" depends="servlet-api-check" unless="servlet-api-exists" description="installs servlet-api into samples/lib"> - <get src="${servlet-api-url}" dest="${basedir}/samples/lib/servlet-api-${servlet-api.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-backport-concurrent" depends="backport-concurrent-check" unless="backport-concurrent-exists" description="installs backport-concurrent into samples/lib"> - <get src="${backport-concurrent-url}" dest="${basedir}/samples/lib/backport-util-concurrent-${backport-concurrent.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-jsp-api" depends="jsp-api-check" unless="jsp-api-exists" description="installs jsp-api into samples/lib"> - <get src="${jsp-api-url}" dest="${basedir}/samples/lib/jsp-api-${jsp-api.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-log4j" depends="log4j-check" unless="log4j-exists" description="installs log4j into samples/lib"> - <get src="${log4j-url}" dest="${basedir}/samples/lib/log4j-${log4j.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="install-junit" depends="junit-check" unless="junit-exists" description="installs junit into samples/lib"> - <get src="${junit-url}" dest="${basedir}/samples/lib/junit-${junit.version}.jar" verbose="true" ignoreerrors="true"/> - </target> - - <target name="pull" depends="install-findbugs, install-findbugs-bcel, install-annotations, install-asm-tree, install-commons-lang3, install-servlet-api, install-backport-concurrent, install-jsp-api, install-log4j, install-junit" description="pull 3rdparty jars to the lib directory"/> - <target name="validate_xml" depends="-init" description="validates the xml files"> <xmlvalidate lenient="false" failonerror="yes"> - <attribute name="http://apache.org/xml/features/validation/schema" value="true"/> - <attribute name="http://xml.org/sax/features/namespaces" value="true"/> - <fileset dir="${etc.dir}" includes="*.xml"/> + <attribute name="http://apache.org/xml/features/validation/schema" value="true" /> + <attribute name="http://xml.org/sax/features/namespaces" value="true" /> + <fileset dir="${etc.dir}" includes="*.xml" /> </xmlvalidate> </target> - <target name="compile" depends="-init, pull" description="compiles java files"> - <javac srcdir="${src.dir}" - destdir="${classes.dir}" - source="${javac.source}" - target="${javac.target}" - deprecation="${javac.deprecation}" - debug="${javac.debug}" - includeantruntime="false"> - <classpath refid="fb-contrib.classpath"/> + <target name="compile" depends="-init, pullall" description="compiles java files"> + <javac srcdir="${src.dir}" destdir="${classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false"> + <classpath refid="fb-contrib.classpath" /> </javac> </target> <target name="compile_samples" depends="-init" description="compiles sample problem files"> - <javac srcdir="${samples.dir}" - destdir="${samples.dir}" - source="1.5" - target="1.5" - deprecation="${javac.deprecation}" - debug="${javac.debug}" - includeantruntime="false"> - <classpath refid="fb-contrib.classpath"/> - <classpath refid="fb-contrib.samples.classpath"/> + <javac srcdir="${samples.dir}" destdir="${samples.dir}" source="1.5" target="1.5" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false"> + <classpath refid="fb-contrib.classpath" /> + <classpath refid="fb-contrib.samples.classpath" /> </javac> - <delete file="${samples.dir}/SJVU_Sample.class"/> - <javac srcdir="${samples.dir}" - destdir="${samples.dir}" - source="1.4" - target="1.4" - deprecation="${javac.deprecation}" - debug="${javac.debug}" - includeantruntime="false"> - <include name="SJVU_Sample.java"/> - <classpath refid="fb-contrib.classpath"/> - <classpath refid="fb-contrib.samples.classpath"/> + <delete file="${samples.dir}/SJVU_Sample.class" /> + <javac srcdir="${samples.dir}" destdir="${samples.dir}" source="1.4" target="1.4" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false"> + <include name="SJVU_Sample.java" /> + <classpath refid="fb-contrib.classpath" /> + <classpath refid="fb-contrib.samples.classpath" /> </javac> </target> <target name="jar" depends="compile" description="produces the fb-contrib jar file"> <jar destfile="${basedir}/fb-contrib-${fb-contrib.version}.jar"> <fileset dir="etc"> - <include name="findbugs.xml"/> - <include name="messages*.xml"/> - <include name="bugrank.txt"/> - <include name="*.license"/> + <include name="findbugs.xml" /> + <include name="messages*.xml" /> + <include name="bugrank.txt" /> + <include name="*.license" /> </fileset> <fileset dir="${classes.dir}"> - <include name="**/*.class"/> + <include name="**/*.class" /> </fileset> <fileset dir="${basedir}"> - <include name="plugin.xml"/> - <include name="license.txt"/> + <include name="plugin.xml" /> + <include name="license.txt" /> </fileset> <manifest> - <attribute name="fb-contrib-version" value="${fb-contrib.version}"/> - <attribute name="Main-Class" value="com.mebigfatguy.fbcontrib.FBContrib"/> - <attribute name="Eclipse-RegisterBuddy" value="edu.umd.cs.findbugs.plugin.eclipse"/> - <attribute name="Bundle-ManifestVersion" value="2"/> - <attribute name="Bundle-Name" value="fb-contrib plugin"/> - <attribute name="Bundle-SymbolicName" value="fb-contrib; singleton:=true"/> - <attribute name="Bundle-Version" value="${fb-contrib.version}"/> - <attribute name="Bundle-ClassPath" value="."/> - <attribute name="Bundle-Vendor" value="FB-Contrib Project"/> - <attribute name="Require-Bundle" value="edu.umd.cs.findbugs.plugin.eclipse"/> - <attribute name="Bundle-ActivationPolicy" value="lazy"/> + <attribute name="fb-contrib-version" value="${fb-contrib.version}" /> + <attribute name="Main-Class" value="com.mebigfatguy.fbcontrib.FBContrib" /> + <attribute name="Eclipse-RegisterBuddy" value="edu.umd.cs.findbugs.plugin.eclipse" /> + <attribute name="Bundle-ManifestVersion" value="2" /> + <attribute name="Bundle-Name" value="fb-contrib plugin" /> + <attribute name="Bundle-SymbolicName" value="fb-contrib; singleton:=true" /> + <attribute name="Bundle-Version" value="${fb-contrib.version}" /> + <attribute name="Bundle-ClassPath" value="." /> + <attribute name="Bundle-Vendor" value="FB-Contrib Project" /> + <attribute name="Require-Bundle" value="edu.umd.cs.findbugs.plugin.eclipse" /> + <attribute name="Bundle-ActivationPolicy" value="lazy" /> </manifest> </jar> </target> <target name="html" depends="-init" description="generates dynamic html"> - <xslt basedir="${etc.dir}" - destdir="${htdocs.dir}" - style="${etc.dir}/bugdescriptions.xsl" - in="${etc.dir}/messages.xml" out="${htdocs.dir}/bugdescriptions.html"/> + <xslt basedir="${etc.dir}" destdir="${htdocs.dir}" style="${etc.dir}/bugdescriptions.xsl" in="${etc.dir}/messages.xml" out="${htdocs.dir}/bugdescriptions.html" /> </target> <target name="srczip" description="builds the source distribution zip file"> <zip destfile="${basedir}/fb-contrib-src-${fb-contrib.version}.zip" basedir="${basedir}"> <fileset dir="${src.dir}"> - <include name="**/*.java"/> - <include name="**/*.xml"/> - <include name="**/*.xsd"/> - <include name="**/*.license"/> - <include name="**/*.txt"/> - <include name="lib/*.jar"/> + <include name="**/*.java" /> + <include name="**/*.xml" /> + <include name="**/*.xsd" /> + <include name="**/*.license" /> + <include name="**/*.txt" /> + <include name="lib/*.jar" /> </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"> - <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> - <bottom><![CDATA[<i>Copyright © 2005-2012 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> + <javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="fb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api"> + <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> + <bottom><![CDATA[<i>Copyright © 2005-2012 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> </javadoc> </target> <target name="build" depends="clean, -init, validate_xml, compile, compile_samples, jar" description="builds the plugin jar"> </target> - <target name="install" depends="build" description="installs the plugin into FindBugs"> - <property environment="env"/> + <target name="install" depends="build" description="installs the plugin into FindBugs"> + <property environment="env" /> <copy todir="${env.FINDBUGS_HOME}/plugin"> <fileset dir="${basedir}"> - <include name="fb-contrib-${fb-contrib.version}.jar"/> + <include name="fb-contrib-${fb-contrib.version}.jar" /> </fileset> </copy> </target> - <target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release"/> + <target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release" /> </project> Modified: trunk/fb-contrib/samples/PCAIL_Sample.java =================================================================== --- trunk/fb-contrib/samples/PCAIL_Sample.java 2012-02-03 23:16:26 UTC (rev 1714) +++ trunk/fb-contrib/samples/PCAIL_Sample.java 2012-07-04 23:24:26 UTC (rev 1715) @@ -65,6 +65,28 @@ } } + public List<PCAIL_Sample> fpAnonymousMethodParm() + { + List<PCAIL_Sample> col = new ArrayList<PCAIL_Sample>(); + for (int i = 0; i < 10; i++) + { + col.add(new PCAIL_Sample()); + } + + return col; + } + + public List<PCAIL_Sample> fpAnonymousBuilder() + { + List<PCAIL_Sample> col = new ArrayList<PCAIL_Sample>(); + for (int i = 0; i < 10; i++) + { + col.add(new PCAIL_Sample().builder()); + } + + return col; + } + public void fpArrayStore() { PCAIL_Sample[] samples = new PCAIL_Sample[3]; @@ -105,6 +127,11 @@ } } + private PCAIL_Sample builder() + { + return this; + } + static class Foo { public Foo withNumber(int i) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2012-02-03 23:16:26 UTC (rev 1714) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2012-07-04 23:24:26 UTC (rev 1715) @@ -105,7 +105,7 @@ if ((firstBlock.getCatchType() == secondBlock.getCatchType()) && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature()) - && (firstBlock.getMessage().equals(secondBlock.getMessage()) + && ((firstBlock.getMessage().length() > 0) && firstBlock.getMessage().equals(secondBlock.getMessage()) && (firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature()))))) { bugReporter.reportBug(new BugInstance(this, "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY) .addClass(this).addMethod(this) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-02-03 23:16:32
|
Revision: 1714 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1714&view=rev Author: dbrosius Date: 2012-02-03 23:16:26 +0000 (Fri, 03 Feb 2012) Log Message: ----------- update from github Modified Paths: -------------- trunk/fb-contrib/samples/STB_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java Modified: trunk/fb-contrib/samples/STB_Sample.java =================================================================== --- trunk/fb-contrib/samples/STB_Sample.java 2012-02-02 18:31:49 UTC (rev 1713) +++ trunk/fb-contrib/samples/STB_Sample.java 2012-02-03 23:16:26 UTC (rev 1714) @@ -31,7 +31,42 @@ throw new STBException(); } } + + public void fpTestDiffMessages(File f1, File f2) throws STBException { + try { + InputStream is = new FileInputStream(f1); + } catch (IOException ioe) { + throw new STBException("Couldn't open file 1"); + } + try { + InputStream is = new FileInputStream(f2); + } catch (IOException ioe) { + throw new STBException("Couldn't open file 2"); + } + } + + public void fpTestDiffMessagesByAppending(File f1, File f2) throws STBException { + try { + InputStream is = new FileInputStream(f1); + } catch (IOException ioe) { + throw new STBException("Couldn't open file: " + f1); + } + + try { + InputStream is = new FileInputStream(f2); + } catch (IOException ioe) { + throw new STBException("Couldn't open file: " + f2); + } + } + static class STBException extends Exception { + + public STBException() { + } + + public STBException(String message) { + super(message); + } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2012-02-02 18:31:49 UTC (rev 1713) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2012-02-03 23:16:26 UTC (rev 1714) @@ -9,10 +9,13 @@ 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.CodeException; import org.apache.bcel.classfile.ConstantClass; import org.apache.bcel.classfile.ConstantPool; +import org.apache.bcel.classfile.JavaClass; +import org.apache.bcel.generic.Type; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -29,6 +32,15 @@ public class StackedTryBlocks extends BytecodeScanningDetector { + private static JavaClass THROWABLE_CLASS; + + static { + try { + THROWABLE_CLASS = Repository.lookupClass("java.lang.Throwable"); + } catch (ClassNotFoundException cnfe) { + THROWABLE_CLASS = null; + } + } private final BugReporter bugReporter; private List<TryBlock> blocks; private List<TryBlock> inBlocks; @@ -41,8 +53,10 @@ @Override public void visitClassContext(ClassContext classContext) { try { - stack = new OpcodeStack(); - super.visitClassContext(classContext); + if (THROWABLE_CLASS != null) { + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } } finally { stack = null; } @@ -54,8 +68,7 @@ try { XMethod xMethod = getXMethod(); String[] tes = xMethod.getThrownExceptions(); - Set<String> thrownExceptions = new HashSet<String>(Arrays.<String> asList((tes == null) ? new String[0] - : tes)); + Set<String> thrownExceptions = new HashSet<String>(Arrays.<String> asList((tes == null) ? new String[0] : tes)); blocks = new ArrayList<TryBlock>(); inBlocks = new ArrayList<TryBlock>(); @@ -91,7 +104,9 @@ TryBlock secondBlock = blocks.get(i); if ((firstBlock.getCatchType() == secondBlock.getCatchType()) - && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature()))) { + && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature()) + && (firstBlock.getMessage().equals(secondBlock.getMessage()) + && (firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature()))))) { bugReporter.reportBug(new BugInstance(this, "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY) .addClass(this).addMethod(this) .addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC()) @@ -112,6 +127,7 @@ @Override public void sawOpcode(int seen) { + String message = null; try { int pc = getPC(); TryBlock block = findBlockWithStart(pc); @@ -146,16 +162,44 @@ } else if (seen == ATHROW) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); - innerBlock.setThrowSignature(item.getSignature()); + XMethod xm = item.getReturnValueOf(); + if (xm != null) { + innerBlock.setThrowSignature(xm.getSignature()); + } + innerBlock.setExceptionSignature(item.getSignature()); + innerBlock.setMessage((String) item.getUserValue()); } else { inBlocks.remove(inBlocks.size() - 1); innerBlock.setState(TryBlock.State.AFTER); } + } else if ((seen == INVOKESPECIAL) && "<init>".equals(getNameConstantOperand())) { + String cls = getClassConstantOperand(); + JavaClass exCls = Repository.lookupClass(cls); + if (exCls.instanceOf(THROWABLE_CLASS)) { + String signature = getSigConstantOperand(); + Type[] types = Type.getArgumentTypes(signature); + if ((types.length > 0) && "Ljava/lang/String;".equals(types[0].getSignature())) { + if (stack.getStackDepth() >= types.length) { + OpcodeStack.Item item = stack.getStackItem(types.length - 1); + message = (String)item.getConstant(); + if (message == null) { + message = "____UNKNOWN____" + System.currentTimeMillis(); + } + } + } + + } } } } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); } finally { stack.sawOpcode(this, seen); + if ((message != null) && (stack.getStackDepth() > 0)) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(message); + } } } @@ -181,7 +225,9 @@ int handlerPC; int endHandlerPC; BitSet catchTypes; + String exSig; String throwSig; + String message; State state; public TryBlock(CodeException ce) { @@ -228,13 +274,29 @@ endHandlerPC = end; } + public void setExceptionSignature(String sig) { + exSig = sig; + } + public void setThrowSignature(String sig) { throwSig = sig; } + + public void setMessage(String m) { + message = m; + } + public String getExceptionSignature() { + return (exSig == null) ? String.valueOf(System.identityHashCode(this)) : exSig; + } + public String getThrowSignature() { return (throwSig == null) ? String.valueOf(System.identityHashCode(this)) : throwSig; } + + public String getMessage() { + return (message == null) ? String.valueOf(System.identityHashCode(this)) : message; + } public int getStartPC() { return startPC; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-02-02 18:31:55
|
Revision: 1713 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1713&view=rev Author: dbrosius Date: 2012-02-02 18:31:49 +0000 (Thu, 02 Feb 2012) Log Message: ----------- update detector descriptions Modified Paths: -------------- trunk/fb-contrib/htdocs/index.shtml Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2012-02-02 18:30:39 UTC (rev 1712) +++ trunk/fb-contrib/htdocs/index.shtml 2012-02-02 18:31:49 UTC (rev 1713) @@ -104,9 +104,8 @@ method <pre> - new ToStringBuilder(this).toString(); - </pre><br/> - <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span> + new ToStringBuilder(this).toString(); + </pre><span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span> </li> <li><b>[CHTH] CommonsHashcodeBuilderToHashcode</b><br/> Looks for uses for Commons-lang HashCodeBuilder where the result of hashCode() is This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-02-02 18:30:45
|
Revision: 1712 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1712&view=rev Author: dbrosius Date: 2012-02-02 18:30:39 +0000 (Thu, 02 Feb 2012) Log Message: ----------- update detector descriptions Modified Paths: -------------- trunk/fb-contrib/htdocs/index.shtml Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2012-02-02 18:00:41 UTC (rev 1711) +++ trunk/fb-contrib/htdocs/index.shtml 2012-02-02 18:30:39 UTC (rev 1712) @@ -79,7 +79,7 @@ <ul> <li><b>[CVAA] ContraVariant Array Assignment</b><br/> Looks for contravariant array assignments. Since arrays are mutable data structures, their use - must be restricted to covariant or invariant usage. + must be restricted to covariant or invariant usage.<br/> <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li> <li><b>[LGO] Lingering Graphics Object</b><br/> Looks for creation of java.awt.Graphics object that do not have the @@ -91,6 +91,34 @@ same kind of exception, and throw the same exception always. These blocks can be coalesced into one. </li> + <li><b>[CCNE] Compare Class Name Equals</b><br/> + Looks for code that compares to classes by name, rather than by just comparing the + classes with ==<br/> + <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span> + </li> + <li><b>[CSBTS] CommonsStringBuilderToString</b><br/> + Looks for usage of ToStringBuilder from Apache commons, where the code invokes + toString() on the constructed object without invoking append().<br/> + + Usage without invoking append is equivalent of using the Object.toString() + method + + <pre> + new ToStringBuilder(this).toString(); + </pre><br/> + <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span> + </li> + <li><b>[CHTH] CommonsHashcodeBuilderToHashcode</b><br/> + Looks for uses for Commons-lang HashCodeBuilder where the result of hashCode() is + returned instead of calling the method toHashCode().<br/> + <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span> + </li> + <li><b>[BRPI] BackportReusePublicIdentifiers</b><br/> + Looks for use of 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.<br/> + <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span> + </li> </ul> </div> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-02-02 18:00:48
|
Revision: 1711 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1711&view=rev Author: dbrosius Date: 2012-02-02 18:00:41 +0000 (Thu, 02 Feb 2012) Log Message: ----------- update from github - thanks Bhaskar Maddala Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/samples/BRPI_Sample.java trunk/fb-contrib/samples/CCNE_Sample.java trunk/fb-contrib/samples/CSBTS_StringToStringSample.java trunk/fb-contrib/samples/samples.fbp trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2012-01-21 03:02:07 UTC (rev 1710) +++ trunk/fb-contrib/.classpath 2012-02-02 18:00:41 UTC (rev 1711) @@ -2,17 +2,18 @@ <classpath> <classpathentry excluding="**/*.*" kind="src" path="etc"/> <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="samples"/> + <classpathentry excluding="lib/" kind="src" path="samples"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="lib" path="lib/annotations-2.0.0.jar"/> <classpathentry kind="lib" path="lib/asm-tree-3.3.1.jar"/> <classpathentry kind="lib" path="lib/bcel-2.0.0.jar"/> - <classpathentry kind="lib" path="lib/findbugs-2.0.0.jar"/> + <classpathentry kind="lib" path="lib/findbugs-2.0.0.jar" sourcepath="findbugs-2.0.0-source.zip"/> <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/> <classpathentry kind="lib" path="samples/lib/jsp-api-2.2.1.jar"/> <classpathentry kind="lib" path="samples/lib/junit-4.10.jar"/> <classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/> <classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/> + <classpathentry kind="lib" path="samples/lib/backport-util-concurrent-3.1.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-01-21 03:02:07 UTC (rev 1710) +++ trunk/fb-contrib/build.xml 2012-02-02 18:00:41 UTC (rev 1711) @@ -27,23 +27,25 @@ <property name="annotations.version" value="2.0.0"/> <property name="asm-tree.version" value="3.3.1"/> - <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar"/> - <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar"/> - <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar"/> - <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar"/> + <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar"/> + <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar"/> + <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar"/> + <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar"/> - <!-- properties for samples lib dependencies --> - <property name="commons-lang3.version" value="3.1"/> - <property name="jsp-api.version" value="2.2.1" /> - <property name="junit.version" value="4.10" /> - <property name="log4j.version" value="1.2.16" /> - <property name="servlet-api.version" value="3.0.1" /> + <!-- properties for samples lib dependencies --> + <property name="commons-lang3.version" value="3.1"/> + <property name="jsp-api.version" value="2.2.1" /> + <property name="junit.version" value="4.10" /> + <property name="log4j.version" value="1.2.16" /> + <property name="servlet-api.version" value="3.0.1" /> + <property name="backport-concurrent.version" value="3.1" /> - <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar"/> - <property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" /> - <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/> - <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"/> - <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar"/> + <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar"/> + <property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" /> + <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/> + <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"/> + <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar"/> + <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-concurrent.version}/backport-util-concurrent-${backport-concurrent.version}.jar" /> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> @@ -76,6 +78,8 @@ <pathelement location="${sampleslib.dir}/servlet-api-${servlet-api.version}.jar"/> <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar"/> <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar"/> + <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar"/> + <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-concurrent.version}.jar"/> </path> <mkdir dir="${classes.dir}/com"/> <mkdir dir="${classes.dir}/com/mebigfatguy"/> @@ -107,6 +111,10 @@ <target name="servlet-api-check"> <available file="${basedir}/samples/lib/servlet-api-${servlet-api.version}.jar" property="servlet-api-exists"/> </target> + + <target name="backport-concurrent-check"> + <available file="${basedir}/samples/lib/backport-util-concurrent-${backport-concurrent.version}.jar" property="backport-concurrent-exists" /> + </target> <target name="jsp-api-check"> <available file="${basedir}/samples/lib/jsp-api-${jsp-api.version}.jar" property="jsp-api-exists"/> @@ -143,7 +151,11 @@ <target name="install-servlet-api" depends="servlet-api-check" unless="servlet-api-exists" description="installs servlet-api into samples/lib"> <get src="${servlet-api-url}" dest="${basedir}/samples/lib/servlet-api-${servlet-api.version}.jar" verbose="true" ignoreerrors="true"/> </target> - + + <target name="install-backport-concurrent" depends="backport-concurrent-check" unless="backport-concurrent-exists" description="installs backport-concurrent into samples/lib"> + <get src="${backport-concurrent-url}" dest="${basedir}/samples/lib/backport-util-concurrent-${backport-concurrent.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + <target name="install-jsp-api" depends="jsp-api-check" unless="jsp-api-exists" description="installs jsp-api into samples/lib"> <get src="${jsp-api-url}" dest="${basedir}/samples/lib/jsp-api-${jsp-api.version}.jar" verbose="true" ignoreerrors="true"/> </target> @@ -156,7 +168,7 @@ <get src="${junit-url}" dest="${basedir}/samples/lib/junit-${junit.version}.jar" verbose="true" ignoreerrors="true"/> </target> - <target name="pull" depends="install-findbugs, install-findbugs-bcel, install-annotations, install-asm-tree, install-commons-lang3, install-servlet-api, install-jsp-api, install-log4j, install-junit" description="pull 3rdparty jars to the lib directory"/> + <target name="pull" depends="install-findbugs, install-findbugs-bcel, install-annotations, install-asm-tree, install-commons-lang3, install-servlet-api, install-backport-concurrent, install-jsp-api, install-log4j, install-junit" description="pull 3rdparty jars to the lib directory"/> <target name="validate_xml" depends="-init" description="validates the xml files"> <xmlvalidate lenient="false" failonerror="yes"> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-01-21 03:02:07 UTC (rev 1710) +++ trunk/fb-contrib/etc/findbugs.xml 2012-02-02 18:00:41 UTC (rev 1711) @@ -227,6 +227,12 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsStringBuilderToString" speed="fast" reports="CSBTS_COMMONS_STRING_BUILDER_TOSTRING" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CompareClassNameEquals" speed="fast" reports="CCNE_COMPARE_CLASS_EQUALS_NAME" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" /> <!-- BugPattern --> @@ -397,4 +403,7 @@ <BugPattern abbrev="STB" type="STB_STACKED_TRY_BLOCKS" category="STYLE" experimental="true" /> <BugPattern abbrev="CEBE" type="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" category="CORRECTNESS" /> <BugPattern abbrev="CHTH" type="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" category="CORRECTNESS" /> + <BugPattern abbrev="CSBTS" type="CSBTS_COMMONS_STRING_BUILDER_TOSTRING" category="CORRECTNESS" /> + <BugPattern abbrev="CCNE" type="CCNE_COMPARE_CLASS_EQUALS_NAME" category="CORRECTNESS" /> + <BugPattern abbrev="BRPI" type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" category ="PERFORMANCE" /> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2012-01-21 03:02:07 UTC (rev 1710) +++ trunk/fb-contrib/etc/messages.xml 2012-02-02 18:00:41 UTC (rev 1711) @@ -1237,6 +1237,40 @@ </Details> </Detector> + <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>It is a fast detector</p> + ]]> + </Details> + </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CompareClassNameEquals"> + <Details> + <![CDATA[ + <p> In a JVM, Two classes are the same class (and consequently the same type) if + they are loaded by the same class loader, and they have the same fully + qualified name [JVMSpec 1999]. + + Comparing class name ignores the class loader. + </p> + ]]> + </Details> + </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers"> + <Details> + <![CDATA[ + <p> Detects use of 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> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -3380,8 +3414,47 @@ instead of calling the method toHashCode().</p> ]]> </Details> - </BugPattern> + </BugPattern> + <BugPattern type="CSBTS_COMMONS_STRING_BUILDER_TOSTRING"> + <ShortDescription>Method returns the result of invoking toString() without intermediate invocation of append() in ToStringBuilder</ShortDescription> + <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 + intermediate invocation of append()</p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="CCNE_COMPARE_CLASS_EQUALS_NAME"> + <ShortDescription>Method compares class name instead of comparing class</ShortDescription> + <LongDescription>Method {1} compares class name instead of comparing the class</LongDescription> + <Details> + <![CDATA[ + <p> In a JVM, Two classes are the same class (and consequently the same type) if + they are loaded by the same class loader, and they have the same fully + qualified name [JVMSpec 1999]. + + Comparing class name ignores the class loader. + </p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS"> + <ShortDescription>Method uses backport concurrency utils</ShortDescription> + <LongDescription>Method {1} backport concurrency utils</LongDescription> + <Details> + <![CDATA[ + <p> Detects use of 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> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -3485,4 +3558,8 @@ <BugCode abbrev="LGO">Lingering Graphics Object</BugCode> <BugCode abbrev="STB">Stacked Try Blocks</BugCode> <BugCode abbrev="CEBE">Commons EqualsBuilder To Equals</BugCode> + <BugCode abbrev="CHTH">Commons HashCodeBuilder To hashCode</BugCode> + <BugCode abbrev="CSBTS">Commons ToStringBuilder To String</BugCode> + <BugCode abbrev="CCNE">Compare class name equals</BugCode> + <BugCode abbrev="BRPI">Backport concurrent reuse of public identifiers</BugCode> </MessageCollection> Added: trunk/fb-contrib/samples/BRPI_Sample.java =================================================================== --- trunk/fb-contrib/samples/BRPI_Sample.java (rev 0) +++ trunk/fb-contrib/samples/BRPI_Sample.java 2012-02-02 18:00:41 UTC (rev 1711) @@ -0,0 +1,11 @@ +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 static void main(String[] arg) { + Collections.emptySet(); + Executors.newCachedThreadPool(); + new ConcurrentHashMap(); + } +} Property changes on: trunk/fb-contrib/samples/BRPI_Sample.java ___________________________________________________________________ Added: svn-eol-style + native Added: svn:mime-type + text/plain Added: eol-style + native Added: svn:eol-style + native Added: trunk/fb-contrib/samples/CCNE_Sample.java =================================================================== --- trunk/fb-contrib/samples/CCNE_Sample.java (rev 0) +++ trunk/fb-contrib/samples/CCNE_Sample.java 2012-02-02 18:00:41 UTC (rev 1711) @@ -0,0 +1,8 @@ +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())); + } +} Property changes on: trunk/fb-contrib/samples/CCNE_Sample.java ___________________________________________________________________ Added: svn-eol-style + native Added: svn:mime-type + text/plain Added: eol-style + native Added: svn:eol-style + native Added: trunk/fb-contrib/samples/CSBTS_StringToStringSample.java =================================================================== --- trunk/fb-contrib/samples/CSBTS_StringToStringSample.java (rev 0) +++ trunk/fb-contrib/samples/CSBTS_StringToStringSample.java 2012-02-02 18:00:41 UTC (rev 1711) @@ -0,0 +1,59 @@ +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()); + } +} Property changes on: trunk/fb-contrib/samples/CSBTS_StringToStringSample.java ___________________________________________________________________ Added: svn-eol-style + native Added: svn:mime-type + text/plain Added: eol-style + native Added: svn:eol-style + native Added: trunk/fb-contrib/samples/samples.fbp =================================================================== --- trunk/fb-contrib/samples/samples.fbp (rev 0) +++ trunk/fb-contrib/samples/samples.fbp 2012-02-02 18:00:41 UTC (rev 1711) @@ -0,0 +1,12 @@ +<Project projectName=""> + <Jar>.</Jar> + <AuxClasspathEntry>./lib/jsp-api.jar</AuxClasspathEntry> + <AuxClasspathEntry>./lib/junit.jar</AuxClasspathEntry> + <AuxClasspathEntry>./lib/log4j.jar</AuxClasspathEntry> + <AuxClasspathEntry>./lib/servlet-api.jar</AuxClasspathEntry> + <SrcDir>.</SrcDir> + <SuppressionFilter> + <LastVersion value="-1" relOp="NEQ"/> + </SuppressionFilter> + <Cloud id="1"></Cloud> +</Project> Property changes on: trunk/fb-contrib/samples/samples.fbp ___________________________________________________________________ Added: svn-eol-style + native Added: svn:executable + * Added: svn:mime-type + text/plain Added: eol-style + native Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java 2012-02-02 18:00:41 UTC (rev 1711) @@ -0,0 +1,80 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2012 Bhaskar Maddala + * Copyright (C) 2005-2012 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 org.apache.bcel.Constants; +import org.apache.bcel.classfile.JavaClass; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.ba.ClassContext; +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. + */ +public class BackportReusePublicIdentifiers extends OpcodeStackDetector { + + private final BugReporter bugReporter; + + public BackportReusePublicIdentifiers(final BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + @Override + public void visitClassContext(ClassContext classContext) { + JavaClass cls = classContext.getJavaClass(); + if (cls.getMajor() >= Constants.MAJOR_1_5) { + super.visitClassContext(classContext); + } + } + + @Override + public void sawOpcode(int seen) { + switch (seen) { + case INVOKESTATIC: { + String className = getClassConstantOperand(); + if (className.startsWith("edu/emory/mathcs/backport/")) { + reportBug(); + } + } + break; + case INVOKESPECIAL: { + String className = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + if (className.startsWith("edu/emory/mathcs/backport/") + && methodName.equals("<init>")) { + reportBug(); + } + } + break; + } + } + + private void reportBug() { + bugReporter.reportBug(new BugInstance(this, + "BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS", NORMAL_PRIORITY) + .addClass(this).addMethod(this).addSourceLine(this)); + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java ___________________________________________________________________ Added: svn-eol-style + native Added: svn:mime-type + text/plain Added: eol-style + native Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2012-02-02 18:00:41 UTC (rev 1711) @@ -0,0 +1,171 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2012 Bhaskar Maddala + * Copyright (C) 2005-2012 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 java.util.Stack; + +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.LocalVariable; +import org.apache.bcel.classfile.LocalVariableTable; + +import com.mebigfatguy.fbcontrib.utils.RegisterUtils; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.OpcodeStack.Item; +import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; + +/** + * Find usage of ToStringBuilder from Apache commons, where the code invokes + * toString() on the constructed object without invoking append(). + * + * Usage without invoking append is equivalent of using the Object.toString() + * method + * + * <pre> + * new ToStringBuilder(this).toString(); + * </pre> + */ +public class CommonsStringBuilderToString extends OpcodeStackDetector { + + private final BugReporter bugReporter; + private Stack<Pair> stackTracker = new Stack<Pair>(); + private Map<Integer, Boolean> registerTracker = new HashMap<Integer, Boolean>(); + + /** + * constructs a CSBTS detector given the reporter to report bugs on. + * + * @param bugReporter + * the sync of bug reports + */ + public CommonsStringBuilderToString(final BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + @Override + public void visit(Code obj) { + registerTracker.clear(); + stackTracker.clear(); + super.visit(obj); + } + + @Override + public boolean shouldVisitCode(Code obj) { + LocalVariableTable lvt = getMethod().getLocalVariableTable(); + return lvt != null; + } + + @Override + public void sawOpcode(int seen) { + switch (seen) { + case ALOAD: + case ALOAD_0: + case ALOAD_1: + case ALOAD_2: + case ALOAD_3: + LocalVariable lv = getMethod().getLocalVariableTable() + .getLocalVariable(RegisterUtils.getALoadReg(this, seen), + getNextPC()); + if (lv != null) { + String signature = lv.getSignature(); + if (isToStringBuilder(signature)) { + Integer loadReg = Integer.valueOf(getRegisterOperand()); + Boolean appendInvoked = registerTracker.get(loadReg); + if (appendInvoked != null) { + stackTracker.add(new Pair(loadReg.intValue(), + appendInvoked.booleanValue())); + } + } + } + break; + case ASTORE: + case ASTORE_0: + case ASTORE_1: + case ASTORE_2: + case ASTORE_3: + Item si = stack.getStackItem(0); + String signature = si.getSignature(); + if (isToStringBuilder(signature)) { + int storeReg = getRegisterOperand(); + Pair p = stackTracker.pop(); + registerTracker.put( + Integer.valueOf(storeReg), + p.register == -1 ? Boolean.FALSE : registerTracker + .get(Integer.valueOf(p.register))); + } + break; + case POP: + si = stack.getStackItem(0); + signature = si.getSignature(); + if (isToStringBuilder(signature)) { + Pair p = stackTracker.pop(); + registerTracker.put(Integer.valueOf(p.register), + Boolean.valueOf(p.appendInvoked)); + } + break; + case INVOKESPECIAL: + case INVOKEVIRTUAL: + String loadClassName = getClassConstantOperand(); + String calledMethodName = getNameConstantOperand(); + String calledMethodSig = getSigConstantOperand(); + + if ("org/apache/commons/lang3/builder/ToStringBuilder" + .equals(loadClassName) + || "org/apache/commons/lang/builder/ToStringBuilder" + .equals(loadClassName)) { + if ("<init>".equals(calledMethodName) + && "(Ljava/lang/Object;)V".equals(calledMethodSig)) { + stackTracker.add(new Pair(-1, false)); + } else if ("append".equals(calledMethodName)) { + Pair p = stackTracker.pop(); + stackTracker.add(new Pair(p.register, true)); + } else if ("toString".equals(calledMethodName) + && "()Ljava/lang/String;".equals(calledMethodSig)) { + Pair p = stackTracker.pop(); + if (p.appendInvoked == false) { + bugReporter.reportBug(new BugInstance(this, + "CSBTS_COMMONS_STRING_BUILDER_TOSTRING", + HIGH_PRIORITY).addClass(this).addMethod(this) + .addSourceLine(this)); + } + } + } + } + } + + private boolean isToStringBuilder(String signature) { + return "Lorg/apache/commons/lang3/builder/ToStringBuilder;" + .equals(signature) + || "Lorg/apache/commons/lang/builder/ToStringBuilder;" + .equals(signature); + } + + static final class Pair { + public final int register; + public final boolean appendInvoked; + + Pair(int register, boolean appendInvoked) { + this.register = register; + this.appendInvoked = appendInvoked; + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java ___________________________________________________________________ Added: svn-eol-style + native Added: svn:mime-type + text/plain Added: eol-style + native Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-02-02 18:00:41 UTC (rev 1711) @@ -0,0 +1,90 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2012 Bhaskar Maddala + * Copyright (C) 2005-2012 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 org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.LocalVariableTable; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.OpcodeStack.Item; +import edu.umd.cs.findbugs.bcel.OpcodeStackDetector; + +/** + * In a JVM, Two classes are the same class (and consequently the same type) if + * they are loaded by the same class loader, and they have the same fully + * qualified name [JVMSpec 1999]. + * + * Two classes with the same name but different package names are distinct, as + * are two classes with the same fully qualified name loaded by different class + * loaders. + * + * Find usage involving comparison of class names, rather than the class itself. + * + */ +public class CompareClassNameEquals extends OpcodeStackDetector { + private boolean flag = false; + private final BugReporter bugReporter; + + public CompareClassNameEquals(final BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + @Override + public boolean shouldVisitCode(Code obj) { + flag = false; + LocalVariableTable lvt = getMethod().getLocalVariableTable(); + return lvt != null; + } + + @Override + public void afterOpcode(int seen) { + super.afterOpcode(seen); + if (flag == true) { + stack.getStackItem(0).setUserValue(Boolean.TRUE); + flag = false; + } + } + + @Override + public void sawOpcode(int seen) { + switch (seen) { + case INVOKEVIRTUAL: + if ("getName".equals(getNameConstantOperand()) + && "()Ljava/lang/String;".equals(getSigConstantOperand()) + && "java/lang/Class".equals(getClassConstantOperand())) { + flag = true; + } else if ("equals".equals(getNameConstantOperand()) + && "(Ljava/lang/Object;)Z".equals(getSigConstantOperand()) + && "java/lang/String".equals(getClassConstantOperand())) { + Item item = stack.getItemMethodInvokedOn(this); + Object userValue = item.getUserValue(); + if (userValue != null && userValue == Boolean.TRUE) { + bugReporter + .reportBug(new BugInstance(this, + "CCNE_COMPARE_CLASS_EQUALS_NAME", + NORMAL_PRIORITY).addClass(this) + .addMethod(this).addSourceLine(this)); + } + } + break; + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java ___________________________________________________________________ Added: svn-eol-style + native Added: svn:mime-type + text/plain Added: eol-style + native Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-01-21 03:02:15
|
Revision: 1710 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1710&view=rev Author: dbrosius Date: 2012-01-21 03:02:07 +0000 (Sat, 21 Jan 2012) Log Message: ----------- pull in changes 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 Added Paths: ----------- trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2012-01-16 02:50:18 UTC (rev 1709) +++ trunk/fb-contrib/.classpath 2012-01-21 03:02:07 UTC (rev 1710) @@ -1,19 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="samples"/> <classpathentry excluding="**/*.*" kind="src" path="etc"/> <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="samples"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="lib" path="samples/lib/jsp-api.jar"/> - <classpathentry kind="lib" path="samples/lib/junit.jar"/> - <classpathentry kind="lib" path="samples/lib/log4j.jar" sourcepath="/home/dave/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15-sources.jar"/> - <classpathentry kind="lib" path="samples/lib/servlet-api.jar"/> - <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> - <classpathentry kind="lib" path="lib/bcel-2.0.0.jar"/> - <classpathentry kind="lib" path="lib/findbugs-2.0.0.jar"/> - <classpathentry kind="lib" path="lib/jsr305-2.0.0.jar"/> <classpathentry kind="lib" path="lib/annotations-2.0.0.jar"/> <classpathentry kind="lib" path="lib/asm-tree-3.3.1.jar"/> + <classpathentry kind="lib" path="lib/bcel-2.0.0.jar"/> + <classpathentry kind="lib" path="lib/findbugs-2.0.0.jar"/> + <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/> + <classpathentry kind="lib" path="samples/lib/jsp-api-2.2.1.jar"/> + <classpathentry kind="lib" path="samples/lib/junit-4.10.jar"/> + <classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/> + <classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-01-16 02:50:18 UTC (rev 1709) +++ trunk/fb-contrib/build.xml 2012-01-21 03:02:07 UTC (rev 1710) @@ -27,11 +27,24 @@ <property name="annotations.version" value="2.0.0"/> <property name="asm-tree.version" value="3.3.1"/> - <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar"/> - <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar"/> - <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar"/> - <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar"/> + <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar"/> + <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar"/> + <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar"/> + <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar"/> + <!-- properties for samples lib dependencies --> + <property name="commons-lang3.version" value="3.1"/> + <property name="jsp-api.version" value="2.2.1" /> + <property name="junit.version" value="4.10" /> + <property name="log4j.version" value="1.2.16" /> + <property name="servlet-api.version" value="3.0.1" /> + + <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar"/> + <property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" /> + <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar"/> + <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar"/> + <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar"/> + <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> <delete dir="${javadoc.dir}"/> @@ -48,6 +61,7 @@ <target name="-init" description="prepares repository for a build"> <mkdir dir="${lib.dir}"/> + <mkdir dir="${sampleslib.dir}"/> <mkdir dir="${classes.dir}"/> <mkdir dir="${javadoc.dir}"/> <path id="fb-contrib.classpath"> @@ -57,10 +71,11 @@ <pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar"/> </path> <path id="fb-contrib.samples.classpath"> - <pathelement location="${sampleslib.dir}/jsp-api.jar"/> - <pathelement location="${sampleslib.dir}/junit.jar"/> - <pathelement location="${sampleslib.dir}/servlet-api.jar"/> - <pathelement location="${sampleslib.dir}/log4j.jar"/> + <pathelement location="${sampleslib.dir}/jsp-api-${jsp-api.version}.jar"/> + <pathelement location="${sampleslib.dir}/junit-${junit.version}.jar"/> + <pathelement location="${sampleslib.dir}/servlet-api-${servlet-api.version}.jar"/> + <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar"/> + <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar"/> </path> <mkdir dir="${classes.dir}/com"/> <mkdir dir="${classes.dir}/com/mebigfatguy"/> @@ -69,26 +84,46 @@ <echo message="*.class" file="${classes.dir}/com/mebigfatguy/fbcontrib/detect/.cvsignore"/> </target> - <target name="findbugs-check"> + <target name="findbugs-check"> <available file="${basedir}/lib/findbugs-${findbugs.version}.jar" property="findbugs-exists"/> </target> - <target name="findbugs-bcel-check"> + <target name="findbugs-bcel-check"> <available file="${basedir}/lib/bcel-${findbugs-bcel.version}.jar" property="findbugs-bcel-exists"/> </target> - <target name="annotations-check"> + <target name="annotations-check"> <available file="${basedir}/lib/annotations-${annotations.version}.jar" property="annotations-exists"/> </target> - <target name="asm-tree-check"> + <target name="asm-tree-check"> <available file="${basedir}/lib/asm-tree-${asm-tree.version}.jar" property="asm-tree-exists"/> </target> - <target name="install-findbugs" depends="findbugs-check" unless="findbugs-exists" description="installs findbugs.jar into lib"> + <target name="commons-lang3-check"> + <available file="${basedir}/samples/lib/commons-lang3-${commons-lang3.version}.jar" property="commons-lang3-exists"/> + </target> + + <target name="servlet-api-check"> + <available file="${basedir}/samples/lib/servlet-api-${servlet-api.version}.jar" property="servlet-api-exists"/> + </target> + + <target name="jsp-api-check"> + <available file="${basedir}/samples/lib/jsp-api-${jsp-api.version}.jar" property="jsp-api-exists"/> + </target> + + <target name="log4j-check"> + <available file="${basedir}/samples/lib/log4j-${log4j.version}.jar" property="log4j-exists"/> + </target> + + <target name="junit-check"> + <available file="${basedir}/samples/lib/junit-${junit.version}.jar" property="junit-exists"/> + </target> + + <target name="install-findbugs" depends="findbugs-check" unless="findbugs-exists" description="installs findbugs.jar into lib"> <get src="${findbugs-url}" dest="${basedir}/lib/findbugs-${findbugs.version}.jar" verbose="true" ignoreerrors="true"/> </target> - + <target name="install-findbugs-bcel" depends="findbugs-bcel-check" unless="findbugs-bcel-exists" description="installs findbugs-bcel.jar into lib"> <get src="${findbugs-bcel-url}" dest="${basedir}/lib/bcel-${findbugs-bcel.version}.jar" verbose="true" ignoreerrors="true"/> </target> @@ -101,8 +136,28 @@ <get src="${asm-tree-url}" dest="${basedir}/lib/asm-tree-${asm-tree.version}.jar" verbose="true" ignoreerrors="true"/> </target> - <target name="pull" depends="install-findbugs, install-findbugs-bcel, install-annotations, install-asm-tree" description="pull 3rdparty jars to the lib directory"/> + <target name="install-commons-lang3" depends="commons-lang3-check" unless="commons-lang3-exists" description="installs commons-lang3 into samples/lib"> + <get src="${commons-lang3-url}" dest="${basedir}/samples/lib/commons-lang3-${commons-lang3.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + <target name="install-servlet-api" depends="servlet-api-check" unless="servlet-api-exists" description="installs servlet-api into samples/lib"> + <get src="${servlet-api-url}" dest="${basedir}/samples/lib/servlet-api-${servlet-api.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install-jsp-api" depends="jsp-api-check" unless="jsp-api-exists" description="installs jsp-api into samples/lib"> + <get src="${jsp-api-url}" dest="${basedir}/samples/lib/jsp-api-${jsp-api.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install-log4j" depends="log4j-check" unless="log4j-exists" description="installs log4j into samples/lib"> + <get src="${log4j-url}" dest="${basedir}/samples/lib/log4j-${log4j.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install-junit" depends="junit-check" unless="junit-exists" description="installs junit into samples/lib"> + <get src="${junit-url}" dest="${basedir}/samples/lib/junit-${junit.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="pull" depends="install-findbugs, install-findbugs-bcel, install-annotations, install-asm-tree, install-commons-lang3, install-servlet-api, install-jsp-api, install-log4j, install-junit" description="pull 3rdparty jars to the lib directory"/> + <target name="validate_xml" depends="-init" description="validates the xml files"> <xmlvalidate lenient="false" failonerror="yes"> <attribute name="http://apache.org/xml/features/validation/schema" value="true"/> Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2012-01-16 02:50:18 UTC (rev 1709) +++ trunk/fb-contrib/etc/bugrank.txt 2012-01-21 03:02:07 UTC (rev 1710) @@ -125,4 +125,5 @@ 0 BugPattern PDP_POORLY_DEFINED_PARAMETER 0 BugPattern NSE_NON_SYMMETRIC_EQUALS 0 BugPattern CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT -0 BugPattern NFF_NON_FUNCTIONAL_FIELD \ No newline at end of file +0 BugPattern NFF_NON_FUNCTIONAL_FIELD +0 BugPattern CEBE_COMMONS_EQUAL_BUILDER_TOEQUALS \ No newline at end of file Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-01-16 02:50:18 UTC (rev 1709) +++ trunk/fb-contrib/etc/findbugs.xml 2012-01-21 03:02:07 UTC (rev 1710) @@ -223,6 +223,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> <!-- BugPattern --> @@ -391,4 +395,6 @@ <BugPattern abbrev="SGSU" type="SGSU_SUSPICIOUS_GETTER_SETTER_USE" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="LGO" type="LGO_LINGERING_GRAPHICS_OBJECT" category="PERFORMANCE" experimental="true" /> <BugPattern abbrev="STB" type="STB_STACKED_TRY_BLOCKS" category="STYLE" experimental="true" /> + <BugPattern abbrev="CEBE" type="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" category="CORRECTNESS" /> + <BugPattern abbrev="CHTH" type="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" category="CORRECTNESS" /> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2012-01-16 02:50:18 UTC (rev 1709) +++ trunk/fb-contrib/etc/messages.xml 2012-01-21 03:02:07 UTC (rev 1710) @@ -1217,6 +1217,26 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals"> + <Details> + <![CDATA[ + <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> + ]]> + </Details> + </Detector> + + <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>It is a fast detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -3340,6 +3360,28 @@ </Details> </BugPattern> + <BugPattern type="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS"> + <ShortDescription>Method returns the result of invoking equals() on EqualsBuilder</ShortDescription> + <LongDescription>Method {1} returns the result of invoking equals() in EqualsBuilder</LongDescription> + <Details> + <![CDATA[ + <p>This method returns the result of equals on the EqualsBuilder type + instead of calling the method isEqual().</p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE"> + <ShortDescription>Method returns the result of invoking hashCode() on HashCodeBuilder</ShortDescription> + <LongDescription>Method {1} returns the result of invoking hashCode() in HashCodeBuilder</LongDescription> + <Details> + <![CDATA[ + <p>This method returns the result of hashCode on the HashCodeBuilder type + instead of calling the method toHashCode().</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -3442,4 +3484,5 @@ <BugCode abbrev="SGSU">Suspicious Getter Setter Use</BugCode> <BugCode abbrev="LGO">Lingering Graphics Object</BugCode> <BugCode abbrev="STB">Stacked Try Blocks</BugCode> + <BugCode abbrev="CEBE">Commons EqualsBuilder To Equals</BugCode> </MessageCollection> Added: trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java =================================================================== --- trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java (rev 0) +++ trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java 2012-01-21 03:02:07 UTC (rev 1710) @@ -0,0 +1,31 @@ +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); + } + +} Property changes on: trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java =================================================================== --- trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java (rev 0) +++ trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java 2012-01-21 03:02:07 UTC (rev 1710) @@ -0,0 +1,30 @@ +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(); + } +} Property changes on: trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2012-01-21 03:02:07 UTC (rev 1710) @@ -0,0 +1,98 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2012 Bhaskar Maddala + * Copyright (C) 2005-2012 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 org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.LocalVariableTable; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +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() + * + * <pre> + * new EqualsBuilder().append(this.name, other.name).equals(other); + * </pre> + */ +public class CommonsEqualsBuilderToEquals extends BytecodeScanningDetector { + + private final OpcodeStack stack; + private final BugReporter bugReporter; + + /** + * constructs a CEBE detector given the reporter to report bugs on. + * + * @param bugReporter + * the sync of bug reports + */ + public CommonsEqualsBuilderToEquals(final BugReporter bugReporter) { + stack = new OpcodeStack(); + this.bugReporter = bugReporter; + } + + /** + * 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 + */ + @Override + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + LocalVariableTable lvt = getMethod().getLocalVariableTable(); + if (lvt != null) { + super.visitCode(obj); + } + } + + @Override + public void sawOpcode(int seen) { + try { + switch (seen) { + case INVOKEVIRTUAL: + String methodName = getNameConstantOperand(); + if ("equals".equals(methodName) + && "(Ljava/lang/Object;)Z" + .equals(getSigConstantOperand())) { + String calledClass = stack.getStackItem(1).getSignature(); + if ("Lorg/apache/commons/lang3/builder/EqualsBuilder;" + .equals(calledClass) + || "org/apache/commons/lang/builder/EqualsBuilder" + .equals(calledClass)) { + bugReporter.reportBug(new BugInstance(this, + "CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS", + HIGH_PRIORITY).addClass(this).addMethod(this) + .addSourceLine(this)); + } + } + } + } finally { + super.sawOpcode(seen); + stack.sawOpcode(this, seen); + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java 2012-01-21 03:02:07 UTC (rev 1710) @@ -0,0 +1,97 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2012 Bhaskar Maddala + * Copyright (C) 2005-2012 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 org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.LocalVariableTable; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.OpcodeStack; + +/** + * Find usage of HashCodeBuilder from Apache commons, where the code invokes + * hashCode() on the constructed object rather than toHashCode() + * + * <pre> + * new HashCodeBuilder().append(this.name).hashCode(); + * </pre> + */ +public class CommonsHashcodeBuilderToHashcode extends BytecodeScanningDetector { + + private final OpcodeStack stack; + private final BugReporter bugReporter; + + /** + * constructs a CHTH detector given the reporter to report bugs on. + * + * @param bugReporter + * the sync of bug reports + */ + public CommonsHashcodeBuilderToHashcode(final BugReporter bugReporter) { + stack = new OpcodeStack(); + this.bugReporter = bugReporter; + } + + /** + * 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 + */ + @Override + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + LocalVariableTable lvt = getMethod().getLocalVariableTable(); + if (lvt != null) { + super.visitCode(obj); + } + } + + @Override + public void sawOpcode(int seen) { + try { + switch (seen) { + case INVOKEVIRTUAL: + String methodName = getNameConstantOperand(); + if ("hashCode".equals(methodName) + && "()I".equals(getSigConstantOperand())) { + String calledClass = stack.getStackItem(0).getSignature(); + if ("Lorg/apache/commons/lang3/builder/HashCodeBuilder;" + .equals(calledClass) + || "org/apache/commons/lang/builder/HashCodeBuilder" + .equals(calledClass)) { + bugReporter.reportBug(new BugInstance(this, + "CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE", + HIGH_PRIORITY).addClass(this).addMethod(this) + .addSourceLine(this)); + } + } + } + } finally { + super.sawOpcode(seen); + stack.sawOpcode(this, seen); + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java 2012-01-21 03:02:07 UTC (rev 1710) @@ -0,0 +1,93 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2012 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.utils; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.bcel.Constants; + +import edu.umd.cs.findbugs.OpcodeStack; + +/** + * restores OpcodeStack Item's userValues when a ternary is processed. This class is required + * because Findbugs has a bug whereby it strips the user value field from all OpcodeStack items when + * a GOTO is processed when items are on the stack. Normally this is not the case, but in the case of + * ternary handling there may be N items on the stack before what the ternary pushes. Now clearly the uservalue + * should be stripped for items pushed on by both branches of the ternary, but items that were on the stack + * before the ternary was executed should be left alone. This is currently not happening in findbugs. + * So this class saves off user values across a GOTO involved with a ternary and restores them appropriately. + */ +public class TernaryPatcher { + + private static List<Object> userValues = new ArrayList<Object>(); + private static boolean sawGOTO = false; + + private TernaryPatcher() { + } + + /** + * called before the execution of the parent OpcodeStack.sawOpcode() to save user values if the opcode is a GOTO or GOTO_W. + * + * @param stack the OpcodeStack with the items containing user values + * @param opcode the opcode currently seen + */ + public static void pre(OpcodeStack stack, int opcode) { + if (!sawGOTO) { + sawGOTO = (opcode == Constants.GOTO) || (opcode == Constants.GOTO_W); + if (sawGOTO) { + int depth = stack.getStackDepth(); + if (depth > 0) { + userValues.clear(); + for (int i = 0; i < depth; i++) { + OpcodeStack.Item item = stack.getStackItem(i); + userValues.add(item.getUserValue()); + } + } + } + } + } + + /** + * called after the execution of the parent OpcodeStack.sawOpcode, to restore the user values after the GOTO or GOTO_W's mergeJumps were processed + * + * @param stack the OpcodeStack with the items containing user values + * @param opcode the opcode currently seen + */ + public static void post(OpcodeStack stack, int opcode) { + if ((opcode != Constants.GOTO) && (opcode != Constants.GOTO_W)) { + if (sawGOTO) { + int depth = stack.getStackDepth(); + if (depth > 0) { + for (int i = 0; i < depth; i++) { + if (userValues.size() > i) { + OpcodeStack.Item item = stack.getStackItem(i); + if (item.getUserValue() == null) { + item.setUserValue(userValues.get(i)); + } + } + } + } + + userValues.clear(); + sawGOTO = false; + } + } + } +} \ No newline at end of file Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-01-16 02:50:29
|
Revision: 1709 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1709&view=rev Author: dbrosius Date: 2012-01-16 02:50:18 +0000 (Mon, 16 Jan 2012) Log Message: ----------- update from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.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/AbstractOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/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/CyclomaticComplexity.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/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/FinalParameters.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.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/IncorrectInternalClassUse.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/JUnitAssertionOddities.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/LocalSynchronizedCollection.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/MisleadingOverloadModel.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/NeedlessCustomSerialization.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/NonCollectionMethodUse.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/NonRecycleableTaglibs.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/OverzealousCasting.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/PoorlyDefinedParameter.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/ReflectionOnObjectMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.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/StaticArrayCreatedInMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.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/TailRecursion.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.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/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/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/AttributesUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/CodeByteUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/MapEntry.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/VersionTransition.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/XClassUtils.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/.classpath 2012-01-16 02:50:18 UTC (rev 1709) @@ -5,18 +5,15 @@ <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="lib" path="lib/annotations.jar"/> - <classpathentry kind="lib" path="lib/asm-3.1.jar"/> - <classpathentry kind="lib" path="lib/asm-tree-3.1.jar"/> - <classpathentry kind="lib" path="lib/bcel.jar"/> - <classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/> - <classpathentry kind="lib" path="lib/findbugs-ant.jar"/> - <classpathentry kind="lib" path="lib/findbugs.jar" sourcepath="/findbugs"/> - <classpathentry kind="lib" path="lib/jsr305.jar"/> <classpathentry kind="lib" path="samples/lib/jsp-api.jar"/> <classpathentry kind="lib" path="samples/lib/junit.jar"/> <classpathentry kind="lib" path="samples/lib/log4j.jar" sourcepath="/home/dave/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15-sources.jar"/> <classpathentry kind="lib" path="samples/lib/servlet-api.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> + <classpathentry kind="lib" path="lib/bcel-2.0.0.jar"/> + <classpathentry kind="lib" path="lib/findbugs-2.0.0.jar"/> + <classpathentry kind="lib" path="lib/jsr305-2.0.0.jar"/> + <classpathentry kind="lib" path="lib/annotations-2.0.0.jar"/> + <classpathentry kind="lib" path="lib/asm-tree-3.3.1.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/build.xml 2012-01-16 02:50:18 UTC (rev 1709) @@ -21,6 +21,16 @@ <property name="javac.debug" value="on"/> <property name="fb-contrib.version" value="4.7.0"/> + + <property name="findbugs.version" value="2.0.0"/> + <property name="findbugs-bcel.version" value="2.0.0"/> + <property name="annotations.version" value="2.0.0"/> + <property name="asm-tree.version" value="3.3.1"/> + + <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar"/> + <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar"/> + <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar"/> + <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> @@ -37,11 +47,14 @@ </target> <target name="-init" description="prepares repository for a build"> + <mkdir dir="${lib.dir}"/> <mkdir dir="${classes.dir}"/> <mkdir dir="${javadoc.dir}"/> <path id="fb-contrib.classpath"> - <pathelement location="${lib.dir}/findbugs.jar"/> - <pathelement location="${lib.dir}/bcel.jar"/> + <pathelement location="${lib.dir}/findbugs-${findbugs.version}.jar"/> + <pathelement location="${lib.dir}/bcel-${findbugs-bcel.version}.jar"/> + <pathelement location="${lib.dir}/annotations-${annotations.version}.jar"/> + <pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar"/> </path> <path id="fb-contrib.samples.classpath"> <pathelement location="${sampleslib.dir}/jsp-api.jar"/> @@ -55,7 +68,41 @@ <mkdir dir="${classes.dir}/com/mebigfatguy/fbcontrib/detect"/> <echo message="*.class" file="${classes.dir}/com/mebigfatguy/fbcontrib/detect/.cvsignore"/> </target> + + <target name="findbugs-check"> + <available file="${basedir}/lib/findbugs-${findbugs.version}.jar" property="findbugs-exists"/> + </target> + <target name="findbugs-bcel-check"> + <available file="${basedir}/lib/bcel-${findbugs-bcel.version}.jar" property="findbugs-bcel-exists"/> + </target> + + <target name="annotations-check"> + <available file="${basedir}/lib/annotations-${annotations.version}.jar" property="annotations-exists"/> + </target> + + <target name="asm-tree-check"> + <available file="${basedir}/lib/asm-tree-${asm-tree.version}.jar" property="asm-tree-exists"/> + </target> + + <target name="install-findbugs" depends="findbugs-check" unless="findbugs-exists" description="installs findbugs.jar into lib"> + <get src="${findbugs-url}" dest="${basedir}/lib/findbugs-${findbugs.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install-findbugs-bcel" depends="findbugs-bcel-check" unless="findbugs-bcel-exists" description="installs findbugs-bcel.jar into lib"> + <get src="${findbugs-bcel-url}" dest="${basedir}/lib/bcel-${findbugs-bcel.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install-annotations" depends="annotations-check" unless="annotations-exists" description="installs annotations.jar into lib"> + <get src="${annotations-url}" dest="${basedir}/lib/annotations-${annotations.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="install-asm-tree" depends="asm-tree-check" unless="asm-tree-exists" description="installs asm-tree.jar into lib"> + <get src="${asm-tree-url}" dest="${basedir}/lib/asm-tree-${asm-tree.version}.jar" verbose="true" ignoreerrors="true"/> + </target> + + <target name="pull" depends="install-findbugs, install-findbugs-bcel, install-annotations, install-asm-tree" description="pull 3rdparty jars to the lib directory"/> + <target name="validate_xml" depends="-init" description="validates the xml files"> <xmlvalidate lenient="false" failonerror="yes"> <attribute name="http://apache.org/xml/features/validation/schema" value="true"/> @@ -64,7 +111,7 @@ </xmlvalidate> </target> - <target name="compile" depends="-init" description="compiles java files"> + <target name="compile" depends="-init, pull" description="compiles java files"> <javac srcdir="${src.dir}" destdir="${classes.dir}" source="${javac.source}" @@ -159,7 +206,7 @@ destdir="${javadoc.dir}" windowtitle="fb-contrib api"> <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> - <bottom><![CDATA[<i>Copyright © 2005-2011 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> + <bottom><![CDATA[<i>Copyright © 2005-2012 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> </javadoc> </target> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2011 Bhaskar Maddala + * Copyright (C) 2012 Bhaskar Maddala * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,7 +1,7 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Chris Peterson - * Copyright (C) 2005-2011 Jean-Noel Rouvignac + * Copyright (C) 2005-2012 Chris Peterson + * Copyright (C) 2005-2012 Jean-Noel Rouvignac * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-2012 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java 2012-01-16 02:45:44 UTC (rev 1708) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java 2012-01-16 02:50:18 UTC (rev 1709) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2011 Dave Brosius + * Copyright (C) 2005-... [truncated message content] |
From: <dbr...@us...> - 2012-01-16 02:45:50
|
Revision: 1708 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1708&view=rev Author: dbrosius Date: 2012-01-16 02:45:44 +0000 (Mon, 16 Jan 2012) Log Message: ----------- remove jars from repo Removed Paths: ------------- trunk/fb-contrib/lib/annotations.jar trunk/fb-contrib/lib/asm-3.0.jar trunk/fb-contrib/lib/asm-3.1.jar trunk/fb-contrib/lib/asm-tree-3.0.jar trunk/fb-contrib/lib/asm-tree-3.1.jar trunk/fb-contrib/lib/bcel.jar trunk/fb-contrib/lib/dom4j-1.6.1.jar trunk/fb-contrib/lib/dom4j-full.jar trunk/fb-contrib/lib/findbugs-ant.jar trunk/fb-contrib/lib/findbugs.jar trunk/fb-contrib/lib/jsr305.jar Deleted: trunk/fb-contrib/lib/annotations.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/asm-3.0.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/asm-3.1.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/asm-tree-3.0.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/asm-tree-3.1.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/bcel.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/dom4j-1.6.1.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/dom4j-full.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/findbugs-ant.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/findbugs.jar =================================================================== (Binary files differ) Deleted: trunk/fb-contrib/lib/jsr305.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-12-14 06:07:13
|
Revision: 1707 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1707&view=rev Author: dbrosius Date: 2011-12-14 06:07:04 +0000 (Wed, 14 Dec 2011) Log Message: ----------- fix bug in Findbugs where user values are not maintained on the stack across ternary statements Modified Paths: -------------- 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/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.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/MethodReturnsConstant.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.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/StutteredMethodArguments.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.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/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/detect/WriteOnlyCollection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -28,6 +28,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -276,7 +277,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (userValue != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -32,6 +32,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -42,18 +43,18 @@ /** * looks for variable assignments at a scope larger than its use. In this case, - * the assignment can be pushed down into the smaller scope to reduce the performance - * impact of that assignment. + * the assignment can be pushed down into the smaller scope to reduce the + * performance impact of that assignment. */ -public class BloatedAssignmentScope extends BytecodeScanningDetector -{ +public class BloatedAssignmentScope extends BytecodeScanningDetector { private static final Set<String> dangerousAssignmentClassSources = new HashSet<String>(); private static final Set<String> dangerousAssignmentMethodSources = new HashSet<String>(); static { dangerousAssignmentClassSources.add("java/io/InputStream"); dangerousAssignmentClassSources.add("java/io/ObjectInput"); - dangerousAssignmentMethodSources.add("java/lang/System.currentTimeMillis()J"); + dangerousAssignmentMethodSources + .add("java/lang/System.currentTimeMillis()J"); } BugReporter bugReporter; @@ -69,17 +70,20 @@ /** * constructs a BAS detector given the reporter to report bugs on - - * @param bugReporter the sync of bug reports + * + * @param bugReporter + * the sync of bug reports */ public BloatedAssignmentScope(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** - * implements the visitor to create and the clear the register to location map - * - * @param classContext the context object of the currently parsed class + * implements the visitor to create and the clear the register to location + * map + * + * @param classContext + * the context object of the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { @@ -101,8 +105,9 @@ /** * implements the visitor to reset the register to location map - * - * @param obj the context object of the currently parsed code block + * + * @param obj + * the context object of the currently parsed code block */ @Override public void visitCode(Code obj) { @@ -110,8 +115,7 @@ ignoreRegs.clear(); Method method = getMethod(); - if (!method.isStatic()) - { + if (!method.isStatic()) { ignoreRegs.add(Integer.valueOf(0)); } @@ -136,8 +140,7 @@ sawNull = false; super.visitCode(obj); - if (!dontReport) - { + if (!dontReport) { rootScopeBlock.findBugs(new HashSet<Integer>()); } @@ -147,20 +150,18 @@ } /** - * implements the visitor to look for variables assigned below the scope - * in which they are used. - * - * @param seen the opcode of the currently parsed instruction + * implements the visitor to look for variables assigned below the scope in + * which they are used. + * + * @param seen + * the opcode of the currently parsed instruction */ @Override public void sawOpcode(int seen) { UserObject uo = null; try { - if ((seen == ASTORE) - || (seen == ISTORE) - || (seen == LSTORE) - || (seen == FSTORE) - || (seen == DSTORE) + if ((seen == ASTORE) || (seen == ISTORE) || (seen == LSTORE) + || (seen == FSTORE) || (seen == DSTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3)) || ((seen >= ISTORE_0) && (seen <= ISTORE_3)) || ((seen >= LSTORE_0) && (seen <= LSTORE_3)) @@ -170,16 +171,11 @@ Integer iReg = Integer.valueOf(reg); int pc = getPC(); - if (catchHandlers.contains(Integer.valueOf(pc))) - { + if (catchHandlers.contains(Integer.valueOf(pc))) { ignoreRegs.add(iReg); - } - else if (monitorSyncPCs.size() > 0) - { + } else if (monitorSyncPCs.size() > 0) { ignoreRegs.add(iReg); - } - else if (sawNull) - { + } else if (sawNull) { ignoreRegs.add(iReg); } @@ -188,21 +184,19 @@ if (sb != null) { UserObject assoc = null; if (stack.getStackDepth() > 0) { - assoc = (UserObject)stack.getStackItem(0).getUserValue(); + assoc = (UserObject) stack.getStackItem(0) + .getUserValue(); } if ((assoc != null) && assoc.isRisky) { ignoreRegs.add(iReg); } else { sb.addStore(reg, pc, assoc); - if (sawDup) - { + if (sawDup) { sb.addLoad(reg, pc); } } - } - else - { + } else { ignoreRegs.add(iReg); } } @@ -211,26 +205,18 @@ Integer iReg = Integer.valueOf(reg); if (!ignoreRegs.contains(iReg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, getPC()); - if (sb != null) - { + if (sb != null) { sb.addLoad(reg, getPC()); - } - else - { + } else { ignoreRegs.add(iReg); } } int pc = getPC(); - if (catchHandlers.contains(Integer.valueOf(pc))) - { + if (catchHandlers.contains(Integer.valueOf(pc))) { ignoreRegs.add(iReg); - } - else if (monitorSyncPCs.size() > 0) - { + } else if (monitorSyncPCs.size() > 0) { ignoreRegs.add(iReg); - } - else if (sawNull) - { + } else if (sawNull) { ignoreRegs.add(iReg); } @@ -238,21 +224,15 @@ ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.addStore(reg, pc, null); - if (sawDup) - { + if (sawDup) { sb.addLoad(reg, pc); } - } - else - { + } else { ignoreRegs.add(iReg); } } - } else if ((seen == ALOAD) - || (seen == ILOAD) - || (seen == LLOAD) - || (seen == FLOAD) - || (seen == DLOAD) + } else if ((seen == ALOAD) || (seen == ILOAD) || (seen == LLOAD) + || (seen == FLOAD) || (seen == DLOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3)) || ((seen >= ILOAD_0) && (seen <= ILOAD_3)) || ((seen >= LLOAD_0) && (seen <= LLOAD_3)) @@ -261,22 +241,21 @@ int reg = RegisterUtils.getLoadReg(this, seen); if (!ignoreRegs.contains(Integer.valueOf(reg))) { ScopeBlock sb = findScopeBlock(rootScopeBlock, getPC()); - if (sb != null) - { + if (sb != null) { sb.addLoad(reg, getPC()); - } - else - { + } else { ignoreRegs.add(Integer.valueOf(reg)); } } - } else if (((seen >= IFEQ) && (seen <= GOTO)) || (seen == IFNULL) || (seen == IFNONNULL) || (seen == GOTO_W)) { + } else if (((seen >= IFEQ) && (seen <= GOTO)) || (seen == IFNULL) + || (seen == IFNONNULL) || (seen == GOTO_W)) { int target = getBranchTarget(); if (target > getPC()) { if ((seen == GOTO) || (seen == GOTO_W)) { Integer nextPC = Integer.valueOf(getNextPC()); if (!switchTargets.contains(nextPC)) { - ScopeBlock sb = findScopeBlockWithTarget(rootScopeBlock, getPC(), getNextPC()); + ScopeBlock sb = findScopeBlockWithTarget( + rootScopeBlock, getPC(), getNextPC()); if (sb == null) { sb = new ScopeBlock(getPC(), target); sb.setLoop(); @@ -289,13 +268,13 @@ } } } else { - ScopeBlock sb = findScopeBlockWithTarget(rootScopeBlock, getPC(), target); + ScopeBlock sb = findScopeBlockWithTarget( + rootScopeBlock, getPC(), target); if ((sb != null) && (!sb.isLoop) && !sb.hasChildren()) { if (sb.isGoto()) { ScopeBlock parent = sb.getParent(); sb.pushUpLoadStores(); - if (parent != null) - { + if (parent != null) { parent.removeChild(sb); } sb = new ScopeBlock(getPC(), target); @@ -312,8 +291,7 @@ } } else { ScopeBlock sb = findScopeBlock(rootScopeBlock, getPC()); - if (sb != null) - { + if (sb != null) { ScopeBlock parentSB = sb.getParent(); while (parentSB != null) { if (parentSB.getStart() >= target) { @@ -330,13 +308,12 @@ int pc = getPC(); int[] offsets = getSwitchOffsets(); List<Integer> targets = new ArrayList<Integer>(); - for (int offset : offsets) - { + for (int offset : offsets) { targets.add(Integer.valueOf(offset + pc)); } - Integer defOffset = Integer.valueOf(getDefaultSwitchOffset() + pc); - if (!targets.contains(defOffset)) - { + Integer defOffset = Integer.valueOf(getDefaultSwitchOffset() + + pc); + if (!targets.contains(defOffset)) { targets.add(defOffset); } Collections.sort(targets); @@ -344,15 +321,15 @@ Integer lastTarget = targets.get(0); for (int i = 1; i < targets.size(); i++) { Integer nextTarget = targets.get(i); - ScopeBlock sb = new ScopeBlock(lastTarget.intValue(), nextTarget.intValue()); + ScopeBlock sb = new ScopeBlock(lastTarget.intValue(), + nextTarget.intValue()); rootScopeBlock.addChild(sb); lastTarget = nextTarget; } switchTargets.addAll(targets); } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { if ("wasNull".equals(getNameConstantOperand()) - && "()Z".equals(getSigConstantOperand())) - { + && "()Z".equals(getSigConstantOperand())) { dontReport = true; } @@ -372,8 +349,7 @@ } else if (seen == MONITORENTER) { monitorSyncPCs.add(Integer.valueOf(getPC())); } else if (seen == MONITOREXIT) { - if (monitorSyncPCs.size() > 0) - { + if (monitorSyncPCs.size() > 0) { monitorSyncPCs.remove(monitorSyncPCs.size() - 1); } } @@ -381,7 +357,9 @@ sawDup = (seen == DUP); sawNull = (seen == ACONST_NULL); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (uo != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); @@ -392,15 +370,15 @@ } /** - * returns either a register number of a field reference of the object that a method is being called on, - * or null, if it can't be determined. - * - * @return either an Integer for a register, or a String for the field name, or null + * returns either a register number of a field reference of the object that + * a method is being called on, or null, if it can't be determined. + * + * @return either an Integer for a register, or a String for the field name, + * or null */ private Comparable<?> getCallingObject() { String sig = getSigConstantOperand(); - if ("V".equals(Type.getReturnType(sig).getSignature())) - { + if ("V".equals(Type.getReturnType(sig).getSignature())) { return null; } @@ -411,24 +389,29 @@ OpcodeStack.Item caller = stack.getStackItem(types.length); int reg = caller.getRegisterNumber(); - if (reg >= 0) - { + if (reg >= 0) { return Integer.valueOf(reg); } - /* We ignore the possibility of two fields with the same name in different classes */ + /* + * We ignore the possibility of two fields with the same name in + * different classes + */ XField f = caller.getXField(); - if (f != null) - { + if (f != null) { return f.getName(); } return null; } + /** - * returns the scope block in which this register was assigned, by traversing the scope block tree - * - * @param sb the scope block to start searching in - * @param pc the current program counter + * returns the scope block in which this register was assigned, by + * traversing the scope block tree + * + * @param sb + * the scope block to start searching in + * @param pc + * the current program counter * @return the scope block or null if not found */ private ScopeBlock findScopeBlock(ScopeBlock sb, int pc) { @@ -437,8 +420,7 @@ if (sb.children != null) { for (ScopeBlock child : sb.children) { ScopeBlock foundSb = findScopeBlock(child, pc); - if (foundSb != null) - { + if (foundSb != null) { return foundSb; } } @@ -449,28 +431,30 @@ } /** - * returns an existing scope block that has the same target as the one looked for - * - * @param sb the scope block to start with - * @param target the target to look for - * + * returns an existing scope block that has the same target as the one + * looked for + * + * @param sb + * the scope block to start with + * @param target + * the target to look for + * * @return the scope block found or null */ - private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, int target) { + private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, + int target) { ScopeBlock parentBlock = null; if ((sb.startLocation < start) && (sb.finishLocation >= start)) { - if ((sb.finishLocation <= target) || (sb.isGoto() && !sb.isLoop())) - { + if ((sb.finishLocation <= target) || (sb.isGoto() && !sb.isLoop())) { parentBlock = sb; } } - if (sb.children != null) - { + if (sb.children != null) { for (ScopeBlock child : sb.children) { - ScopeBlock targetBlock = findScopeBlockWithTarget(child, start, target); - if (targetBlock != null) - { + ScopeBlock targetBlock = findScopeBlockWithTarget(child, start, + target); + if (targetBlock != null) { return targetBlock; } } @@ -479,10 +463,10 @@ return parentBlock; } - /** holds the description of a scope { } block, be it a for, if, while block + /** + * holds the description of a scope { } block, be it a for, if, while block */ - private class ScopeBlock - { + private class ScopeBlock { private ScopeBlock parent; private int startLocation; private int finishLocation; @@ -493,10 +477,13 @@ private Map<UserObject, Integer> assocs; private List<ScopeBlock> children; - /** construts a new scope block - * - * @param start the beginning of the block - * @param finish the end of the block + /** + * construts a new scope block + * + * @param start + * the beginning of the block + * @param finish + * the end of the block */ public ScopeBlock(int start, int finish) { parent = null; @@ -512,33 +499,37 @@ /** * returns a string representation of the scope block - * + * * @returns a string representation */ @Override public String toString() { - return "Start=" + startLocation + " Finish=" + finishLocation + " Loop=" + isLoop + " Loads=" + loads + " Stores=" + stores; + return "Start=" + startLocation + " Finish=" + finishLocation + + " Loop=" + isLoop + " Loads=" + loads + " Stores=" + + stores; } /** * returns the scope blocks parent - * + * * @return the parent of this scope block */ public ScopeBlock getParent() { return parent; } - /** returns the start of the block - * + /** + * returns the start of the block + * * @return the start of the block */ public int getStart() { return startLocation; } - /** returns the end of the block - * + /** + * returns the end of the block + * * @return the end of the block */ public int getFinish() { @@ -547,7 +538,9 @@ /** * sets the start pc of the block - * @param start the start pc + * + * @param start + * the start pc */ public void setStart(int start) { startLocation = start; @@ -555,7 +548,9 @@ /** * sets the finish pc of the block - * @param finish the finish pc + * + * @param finish + * the finish pc */ public void setFinish(int finish) { finishLocation = finish; @@ -564,6 +559,7 @@ public boolean hasChildren() { return children != null; } + /** * sets that this block is a loop */ @@ -573,7 +569,7 @@ /** * returns whether this scope block is a loop - * + * * @returns whether this block is a loop */ public boolean isLoop() { @@ -589,7 +585,7 @@ /** * returns whether this block was caused from a goto - * + * * @returns whether this block was caused by a goto */ public boolean isGoto() { @@ -598,28 +594,30 @@ /** * adds the register as a store in this scope block - * - * @param reg the register that was stored - * @param pc the instruction that did the store + * + * @param reg + * the register that was stored + * @param pc + * the instruction that did the store */ public void addStore(int reg, int pc, UserObject assocObject) { - if (stores == null) - { + if (stores == null) { stores = new HashMap<Integer, Integer>(); } stores.put(Integer.valueOf(reg), Integer.valueOf(pc)); - if (assocs == null) - { + if (assocs == null) { assocs = new HashMap<UserObject, Integer>(); } assocs.put(assocObject, Integer.valueOf(reg)); } /** - * removes stores to registers that where retrieved from method calls on assocObject - * - * @param assocObject the object that a method call was just performed on + * removes stores to registers that where retrieved from method calls on + * assocObject + * + * @param assocObject + * the object that a method call was just performed on */ public void removeByAssoc(Object assocObject) { if (assocs != null) { @@ -637,13 +635,14 @@ /** * adds the register as a load in this scope block - * - * @param reg the register that was loaded - * @param pc the instruction that did the load + * + * @param reg + * the register that was loaded + * @param pc + * the instruction that did the load */ public void addLoad(int reg, int pc) { - if (loads == null) - { + if (loads == null) { loads = new HashMap<Integer, Integer>(); } @@ -651,16 +650,19 @@ } /** - * adds a scope block to this subtree by finding the correct place in the hierarchy to store it - * - * @param newChild the scope block to add to the tree + * adds a scope block to this subtree by finding the correct place in + * the hierarchy to store it + * + * @param newChild + * the scope block to add to the tree */ public void addChild(ScopeBlock newChild) { newChild.parent = this; if (children != null) { for (ScopeBlock child : children) { - if ((newChild.startLocation > child.startLocation) && (newChild.finishLocation <= child.finishLocation)) { + if ((newChild.startLocation > child.startLocation) + && (newChild.finishLocation <= child.finishLocation)) { child.addChild(newChild); return; } @@ -682,37 +684,35 @@ /** * removes a child from this node - * @param child the child to remove + * + * @param child + * the child to remove */ public void removeChild(ScopeBlock child) { - if (children != null) - { + if (children != null) { children.remove(child); } } /** - * report stores that occur at scopes higher than associated loads that are not involved with loops + * report stores that occur at scopes higher than associated loads that + * are not involved with loops */ public void findBugs(Set<Integer> parentUsedRegs) { - if (isLoop) - { + if (isLoop) { return; } Set<Integer> usedRegs = new HashSet<Integer>(parentUsedRegs); - if (stores != null) - { + if (stores != null) { usedRegs.addAll(stores.keySet()); } - if (loads != null) - { + if (loads != null) { usedRegs.addAll(loads.keySet()); } if (stores != null) { - if (loads != null) - { + if (loads != null) { stores.keySet().removeAll(loads.keySet()); } stores.keySet().removeAll(parentUsedRegs); @@ -720,7 +720,8 @@ if (stores.size() > 0) { if (children != null) { - for (Map.Entry<Integer, Integer> entry : stores.entrySet()) { + for (Map.Entry<Integer, Integer> entry : stores + .entrySet()) { int childUseCount = 0; boolean inLoop = false; Integer reg = entry.getKey(); @@ -734,10 +735,15 @@ } } if ((!inLoop) && (childUseCount == 1)) { - bugReporter.reportBug(new BugInstance(BloatedAssignmentScope.this, "BAS_BLOATED_ASSIGNMENT_SCOPE", NORMAL_PRIORITY) - .addClass(BloatedAssignmentScope.this) - .addMethod(BloatedAssignmentScope.this) - .addSourceLine(BloatedAssignmentScope.this, entry.getValue().intValue())); + bugReporter.reportBug(new BugInstance( + BloatedAssignmentScope.this, + "BAS_BLOATED_ASSIGNMENT_SCOPE", + NORMAL_PRIORITY) + .addClass(BloatedAssignmentScope.this) + .addMethod(BloatedAssignmentScope.this) + .addSourceLine( + BloatedAssignmentScope.this, + entry.getValue().intValue())); } } } @@ -752,26 +758,25 @@ } /** - * returns whether this block either loads or stores into the register in question - * - * @param reg the register to look for loads or stores - * + * returns whether this block either loads or stores into the register + * in question + * + * @param reg + * the register to look for loads or stores + * * @return whether the block uses the register */ public boolean usesReg(Integer reg) { - if ((loads != null) && (loads.containsKey(reg))) - { + if ((loads != null) && (loads.containsKey(reg))) { return true; } - if ((stores != null) && (stores.containsKey(reg))) - { + if ((stores != null) && (stores.containsKey(reg))) { return true; } if (children != null) { for (ScopeBlock child : children) { - if (child.usesReg(reg)) - { + if (child.usesReg(reg)) { return true; } } @@ -786,22 +791,16 @@ public void pushUpLoadStores() { if (parent != null) { if (loads != null) { - if (parent.loads != null) - { + if (parent.loads != null) { parent.loads.putAll(loads); - } - else - { + } else { parent.loads = loads; } } if (stores != null) { - if (parent.stores != null) - { + if (parent.stores != null) { parent.stores.putAll(stores); - } - else - { + } else { parent.stores = stores; } } @@ -819,7 +818,8 @@ return true; } - String key = clsName + "." + getNameConstantOperand() + getSigConstantOperand(); + String key = clsName + "." + getNameConstantOperand() + + getSigConstantOperand(); return dangerousAssignmentMethodSources.contains(key); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -35,6 +35,7 @@ import com.mebigfatguy.fbcontrib.utils.CodeByteUtils; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -301,7 +302,9 @@ } } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if ((groupId >= 0) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); itm.setUserValue(Integer.valueOf(groupId)); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -29,6 +29,7 @@ import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -184,7 +185,9 @@ } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (methodPackage != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -22,6 +22,8 @@ import org.apache.bcel.classfile.Constant; import org.apache.bcel.classfile.ConstantString; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -171,7 +173,9 @@ } } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (nestedSB != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -26,6 +26,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -143,7 +144,9 @@ tosIsJDBC = true; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (tosIsJDBC) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -29,6 +29,8 @@ import org.apache.bcel.classfile.Unknown; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -196,7 +198,9 @@ } } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if ((userValue != null) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(userValue); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -26,6 +26,7 @@ import org.apache.bcel.classfile.Code; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -141,7 +142,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawNewGraphicsAt != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -30,6 +30,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -229,7 +230,9 @@ } } } finally { - stack.sawOpcode(this, seen); + TernaryPatcher.pre(stack, seen); + stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (tosIsSyncColReg != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -31,6 +31,8 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -260,7 +262,9 @@ } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { - stack.sawOpcode(this, seen); + TernaryPatcher.pre(stack, seen); + stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (ldcClassName != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -38,6 +38,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -291,7 +292,9 @@ lastWasExitPoint = seen >= IRETURN && seen <= RETURN || seen == GOTO || seen == GOTO_W || seen == ATHROW; } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (markAsValid) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -22,6 +22,8 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.Method; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -133,7 +135,9 @@ } } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawSBToString && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(Boolean.TRUE); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -29,6 +29,8 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -324,7 +326,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (isSyncCollection) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -28,6 +28,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -203,7 +204,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (tosIsPriority != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -25,6 +25,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -215,7 +216,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawAllocation) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -28,6 +28,7 @@ import org.apache.bcel.classfile.Method; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -244,7 +245,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (arraySize != null) { if (stack.getStackDepth() >= 1) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -30,6 +30,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -291,7 +292,9 @@ } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawTextLabel) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -21,6 +21,8 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -127,7 +129,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (pc != 0) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -39,6 +39,7 @@ import com.mebigfatguy.fbcontrib.utils.CodeByteUtils; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -666,7 +667,9 @@ } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if ((userValue != null) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(userValue); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -25,6 +25,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -161,7 +162,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (fieldSource != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -27,6 +27,8 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -167,7 +169,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (srcField && stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(Boolean.TRUE); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -27,6 +27,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -146,7 +147,9 @@ } } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawGetAttribute) { if (stack.getStackDepth() > 0) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -25,6 +25,7 @@ import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -251,7 +252,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(userValue); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -28,6 +28,7 @@ import com.mebigfatguy.fbcontrib.utils.AttributesUtils; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -180,7 +181,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawAlloc) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -27,6 +27,8 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -196,7 +198,9 @@ lhsReg = processBinOp(seen); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if ((lhsReg > -1) && (stack.getStackDepth() >= 1)) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(Integer.valueOf(lhsReg)); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -27,6 +27,7 @@ import org.apache.bcel.classfile.JavaClass; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -274,7 +275,9 @@ } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawAlias) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -28,6 +28,7 @@ import org.apache.bcel.classfile.Method; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -175,7 +176,9 @@ } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawEnumCollectionCreation != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -25,6 +25,7 @@ import org.apache.bcel.classfile.JavaClass; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -215,7 +216,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (state != State.SEEN_NOTHING) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -26,6 +26,7 @@ import org.apache.bcel.classfile.JavaClass; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -191,7 +192,9 @@ } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (sawAlias) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -30,6 +30,8 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -162,7 +164,9 @@ } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if ((sawConstant || allConstantStrings) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(Boolean.TRUE); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2011-11-23 00:17:01 UTC (rev 1706) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2011-12-14 06:07:04 UTC (rev 1707) @@ -40,6 +40,7 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; +import com.mebigfatguy.fbcontrib.utils.TernaryPatcher; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -328,7 +329,9 @@ break; } } finally { + TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); + TernaryPatcher.post(stack, seen); if (userObject != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-11-23 00:17:07
|
Revision: 1706 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1706&view=rev Author: dbrosius Date: 2011-11-23 00:17:01 +0000 (Wed, 23 Nov 2011) Log Message: ----------- changes from git repository Modified Paths: -------------- trunk/fb-contrib/samples/WOC_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java Modified: trunk/fb-contrib/samples/WOC_Sample.java =================================================================== --- trunk/fb-contrib/samples/WOC_Sample.java 2011-10-14 05:34:15 UTC (rev 1705) +++ trunk/fb-contrib/samples/WOC_Sample.java 2011-11-23 00:17:01 UTC (rev 1706) @@ -17,10 +17,7 @@ private final Set<String> memberSet = new HashSet<String>(); private Set<String> fpSet; private final List<String> fpList = new ArrayList<String>(); - private final Set<String> fpMergeSet = new HashSet<String>(fpSet); - private boolean abug = true; - public void testWOCSimple() { Set<String> s = new HashSet<String>(); @@ -104,13 +101,4 @@ { return ws.fpList; } - - public void fpMergeListWOC() - { - caller(fpMergeSet, !abug); - } - - private void caller(Set<String> set, boolean b) - { - } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2011-10-14 05:34:15 UTC (rev 1705) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2011-11-23 00:17:01 UTC (rev 1706) @@ -314,6 +314,15 @@ ScopeBlock sb = findScopeBlock(rootScopeBlock, getPC()); if (sb != null) { + ScopeBlock parentSB = sb.getParent(); + while (parentSB != null) { + if (parentSB.getStart() >= target) { + sb = parentSB; + parentSB = parentSB.getParent(); + } else { + break; + } + } sb.setLoop(); } } @@ -651,7 +660,7 @@ if (children != null) { for (ScopeBlock child : children) { - if ((newChild.startLocation > child.startLocation) && (newChild.finishLocation < child.finishLocation)) { + if ((newChild.startLocation > child.startLocation) && (newChild.finishLocation <= child.finishLocation)) { child.addChild(newChild); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-10-14 05:34:21
|
Revision: 1705 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1705&view=rev Author: dbrosius Date: 2011-10-14 05:34:15 +0000 (Fri, 14 Oct 2011) Log Message: ----------- don't report ignored regs Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2011-08-23 10:31:31 UTC (rev 1704) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2011-10-14 05:34:15 UTC (rev 1705) @@ -707,6 +707,7 @@ stores.keySet().removeAll(loads.keySet()); } stores.keySet().removeAll(parentUsedRegs); + stores.keySet().removeAll(ignoreRegs); if (stores.size() > 0) { if (children != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-08-23 10:31:37
|
Revision: 1704 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1704&view=rev Author: dbrosius Date: 2011-08-23 10:31:31 +0000 (Tue, 23 Aug 2011) Log Message: ----------- better grammar Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2011-08-12 02:24:58 UTC (rev 1703) +++ trunk/fb-contrib/etc/messages.xml 2011-08-23 10:31:31 UTC (rev 1704) @@ -3073,7 +3073,7 @@ <LongDescription>Method {1} calls InetAddress.getLocalHost(), which may be a security risk</LongDescription> <Details> <![CDATA[ - <p>Do not call <code>InetAddress.getLocalHost()</code> on multihomed servers. On a multihomed server, <code>InetAddress.getLocalHost()</code> simply returns the IP address associated with the server's internal hostname. This could any of the network interfaces, which could expose the machine to security risks. Server applications that need to listen on sockets should add configurable properties to define which network interfaces the server should bind.</p> + <p>Do not call <code>InetAddress.getLocalHost()</code> on multihomed servers. On a multihomed server, <code>InetAddress.getLocalHost()</code> simply returns the IP address associated with the server's internal hostname. This could be any of the network interfaces, which could expose the machine to security risks. Server applications that need to listen on sockets should add configurable properties to define which network interfaces the server should bind.</p> ]]> </Details> </BugPattern> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-08-12 02:25:06
|
Revision: 1703 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1703&view=rev Author: dbrosius Date: 2011-08-12 02:24:58 +0000 (Fri, 12 Aug 2011) Log Message: ----------- add jersey as a valid sun package Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2011-07-23 04:27:27 UTC (rev 1702) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2011-08-12 02:24:58 UTC (rev 1703) @@ -34,83 +34,84 @@ * looks for classes that use objects from com.sun.xxx packages. As these are internal * to sun and subject to change, this should not be done. */ -public class IncorrectInternalClassUse implements Detector +public class IncorrectInternalClassUse implements Detector { - private final BugReporter bugReporter; - private static final Set<String> internalPackages = new HashSet<String>(); - private static final Set<String> externalPackages = new HashSet<String>(); - static { - internalPackages.add("com/sun/"); - internalPackages.add("org/apache/xerces/"); - internalPackages.add("org/apache/xalan/"); - externalPackages.add("org/apache/xerces/xni/"); - externalPackages.add("org/apache/xerces/xs/"); - externalPackages.add("org/apache/xalan/extensions"); - } + private final BugReporter bugReporter; + private static final Set<String> internalPackages = new HashSet<String>(); + private static final Set<String> externalPackages = new HashSet<String>(); + static { + internalPackages.add("com/sun/"); + internalPackages.add("org/apache/xerces/"); + internalPackages.add("org/apache/xalan/"); + externalPackages.add("com/sun/jersey"); + externalPackages.add("org/apache/xerces/xni/"); + externalPackages.add("org/apache/xerces/xs/"); + externalPackages.add("org/apache/xalan/extensions"); + } - /** + /** * constructs a IICU detector given the reporter to report bugs on * @param bugReporter the sync of bug reports - */ - public IncorrectInternalClassUse(BugReporter bugReporter) { - this.bugReporter = bugReporter; - } + */ + public IncorrectInternalClassUse(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } - /** - * implements the visitor to look for classes that reference com.sun.xxx, or org.apache.xerces.xxx classes - * by looking for class constants in the constant pool - * - * @param context the context object of the currently parsed class - */ - public void visitClassContext(ClassContext context) { - JavaClass cls = context.getJavaClass(); - if (!isInternal(cls.getClassName())) { - ConstantPool pool = cls.getConstantPool(); - int numItems = pool.getLength(); - for (int i = 0; i < numItems; i++) { - Constant c = pool.getConstant(i); - if (c instanceof ConstantClass) { - String clsName = ((ConstantClass) c).getBytes(pool); - if (isInternal(clsName)) { - bugReporter.reportBug(new BugInstance(this, "IICU_INCORRECT_INTERNAL_CLASS_USE", NORMAL_PRIORITY) - .addClass(cls) - .addString(clsName)); - } - } - } - } - } + /** + * implements the visitor to look for classes that reference com.sun.xxx, or org.apache.xerces.xxx classes + * by looking for class constants in the constant pool + * + * @param context the context object of the currently parsed class + */ + public void visitClassContext(ClassContext context) { + JavaClass cls = context.getJavaClass(); + if (!isInternal(cls.getClassName())) { + ConstantPool pool = cls.getConstantPool(); + int numItems = pool.getLength(); + for (int i = 0; i < numItems; i++) { + Constant c = pool.getConstant(i); + if (c instanceof ConstantClass) { + String clsName = ((ConstantClass) c).getBytes(pool); + if (isInternal(clsName)) { + bugReporter.reportBug(new BugInstance(this, "IICU_INCORRECT_INTERNAL_CLASS_USE", NORMAL_PRIORITY) + .addClass(cls) + .addString(clsName)); + } + } + } + } + } - /** - * implementation stub for Detector interface - */ - public void report() { - } - - /** - * determines if the class in question is an internal class by looking at package prefixes - * - * @param clsName the name of the class to check - * @returns whether the class is internal - */ - private boolean isInternal(String clsName) { - boolean internal = false; - for (String internalPackage : internalPackages) { - if (clsName.startsWith(internalPackage)) { - internal = true; - break; - } - } - - if (internal) { - for (String externalPackage : externalPackages) { - if (clsName.startsWith(externalPackage)) { - internal = false; - break; - } - } - } - - return internal; - } + /** + * implementation stub for Detector interface + */ + public void report() { + } + + /** + * determines if the class in question is an internal class by looking at package prefixes + * + * @param clsName the name of the class to check + * @returns whether the class is internal + */ + private boolean isInternal(String clsName) { + boolean internal = false; + for (String internalPackage : internalPackages) { + if (clsName.startsWith(internalPackage)) { + internal = true; + break; + } + } + + if (internal) { + for (String externalPackage : externalPackages) { + if (clsName.startsWith(externalPackage)) { + internal = false; + break; + } + } + } + + return internal; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-23 04:27:34
|
Revision: 1702 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1702&view=rev Author: dbrosius Date: 2011-07-23 04:27:27 +0000 (Sat, 23 Jul 2011) Log Message: ----------- oi Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-08 18:50:42 UTC (rev 1701) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-23 04:27:27 UTC (rev 1702) @@ -25,7 +25,6 @@ import org.apache.bcel.Repository; import org.apache.bcel.classfile.Code; -import org.apache.bcel.classfile.ConstantString; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.Type; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-08 18:50:48
|
Revision: 1701 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1701&view=rev Author: dbrosius Date: 2011-07-08 18:50:42 +0000 (Fri, 08 Jul 2011) Log Message: ----------- add fp for WOC due to mergeList Modified Paths: -------------- trunk/fb-contrib/samples/WOC_Sample.java Modified: trunk/fb-contrib/samples/WOC_Sample.java =================================================================== --- trunk/fb-contrib/samples/WOC_Sample.java 2011-07-07 04:25:40 UTC (rev 1700) +++ trunk/fb-contrib/samples/WOC_Sample.java 2011-07-08 18:50:42 UTC (rev 1701) @@ -17,7 +17,10 @@ private final Set<String> memberSet = new HashSet<String>(); private Set<String> fpSet; private final List<String> fpList = new ArrayList<String>(); + private final Set<String> fpMergeSet = new HashSet<String>(fpSet); + private boolean abug = true; + public void testWOCSimple() { Set<String> s = new HashSet<String>(); @@ -101,4 +104,13 @@ { return ws.fpList; } + + public void fpMergeListWOC() + { + caller(fpMergeSet, !abug); + } + + private void caller(Set<String> set, boolean b) + { + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-07 04:25:50
|
Revision: 1700 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1700&view=rev Author: dbrosius Date: 2011-07-07 04:25:40 +0000 (Thu, 07 Jul 2011) Log Message: ----------- allow for appended strings passed to a component, if the appended string looks like an html fragment Modified Paths: -------------- trunk/fb-contrib/samples/S508C_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/samples/S508C_Sample.java =================================================================== --- trunk/fb-contrib/samples/S508C_Sample.java 2011-07-05 00:44:27 UTC (rev 1699) +++ trunk/fb-contrib/samples/S508C_Sample.java 2011-07-07 04:25:40 UTC (rev 1700) @@ -40,6 +40,11 @@ { JLabel l = new JLabel(greeting + " " + user); } + + public void fpAppending(String greeting) + { + JLabel l = new JLabel("<html><body>" + greeting + "</body></html>"); + } } class MyComponent extends JComponent Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-05 00:44:27 UTC (rev 1699) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-07 04:25:40 UTC (rev 1700) @@ -25,6 +25,7 @@ import org.apache.bcel.Repository; import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.ConstantString; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.Type; @@ -256,7 +257,16 @@ } } else if ("java/lang/StringBuffer".equals(className) || "java/lang/StringBuilder".equals(className)) { if ("append".equals(methodName)) { - sawAppend = true; + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + Object con = item.getConstant(); + if (con instanceof String) { + String literal = (String)con; + sawAppend = !literal.startsWith("<"); + } else { + sawAppend = true; + } + } } else if ("toString".equals(methodName)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-05 00:44:33
|
Revision: 1699 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1699&view=rev Author: dbrosius Date: 2011-07-05 00:44:27 +0000 (Tue, 05 Jul 2011) Log Message: ----------- add S508C_APPENDED_STRING bug pattern Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/S508C_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2011-07-04 23:47:34 UTC (rev 1698) +++ trunk/fb-contrib/etc/findbugs.xml 2011-07-05 00:44:27 UTC (rev 1699) @@ -103,7 +103,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.NonRecycleableTaglibs" speed="fast" reports="NRTL_NON_RECYCLEABLE_TAG_LIB" /> <Detector class="com.mebigfatguy.fbcontrib.detect.Section508Compliance" speed="fast" - reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR,S508C_NON_TRANSLATABLE_STRING" /> + reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR,S508C_NON_TRANSLATABLE_STRING,S508C_APPENDED_STRING" /> <Detector class="com.mebigfatguy.fbcontrib.detect.UseEnumCollections" speed="fast" reports="UEC_USE_ENUM_COLLECTIONS" /> @@ -282,6 +282,7 @@ <BugPattern abbrev="S508C" type="S508C_NON_ACCESSIBLE_JCOMPONENT" category="CORRECTNESS" /> <BugPattern abbrev="S508C" type="S508C_SET_COMP_COLOR" category="CORRECTNESS" /> <BugPattern abbrev="S508C" type="S508C_NON_TRANSLATABLE_STRING" category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_APPENDED_STRING" category="CORRECTNESS" /> <BugPattern abbrev="UEC" type="UEC_USE_ENUM_COLLECTIONS" category="PERFORMANCE" /> <BugPattern abbrev="SIL" type="SIL_SQL_IN_LOOP" category="PERFORMANCE" /> <BugPattern abbrev="NMCS" type="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" category="PERFORMANCE" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2011-07-04 23:47:34 UTC (rev 1698) +++ trunk/fb-contrib/etc/messages.xml 2011-07-05 00:44:27 UTC (rev 1699) @@ -1975,6 +1975,18 @@ ]]> </Details> </BugPattern> + + <BugPattern type="S508C_APPENDED_STRING"> + <ShortDescription>Method passes appended string to title/label of component</ShortDescription> + <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 + strings through appending multiple strings together. As foreign languages may order phrases + differently, this will make translations difficult.</p> + ]]> + </Details> + </BugPattern> <BugPattern type="UEC_USE_ENUM_COLLECTIONS"> <ShortDescription>Class uses an ordinary set or map with an enum class as the key</ShortDescription> Modified: trunk/fb-contrib/samples/S508C_Sample.java =================================================================== --- trunk/fb-contrib/samples/S508C_Sample.java 2011-07-04 23:47:34 UTC (rev 1698) +++ trunk/fb-contrib/samples/S508C_Sample.java 2011-07-05 00:44:27 UTC (rev 1699) @@ -35,6 +35,11 @@ JLabel l = new JLabel("Hello"); JFrame f = new JFrame("foo"); } + + public void testAppending(String greeting, String user) + { + JLabel l = new JLabel(greeting + " " + user); + } } class MyComponent extends JComponent Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-04 23:47:34 UTC (rev 1698) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-05 00:44:27 UTC (rev 1699) @@ -49,6 +49,7 @@ { private static final String SAW_TEXT_LABEL = "SAW_TEXT_LABEL"; private static final String FROM_UIMANAGER = "FROM_UIMANAGER"; + private static final String APPENDED_STRING = "APPENDED_STRING"; private static JavaClass windowClass; private static JavaClass componentClass; @@ -204,6 +205,7 @@ public void sawOpcode(int seen) { boolean sawTextLabel = false; boolean sawUIManager = false; + boolean sawAppend = false; try { stack.mergeJumps(this); if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { @@ -252,6 +254,17 @@ } } } + } else if ("java/lang/StringBuffer".equals(className) || "java/lang/StringBuilder".equals(className)) { + if ("append".equals(methodName)) { + sawAppend = true; + } else if ("toString".equals(methodName)) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + if (APPENDED_STRING.equals(item.getUserValue())) { + sawAppend = true; + } + } + } } processSetSizeOps(methodName); @@ -264,7 +277,7 @@ } if ((seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKEINTERFACE)) { - processUntranslatableStrings(); + processFaultyGuiStrings(); } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); @@ -280,14 +293,21 @@ OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(FROM_UIMANAGER); } + } else if (sawAppend) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(APPENDED_STRING); + } } } } /** - * looks for calls to set a readable string that is generated from a static constant. + * looks for calls to set a readable string that is generated from a static constant, as these strings + * are not translatable. also looks for setting readable strings that are appended together. This is + * likely not to be internationalizable. */ - private void processUntranslatableStrings() { + private void processFaultyGuiStrings() { StringBuilder methodInfo = new StringBuilder(); methodInfo.append(getClassConstantOperand()); methodInfo.append("#"); @@ -304,6 +324,12 @@ .addClass(this) .addMethod(this) .addSourceLine(this)); + } else if (APPENDED_STRING.equals(item.getUserValue())) { + bugReporter.reportBug(new BugInstance(this, "S508C_APPENDED_STRING", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-04 23:47:40
|
Revision: 1698 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1698&view=rev Author: dbrosius Date: 2011-07-04 23:47:34 +0000 (Mon, 04 Jul 2011) Log Message: ----------- refactor sawOpcode by pulling out methods to simplify Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-04 02:41:38 UTC (rev 1697) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-04 23:47:34 UTC (rev 1698) @@ -236,20 +236,8 @@ } else if (seen == INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); - - if ("java/awt/Container".equals(className)) { - if ("setLayout".equals(methodName)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - if (item.isNull()) { - bugReporter.reportBug(new BugInstance(this, "S508C_NULL_LAYOUT", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } - } - } - } else if ("javax/swing/JLabel".equals(className)) { + + if ("javax/swing/JLabel".equals(className)) { if ("setLabelFor".equals(methodName)) { if (stack.getStackDepth() > 1) { OpcodeStack.Item item = stack.getStackItem(1); @@ -264,38 +252,11 @@ } } } - } else if ("setSize".equals(methodName)) { - int argCount = Type.getArgumentTypes(getSigConstantOperand()).length; - if ((windowClass != null) && (stack.getStackDepth() > argCount)) { - OpcodeStack.Item item = stack.getStackItem(argCount); - JavaClass cls = item.getJavaClass(); - if ((cls != null) && cls.instanceOf(windowClass)) { - bugReporter.reportBug(new BugInstance(this, "S508C_NO_SETSIZE", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } - } } - - if ("setBackground".equals(methodName) - || "setForeground".equals(methodName)) { - int argCount = Type.getArgumentTypes(getSigConstantOperand()).length; - if (stack.getStackDepth() > argCount) { - OpcodeStack.Item item = stack.getStackItem(0); - if (!FROM_UIMANAGER.equals(item.getUserValue())) { - item = stack.getStackItem(argCount); - JavaClass cls = item.getJavaClass(); - if (((jcomponentClass != null) && cls.instanceOf(jcomponentClass)) - || ((componentClass != null) && cls.instanceOf(componentClass))) { - bugReporter.reportBug(new BugInstance(this, "S508C_SET_COMP_COLOR", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } - } - } - } + + processSetSizeOps(methodName); + processNullLayouts(className, methodName); + processSetColorOps(methodName); } else if (seen == INVOKESTATIC) { if ("javax/swing/UIManager".equals(getClassConstantOperand())) { sawUIManager = true; @@ -303,25 +264,7 @@ } if ((seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKEINTERFACE)) { - StringBuilder methodInfo = new StringBuilder(); - methodInfo.append(getClassConstantOperand()); - methodInfo.append("#"); - methodInfo.append(getNameConstantOperand()); - String signature = getSigConstantOperand(); - signature = signature.substring(0, signature.indexOf(')') + 1); - methodInfo.append(signature); - Integer parmIndex = displayTextMethods.get(methodInfo.toString()); - if (parmIndex != null) { - if (stack.getStackDepth() >= parmIndex.intValue()) { - OpcodeStack.Item item = stack.getStackItem(parmIndex.intValue()); - if (item.getConstant() != null) { - bugReporter.reportBug(new BugInstance(this, "S508C_NON_TRANSLATABLE_STRING", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } - } - } + processUntranslatableStrings(); } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); @@ -340,4 +283,102 @@ } } } + + /** + * looks for calls to set a readable string that is generated from a static constant. + */ + private void processUntranslatableStrings() { + StringBuilder methodInfo = new StringBuilder(); + methodInfo.append(getClassConstantOperand()); + methodInfo.append("#"); + methodInfo.append(getNameConstantOperand()); + String signature = getSigConstantOperand(); + signature = signature.substring(0, signature.indexOf(')') + 1); + methodInfo.append(signature); + Integer parmIndex = displayTextMethods.get(methodInfo.toString()); + if (parmIndex != null) { + if (stack.getStackDepth() >= parmIndex.intValue()) { + OpcodeStack.Item item = stack.getStackItem(parmIndex.intValue()); + if (item.getConstant() != null) { + bugReporter.reportBug(new BugInstance(this, "S508C_NON_TRANSLATABLE_STRING", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } + + /** + * looks for containers where a null layout is installed + * + * @param className class that a method call is made on + * @param methodName name of the method that is called + */ + private void processNullLayouts(String className, String methodName) { + if ("java/awt/Container".equals(className)) { + if ("setLayout".equals(methodName)) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + if (item.isNull()) { + bugReporter.reportBug(new BugInstance(this, "S508C_NULL_LAYOUT", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } + } + + /** + * looks for calls to set the color of components where the color isn't from UIManager + * + * @param methodName the method that is called + * + * @throws ClassNotFoundException if the gui component class can't be found + */ + private void processSetColorOps(String methodName) throws ClassNotFoundException { + if ("setBackground".equals(methodName) + || "setForeground".equals(methodName)) { + int argCount = Type.getArgumentTypes(getSigConstantOperand()).length; + if (stack.getStackDepth() > argCount) { + OpcodeStack.Item item = stack.getStackItem(0); + if (!FROM_UIMANAGER.equals(item.getUserValue())) { + item = stack.getStackItem(argCount); + JavaClass cls = item.getJavaClass(); + if (((jcomponentClass != null) && cls.instanceOf(jcomponentClass)) + || ((componentClass != null) && cls.instanceOf(componentClass))) { + bugReporter.reportBug(new BugInstance(this, "S508C_SET_COMP_COLOR", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } + } + + /** + * looks for calls to setSize on components, rather than letting the layout manager set them + * + * @param methodName the method that was called on a component + * + * @throws ClassNotFoundException if the gui class wasn't found + */ + private void processSetSizeOps(String methodName) throws ClassNotFoundException { + if ("setSize".equals(methodName)) { + int argCount = Type.getArgumentTypes(getSigConstantOperand()).length; + if ((windowClass != null) && (stack.getStackDepth() > argCount)) { + OpcodeStack.Item item = stack.getStackItem(argCount); + JavaClass cls = item.getJavaClass(); + if ((cls != null) && cls.instanceOf(windowClass)) { + bugReporter.reportBug(new BugInstance(this, "S508C_NO_SETSIZE", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-04 02:41:45
|
Revision: 1697 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1697&view=rev Author: dbrosius Date: 2011-07-04 02:41:38 +0000 (Mon, 04 Jul 2011) Log Message: ----------- fix some fp for NIR Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2011-07-03 05:37:51 UTC (rev 1696) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2011-07-04 02:41:38 UTC (rev 1697) @@ -39,6 +39,7 @@ private LineNumberTable lnTable; private State state; private int invokePC; + private String returnType; /** * constructs a NIR detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -59,6 +60,7 @@ if (lnTable != null) { state = State.SEEN_NOTHING; invokePC = -1; + returnType = null; super.visitCode(obj); } } finally { @@ -85,6 +87,8 @@ String clsName = getClassConstantOperand(); if (!"java/lang/Object".equals(clsName) && !"java/lang/String".equals(clsName)) { + returnType = retType.getSignature(); + returnType = returnType.substring(1, returnType.length() - 1); invokePC = getPC(); state = State.SEEN_INVOKE; } @@ -95,24 +99,35 @@ case SEEN_INVOKE: if (seen == POP) state = State.SEEN_POP; - else + else { state = State.SEEN_NOTHING; + returnType = null; + } break; case SEEN_POP: - if (seen >= ACONST_NULL && seen <= DCONST_1 || seen == INVOKESTATIC) { - if (lnTable.getSourceLine(invokePC) == lnTable.getSourceLine(getPC())) { - bugReporter.reportBug(new BugInstance(this, "NIR_NEEDLESS_INSTANCE_RETRIEVAL", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } + if ((seen >= ACONST_NULL && seen <= DCONST_1) || (seen == GETFIELD)) { + state = State.SEEN_POP; + } else if ((seen == INVOKESTATIC) || (seen == GETSTATIC)) { + if (getClassConstantOperand().equals(returnType)) { + if (lnTable.getSourceLine(invokePC) == lnTable.getSourceLine(getPC())) { + bugReporter.reportBug(new BugInstance(this, "NIR_NEEDLESS_INSTANCE_RETRIEVAL", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + state = State.SEEN_NOTHING; + returnType = null; + } else { + state = State.SEEN_NOTHING; + returnType = null; } - state = State.SEEN_NOTHING; break; default: state = State.SEEN_NOTHING; + returnType = null; break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-03 05:37:57
|
Revision: 1696 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1696&view=rev Author: dbrosius Date: 2011-07-03 05:37:51 +0000 (Sun, 03 Jul 2011) Log Message: ----------- don't report S508C for colors that come from UIManager Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-02 03:48:25 UTC (rev 1695) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2011-07-03 05:37:51 UTC (rev 1696) @@ -47,6 +47,9 @@ */ public class Section508Compliance extends BytecodeScanningDetector { + private static final String SAW_TEXT_LABEL = "SAW_TEXT_LABEL"; + private static final String FROM_UIMANAGER = "FROM_UIMANAGER"; + private static JavaClass windowClass; private static JavaClass componentClass; private static JavaClass jcomponentClass; @@ -200,13 +203,14 @@ @Override public void sawOpcode(int seen) { boolean sawTextLabel = false; + boolean sawUIManager = false; try { stack.mergeJumps(this); if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); if ("Ljavax/swing/JLabel;".equals(item.getSignature()) - && (item.getUserValue() != null)) { + && (SAW_TEXT_LABEL.equals(item.getUserValue()))) { int reg = RegisterUtils.getAStoreReg(this, seen); localLabels.put(Integer.valueOf(reg), SourceLineAnnotation.fromVisitedInstruction(this)); } @@ -214,7 +218,7 @@ } else if (seen == PUTFIELD) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); - if (item.getUserValue() == null) { + if (!SAW_TEXT_LABEL.equals(item.getUserValue())) { FieldAnnotation fa = new FieldAnnotation(getDottedClassName(), getNameConstantOperand(), getSigConstantOperand(), false); fieldLabels.remove(XFactory.createXField(fa)); } @@ -278,17 +282,24 @@ || "setForeground".equals(methodName)) { int argCount = Type.getArgumentTypes(getSigConstantOperand()).length; if (stack.getStackDepth() > argCount) { - OpcodeStack.Item item = stack.getStackItem(argCount); - JavaClass cls = item.getJavaClass(); - if (((jcomponentClass != null) && cls.instanceOf(jcomponentClass)) - || ((componentClass != null) && cls.instanceOf(componentClass))) { - bugReporter.reportBug(new BugInstance(this, "S508C_SET_COMP_COLOR", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } + OpcodeStack.Item item = stack.getStackItem(0); + if (!FROM_UIMANAGER.equals(item.getUserValue())) { + item = stack.getStackItem(argCount); + JavaClass cls = item.getJavaClass(); + if (((jcomponentClass != null) && cls.instanceOf(jcomponentClass)) + || ((componentClass != null) && cls.instanceOf(componentClass))) { + bugReporter.reportBug(new BugInstance(this, "S508C_SET_COMP_COLOR", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } } } + } else if (seen == INVOKESTATIC) { + if ("javax/swing/UIManager".equals(getClassConstantOperand())) { + sawUIManager = true; + } } if ((seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKEINTERFACE)) { @@ -319,8 +330,13 @@ if (sawTextLabel) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); - item.setUserValue(Boolean.TRUE); + item.setUserValue(SAW_TEXT_LABEL); } + } else if (sawUIManager) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(FROM_UIMANAGER); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-02 03:48:31
|
Revision: 1695 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1695&view=rev Author: dbrosius Date: 2011-07-02 03:48:25 +0000 (Sat, 02 Jul 2011) Log Message: ----------- doc STB on the website Modified Paths: -------------- trunk/fb-contrib/htdocs/index.shtml Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2011-07-02 03:46:55 UTC (rev 1694) +++ trunk/fb-contrib/htdocs/index.shtml 2011-07-02 03:48:25 UTC (rev 1695) @@ -86,6 +86,11 @@ .dispose() method called on them when finished. These objects will be cleaned up by the Garbage collector, bug given the likelyhood 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.</li> + <li><b>[STB] Stacked Try Blocks</b><br/> + Looks for two or more try catch blocks that are consecutive and catch the + same kind of exception, and throw the same exception always. These blocks can + be coalesced into one. + </li> </ul> </div> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-02 03:47:01
|
Revision: 1694 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1694&view=rev Author: dbrosius Date: 2011-07-02 03:46:55 +0000 (Sat, 02 Jul 2011) Log Message: ----------- ignore STBs when the method declares throwing the same exception type as is caught Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/STB_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2011-07-02 03:46:18 UTC (rev 1693) +++ trunk/fb-contrib/etc/messages.xml 2011-07-02 03:46:55 UTC (rev 1694) @@ -3429,5 +3429,5 @@ <BugCode abbrev="SEC">Side Effect Constructor</BugCode> <BugCode abbrev="SGSU">Suspicious Getter Setter Use</BugCode> <BugCode abbrev="LGO">Lingering Graphics Object</BugCode> - <BugCode abbrev="STB">Stacked Catch Blocks</BugCode> + <BugCode abbrev="STB">Stacked Try Blocks</BugCode> </MessageCollection> Modified: trunk/fb-contrib/samples/STB_Sample.java =================================================================== --- trunk/fb-contrib/samples/STB_Sample.java 2011-07-02 03:46:18 UTC (rev 1693) +++ trunk/fb-contrib/samples/STB_Sample.java 2011-07-02 03:46:55 UTC (rev 1694) @@ -18,6 +18,20 @@ } } + public void fpTestMethodDeclaresThrownType(File f1, File f2) throws STBException, IOException { + try { + InputStream is = new FileInputStream(f1); + } catch (IOException ioe) { + throw new STBException(); + } + + try { + InputStream is = new FileInputStream(f2); + } catch (IOException ioe) { + throw new STBException(); + } + } + static class STBException extends Exception { } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2011-07-02 03:46:18 UTC (rev 1693) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2011-07-02 03:46:55 UTC (rev 1694) @@ -1,19 +1,25 @@ package com.mebigfatguy.fbcontrib.detect; import java.util.ArrayList; +import java.util.Arrays; import java.util.BitSet; +import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Set; import org.apache.bcel.Constants; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.CodeException; +import org.apache.bcel.classfile.ConstantClass; +import org.apache.bcel.classfile.ConstantPool; 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 two or more try catch blocks that are consecutive and catch the @@ -46,6 +52,11 @@ public void visitCode(Code obj) { try { + XMethod xMethod = getXMethod(); + String[] tes = xMethod.getThrownExceptions(); + Set<String> thrownExceptions = new HashSet<String>(Arrays.<String> asList((tes == null) ? new String[0] + : tes)); + blocks = new ArrayList<TryBlock>(); inBlocks = new ArrayList<TryBlock>(); @@ -64,7 +75,8 @@ Iterator<TryBlock> it = blocks.iterator(); while (it.hasNext()) { TryBlock block = it.next(); - if (block.hasMultipleHandlers() || block.isFinally()) { + if (block.hasMultipleHandlers() || block.isFinally() + || block.catchIsThrown(getConstantPool(), thrownExceptions)) { it.remove(); } } @@ -78,20 +90,12 @@ for (int i = 1; i < blocks.size(); i++) { TryBlock secondBlock = blocks.get(i); - if ((firstBlock.getCatchType() == secondBlock - .getCatchType()) - && (firstBlock.getThrowSignature() - .equals(secondBlock.getThrowSignature()))) { - bugReporter.reportBug(new BugInstance(this, - "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLineRange(this, - firstBlock.getStartPC(), - firstBlock.getEndHandlerPC()) - .addSourceLineRange(this, - secondBlock.getStartPC(), - secondBlock.getEndHandlerPC())); + if ((firstBlock.getCatchType() == secondBlock.getCatchType()) + && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature()))) { + bugReporter.reportBug(new BugInstance(this, "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY) + .addClass(this).addMethod(this) + .addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC()) + .addSourceLineRange(this, secondBlock.getStartPC(), secondBlock.getEndHandlerPC())); } @@ -136,8 +140,7 @@ if (innerBlock.inCatch()) { if (((seen >= Constants.IFEQ) && ((seen <= Constants.RET))) - || ((seen >= Constants.IRETURN) && (seen <= Constants.RETURN)) - || (seen == GOTO_W)) { + || ((seen >= Constants.IRETURN) && (seen <= Constants.RETURN)) || (seen == GOTO_W)) { blocks.remove(innerBlock); inBlocks.remove(inBlocks.size() - 1); } else if (seen == ATHROW) { @@ -212,6 +215,15 @@ return catchTypes.get(0); } + public boolean catchIsThrown(ConstantPool pool, Set<String> thrownExceptions) { + if (thrownExceptions.size() > 0) { + int exIndex = catchTypes.nextSetBit(0); + String exName = ((ConstantClass) pool.getConstant(exIndex)).getBytes(pool); + return thrownExceptions.contains(exName); + } + return false; + } + public void setEndHandlerPC(int end) { endHandlerPC = end; } @@ -221,8 +233,7 @@ } public String getThrowSignature() { - return (throwSig == null) ? String.valueOf(System - .identityHashCode(this)) : throwSig; + return (throwSig == null) ? String.valueOf(System.identityHashCode(this)) : throwSig; } public int getStartPC() { @@ -266,8 +277,7 @@ @Override public String toString() { - return "{" + startPC + " -> " + endPC + "} (catch " - + catchTypes.nextSetBit(0) + ") {" + handlerPC + " -> " + return "{" + startPC + " -> " + endPC + "} (catch " + catchTypes.nextSetBit(0) + ") {" + handlerPC + " -> " + endHandlerPC + "}"; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-07-02 03:46:24
|
Revision: 1693 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1693&view=rev Author: dbrosius Date: 2011-07-02 03:46:18 +0000 (Sat, 02 Jul 2011) Log Message: ----------- add includeantruntime=false Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2011-06-30 22:35:53 UTC (rev 1692) +++ trunk/fb-contrib/build.xml 2011-07-02 03:46:18 UTC (rev 1693) @@ -65,7 +65,7 @@ </target> <target name="compile" depends="-init" description="compiles java files"> - <javac srcdir="${src.dir}" + <javac srcdir="${src.dir}" destdir="${classes.dir}" source="${javac.source}" target="${javac.target}" @@ -82,7 +82,8 @@ source="1.5" target="1.5" deprecation="${javac.deprecation}" - debug="${javac.debug}"> + debug="${javac.debug}" + includeantruntime="false"> <classpath refid="fb-contrib.classpath"/> <classpath refid="fb-contrib.samples.classpath"/> </javac> @@ -92,7 +93,8 @@ source="1.4" target="1.4" deprecation="${javac.deprecation}" - debug="${javac.debug}"> + debug="${javac.debug}" + includeantruntime="false"> <include name="SJVU_Sample.java"/> <classpath refid="fb-contrib.classpath"/> <classpath refid="fb-contrib.samples.classpath"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-30 22:35:59
|
Revision: 1692 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1692&view=rev Author: dbrosius Date: 2011-06-30 22:35:53 +0000 (Thu, 30 Jun 2011) Log Message: ----------- fix fp, when dispose is called on a Graphics2D rather than a Graphics Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2011-06-15 05:36:19 UTC (rev 1691) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2011-06-30 22:35:53 UTC (rev 1692) @@ -35,9 +35,10 @@ /** * 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 - * the Garbage collector, bug given the likelyhood 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 + * .dispose() method called on them when finished. These objects will be cleaned + * up by the Garbage collector, bug given the likelyhood 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 */ public class LingeringGraphicsObjects extends BytecodeScanningDetector { @@ -49,7 +50,7 @@ private final BugReporter bugReporter; private OpcodeStack stack; - private Map<Integer, Integer> graphicsRegs; //reg->pc + private Map<Integer, Integer> graphicsRegs; // reg->pc public LingeringGraphicsObjects(BugReporter bugReporter) { this.bugReporter = bugReporter; @@ -74,9 +75,7 @@ super.visitCode(obj); for (Integer pc : graphicsRegs.values()) { bugReporter.reportBug(new BugInstance(this, "LGO_LINGERING_GRAPHICS_OBJECT", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this, pc.intValue())); + .addClass(this).addMethod(this).addSourceLine(this, pc.intValue())); } } @@ -103,7 +102,7 @@ case ASTORE_3: { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); - sawNewGraphicsAt = (Integer)item.getUserValue(); + sawNewGraphicsAt = (Integer) item.getUserValue(); Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)); if (sawNewGraphicsAt != null) { @@ -131,7 +130,8 @@ if (GRAPHICS_PRODUCERS.contains(methodInfo)) { sawNewGraphicsAt = Integer.valueOf(getPC()); } else { - if ("java/awt/Graphics#dispose()V".equals(methodInfo)) { + if (("java/awt/Graphics#dispose()V".equals(methodInfo)) + || ("java/awt/Graphics2D#dispose()V".equals(methodInfo))) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); graphicsRegs.remove(Integer.valueOf(item.getRegisterNumber())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2011-06-15 05:36:25
|
Revision: 1691 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1691&view=rev Author: dbrosius Date: 2011-06-15 05:36:19 +0000 (Wed, 15 Jun 2011) Log Message: ----------- ignore try/finallys, and fix NPE when there's no throw Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2011-06-15 05:04:52 UTC (rev 1690) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2011-06-15 05:36:19 UTC (rev 1691) @@ -63,7 +63,8 @@ Iterator<TryBlock> it = blocks.iterator(); while (it.hasNext()) { - if (it.next().hasMultipleHandlers()) { + TryBlock block = it.next(); + if (block.hasMultipleHandlers() || block.isFinally()) { it.remove(); } } @@ -207,6 +208,10 @@ return catchTypes.nextSetBit(bit + 1) >= 0; } + public boolean isFinally() { + return catchTypes.get(0); + } + public void setEndHandlerPC(int end) { endHandlerPC = end; } @@ -216,7 +221,8 @@ } public String getThrowSignature() { - return throwSig; + return (throwSig == null) ? String.valueOf(System + .identityHashCode(this)) : throwSig; } public int getStartPC() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |