fb-contrib-commit Mailing List for fb-contrib (Page 18)
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...> - 2009-12-27 06:51:45
|
Revision: 1416 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1416&view=rev Author: dbrosius Date: 2009-12-27 06:51:35 +0000 (Sun, 27 Dec 2009) Log Message: ----------- the nullguard map is keyed by target, so remove the entry based on the instruction after the return Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 05:53:57 UTC (rev 1415) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-27 06:51:35 UTC (rev 1416) @@ -167,7 +167,7 @@ case ARETURN: case LRETURN: case RETURN: { - nullGuards.remove(Integer.valueOf(getPC() - 3)); + nullGuards.remove(Integer.valueOf(getPC() + 1)); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-24 05:54:10
|
Revision: 1415 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1415&view=rev Author: dbrosius Date: 2009-12-24 05:53:57 +0000 (Thu, 24 Dec 2009) Log Message: ----------- fix more fps Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 05:44:36 UTC (rev 1414) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 05:53:57 UTC (rev 1415) @@ -151,6 +151,17 @@ break; case IRETURN: + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + Integer value = (Integer)item.getConstant(); + if (value != null) { + int val = value.intValue(); + if ((val == 0) || (val == 1)) + nullGuards.clear(); + } + } + //FALL_THRU + case FRETURN: case DRETURN: case ARETURN: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-24 05:44:46
|
Revision: 1414 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1414&view=rev Author: dbrosius Date: 2009-12-24 05:44:36 +0000 (Thu, 24 Dec 2009) Log Message: ----------- fix more fps Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 05:10:09 UTC (rev 1413) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 05:44:36 UTC (rev 1414) @@ -144,6 +144,7 @@ } break; + case IFNONNULL: case ATHROW: { nullGuards.clear(); } @@ -165,12 +166,6 @@ } } break; - - case IFNONNULL: { - if (!nullGuards.isEmpty()) - nullGuards.remove(nullGuards.size() - 1); - } - break; } } finally { stack.sawOpcode(this, seen); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-24 05:10:19
|
Revision: 1413 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1413&view=rev Author: dbrosius Date: 2009-12-24 05:10:09 +0000 (Thu, 24 Dec 2009) Log Message: ----------- fix some fps Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 04:54:03 UTC (rev 1412) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 05:10:09 UTC (rev 1413) @@ -24,6 +24,8 @@ import org.apache.bcel.classfile.Code; +import com.mebigfatguy.fbcontrib.utils.RegisterUtils; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -98,62 +100,116 @@ .addSourceLine(this, guard.getLocation())); } - if (seen == IFNULL) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - int reg = item.getRegisterNumber(); - Integer target = Integer.valueOf(getBranchTarget()); - if (reg >= 0) { - nullGuards.put(target, new NullGuard(reg, pc.intValue())); - } else { - XField xf = item.getXField(); - if (xf != null) { - nullGuards.put(target, new NullGuard(xf, pc.intValue())); + switch (seen) { + case IFNULL: { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + int reg = item.getRegisterNumber(); + Integer target = Integer.valueOf(getBranchTarget()); + if (reg >= 0) { + nullGuards.put(target, new NullGuard(reg, pc.intValue())); + } else { + XField xf = item.getXField(); + if (xf != null) { + nullGuards.put(target, new NullGuard(xf, pc.intValue())); + } } } } - } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { - if (nullGuards.size() > 0) { - String clsName = getClassConstantOperand(); - String methodName = getNameConstantOperand(); - if ("java/io/PrintStream".equals(clsName) && methodName.startsWith("print")) { + break; + + case ASTORE: + case ASTORE_0: + case ASTORE_1: + case ASTORE_2: + case ASTORE_3: { + removeGuardForRegister(RegisterUtils.getAStoreReg(this, seen)); + } + break; + + case PUTFIELD: { + removeGuardForField(getXField()); + } + break; + + case INVOKEVIRTUAL: + case INVOKEINTERFACE: { + if (nullGuards.size() > 0) { + String clsName = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + if ("java/io/PrintStream".equals(clsName) && methodName.startsWith("print")) { + nullGuards.clear(); + } + } + } + break; + + case ATHROW: { + nullGuards.clear(); + } + break; + + case IRETURN: + case FRETURN: + case DRETURN: + case ARETURN: + case LRETURN: + case RETURN: { + nullGuards.remove(Integer.valueOf(getPC() - 3)); + } + break; + + case GOTO: { + if (stack.getStackDepth() > 0) { nullGuards.clear(); } } - } else if (seen == ATHROW) { - nullGuards.clear(); - } else if ((seen >= IRETURN) && (seen <= RETURN)) { - nullGuards.remove(Integer.valueOf(getPC() - 3)); - } else if (seen == GOTO) { - if (stack.getStackDepth() > 0) { - nullGuards.clear(); + break; + + case IFNONNULL: { + if (!nullGuards.isEmpty()) + nullGuards.remove(nullGuards.size() - 1); } + break; } } finally { stack.sawOpcode(this, seen); if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); int reg = item.getRegisterNumber(); - XField field = item.getXField(); - Iterator<NullGuard> it = nullGuards.values().iterator(); - while (it.hasNext()) { - NullGuard guard = it.next(); - if (reg >= 0) { - if (reg == guard.getRegister()) { - it.remove(); - } - } else { - if (field != null) { - if (field.equals(guard.getField())) { - it.remove(); - } - } - } + if (reg >= 0) { + removeGuardForRegister(reg); + } else { + XField field = item.getXField(); + if (field != null) + removeGuardForField(field); } } } } + private void removeGuardForRegister(int reg) { + Iterator<NullGuard> it = nullGuards.values().iterator(); + while (it.hasNext()) { + NullGuard guard = it.next(); + if (reg == guard.getRegister()) { + it.remove(); + } + } + } + + private void removeGuardForField(XField field) { + Iterator<NullGuard> it = nullGuards.values().iterator(); + while (it.hasNext()) { + NullGuard guard = it.next(); + if (field != null) { + if (field.equals(guard.getField())) { + it.remove(); + } + } + } + } + static class NullGuard { int register; XField field; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-24 04:54:11
|
Revision: 1412 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1412&view=rev Author: dbrosius Date: 2009-12-24 04:54:03 +0000 (Thu, 24 Dec 2009) Log Message: ----------- add some fps Modified Paths: -------------- trunk/fb-contrib/samples/WNG_Sample.java Modified: trunk/fb-contrib/samples/WNG_Sample.java =================================================================== --- trunk/fb-contrib/samples/WNG_Sample.java 2009-12-24 04:05:08 UTC (rev 1411) +++ trunk/fb-contrib/samples/WNG_Sample.java 2009-12-24 04:54:03 UTC (rev 1412) @@ -28,4 +28,28 @@ boolean b = o != null; return b; } + + public boolean fpField() { + if (f1 != null) + return true; + + return false; + } + + public void fpAssert() { + assert f1 != null && f1.equals(f2); + } + + public Object fpSetNull(Object o) { + if (o != null) + o = null; + + return o; + } + + public void fpDual(Object o1, Object o2) { + if (o1 == null || o2 == null) { + throw new IllegalArgumentException("o1/o2 can not be null"); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-24 04:05:16
|
Revision: 1411 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1411&view=rev Author: dbrosius Date: 2009-12-24 04:05:08 +0000 (Thu, 24 Dec 2009) Log Message: ----------- pull out loop invariant code Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 03:52:57 UTC (rev 1410) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-24 04:05:08 UTC (rev 1411) @@ -124,21 +124,25 @@ nullGuards.clear(); } else if ((seen >= IRETURN) && (seen <= RETURN)) { nullGuards.remove(Integer.valueOf(getPC() - 3)); + } else if (seen == GOTO) { + if (stack.getStackDepth() > 0) { + nullGuards.clear(); + } } } finally { stack.sawOpcode(this, seen); if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); + int reg = item.getRegisterNumber(); + XField field = item.getXField(); Iterator<NullGuard> it = nullGuards.values().iterator(); while (it.hasNext()) { NullGuard guard = it.next(); - int reg = item.getRegisterNumber(); if (reg >= 0) { if (reg == guard.getRegister()) { it.remove(); } } else { - XField field = item.getXField(); if (field != null) { if (field.equals(guard.getField())) { it.remove(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-24 03:53:06
|
Revision: 1410 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1410&view=rev Author: dbrosius Date: 2009-12-24 03:52:57 +0000 (Thu, 24 Dec 2009) Log Message: ----------- add fps Modified Paths: -------------- trunk/fb-contrib/samples/WNG_Sample.java Modified: trunk/fb-contrib/samples/WNG_Sample.java =================================================================== --- trunk/fb-contrib/samples/WNG_Sample.java 2009-12-20 20:04:46 UTC (rev 1409) +++ trunk/fb-contrib/samples/WNG_Sample.java 2009-12-24 03:52:57 UTC (rev 1410) @@ -19,4 +19,13 @@ return null; } + + public boolean fpReturn(Object o) { + return o != null; + } + + public boolean fpAssign(Object o) { + boolean b = o != null; + return b; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 20:04:52
|
Revision: 1409 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1409&view=rev Author: dbrosius Date: 2009-12-20 20:04:46 +0000 (Sun, 20 Dec 2009) Log Message: ----------- no need to check14 anymore Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-12-20 20:02:20 UTC (rev 1408) +++ trunk/fb-contrib/build.xml 2009-12-20 20:04:46 UTC (rev 1409) @@ -156,25 +156,6 @@ </javadoc> </target> - <target name="check14" depends="jar" description="Check for 1.5 only methods"> - <mkdir dir="${basedir}/plugin"/> - <copy file="${basedir}/fb-contrib-${fb-contrib.version}.jar" todir="${basedir}/plugin"/> - - <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${lib.dir}/findbugs-ant.jar;${lib.dir}/findbugs.jar;${lib.dir}/bcel.jar;${lib.dir}/dom4j-full.jar;${lib.dir}/asm-3.0.jar;${lib.dir}/asm-tree-3.0.jar;${lib.dir}/annotations.jar;${lib.dir}/jsr305.jar"/> - - <findbugs output="xml" - home="${basedir}" - auxClasspath="${sampleslib.dir}/jsp-api.jar;${lib.dir}/findbugs.jar;${lib.dir}/bcel.jar" - visitors="SuspiciousJDKVersionUse" - reportLevel="high" - outputFile="${basedir}/plugin/findbugs.xml" - jvmargs="-Xmx800m -Dfb-contrib.sjvu.jdkhome=${jdk14.home}" - failOnError="true"> - <class location="${basedir}/fb-contrib-${fb-contrib.version}.jar"/> - </findbugs> - <!--<delete dir="${basedir}/plugin"/>--> - </target> - <target name="build" depends="clean, -init, validate_xml, compile, compile_samples, jar" description="builds the plugin jar"> </target> @@ -187,6 +168,6 @@ </copy> </target> - <target name="release" depends="build, check14, srczip, html, javadoc" description="prepares everything for a release"/> + <target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release"/> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 20:02:29
|
Revision: 1408 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1408&view=rev Author: dbrosius Date: 2009-12-20 20:02:20 +0000 (Sun, 20 Dec 2009) Log Message: ----------- WNG not ready yet Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2009-12-20 01:20:50 UTC (rev 1407) +++ trunk/fb-contrib/htdocs/index.html 2009-12-20 20:02:20 UTC (rev 1408) @@ -77,12 +77,6 @@ Looks for fields in serializable classes that are defined as both final and transient. As a transient field is not initialized when streamed, and is not initialized in a constructor, it will remain null because it is defined final.</li> - <li><b>[WNG] Wrong Null Guard</b><br/> - Looks for code that checks to see if a field or local variable is not null, - before entering a code block either an if, or while statement, and then doesn't - reference that field or local in the block of code that is guarded by the null - check. It is likely that null check is being done on the wrong variable, either - because of a copy/paste error, or a change in implementation.</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...> - 2009-12-20 01:20:58
|
Revision: 1407 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1407&view=rev Author: dbrosius Date: 2009-12-20 01:20:50 +0000 (Sun, 20 Dec 2009) Log Message: ----------- WNG not ready for prime time yet Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-12-20 00:53:53 UTC (rev 1406) +++ trunk/fb-contrib/etc/findbugs.xml 2009-12-20 01:20:50 UTC (rev 1407) @@ -314,7 +314,7 @@ speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.WrongNullGuard" - speed="fast" reports="WNG_WRONG_NULL_FIELD_GUARD,WNG_WRONG_NULL_LOCAL_GUARD" /> + speed="fast" hidden="true" reports="WNG_WRONG_NULL_FIELD_GUARD,WNG_WRONG_NULL_LOCAL_GUARD" /> <!-- BugPattern --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:54:00
|
Revision: 1406 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1406&view=rev Author: dbrosius Date: 2009-12-20 00:53:53 +0000 (Sun, 20 Dec 2009) Log Message: ----------- use the BCEL version of Type class Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2009-12-20 00:52:13 UTC (rev 1405) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2009-12-20 00:53:53 UTC (rev 1406) @@ -26,9 +26,8 @@ import java.util.Map; import org.apache.bcel.classfile.Code; +import org.apache.bcel.generic.Type; -import com.sun.org.apache.bcel.internal.generic.Type; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:52:26
|
Revision: 1405 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1405&view=rev Author: dbrosius Date: 2009-12-20 00:52:13 +0000 (Sun, 20 Dec 2009) Log Message: ----------- no longer need Integer14 with compiling with java 1.5 Modified Paths: -------------- 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/CyclomaticComplexity.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.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/ParallelLists.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.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/SillynessPotPourri.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/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.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/WrongNullGuard.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java Removed Paths: ------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/Integer14.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -29,7 +29,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -115,7 +114,7 @@ JavaClass parmClass = Repository.lookupClass(parmSignature.substring(1, parmSignature.length() - 1)); if ((parmRegs != null) && parmClass.instanceOf(returnClass)) { - possibleParmRegs.put(Integer14.valueOf(parmRegs[p]), new ParmUsage()); + possibleParmRegs.put(Integer.valueOf(parmRegs[p]), new ParmUsage()); } } } @@ -149,7 +148,7 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); int reg = item.getRegisterNumber(); - ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); + ParmUsage pu = possibleParmRegs.get(Integer.valueOf(reg)); if (pu != null) pu.setReturnPC(getPC()); } @@ -157,13 +156,13 @@ if (stack.getStackDepth() > 1) { OpcodeStack.Item item = stack.getStackItem(1); int reg = item.getRegisterNumber(); - ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); + ParmUsage pu = possibleParmRegs.get(Integer.valueOf(reg)); if (pu != null) pu.setAlteredPC(getPC()); } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { int reg = RegisterUtils.getAStoreReg(this, seen); - possibleParmRegs.remove(Integer14.valueOf(reg)); + possibleParmRegs.remove(Integer.valueOf(reg)); } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { String calledSig = getSigConstantOperand(); String calledRet = Type.getReturnType(calledSig).getSignature(); @@ -172,7 +171,7 @@ if (stack.getStackDepth() > calledObjOffset) { OpcodeStack.Item item = stack.getStackItem(calledObjOffset); int reg = item.getRegisterNumber(); - ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); + ParmUsage pu = possibleParmRegs.get(Integer.valueOf(reg)); if (pu != null) pu.setAlteredPC(getPC()); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -26,8 +26,6 @@ import org.apache.bcel.classfile.ConstantInteger; import org.apache.bcel.classfile.Method; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -133,7 +131,7 @@ //case CALOAD: usually harmless so ignore case SALOAD: if (state == SEEN_CONSTANT_0) - iConst0Looped.add(Integer14.valueOf(getPC())); + iConst0Looped.add(Integer.valueOf(getPC())); else { if (stack.getStackDepth() > 1) { OpcodeStack.Item item = stack.getStackItem(1); @@ -153,7 +151,7 @@ String methodName = getNameConstantOperand(); if ("get".equals(methodName)) { if (state == SEEN_CONSTANT_0) - iConst0Looped.add(Integer14.valueOf(getPC())); + iConst0Looped.add(Integer.valueOf(getPC())); else { bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) .addClass(this) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -25,8 +25,6 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.Method; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.Detector; @@ -114,7 +112,7 @@ && (edgeType != EdgeTypes.UNKNOWN_EDGE)) { if ((edgeType == EdgeTypes.UNHANDLED_EXCEPTION_EDGE) || (edgeType == EdgeTypes.HANDLED_EXCEPTION_EDGE)) { - Integer nodeTarget = Integer14.valueOf(e.getTarget().getLabel()); + Integer nodeTarget = Integer.valueOf(e.getTarget().getLabel()); if (!exceptionNodeTargets.contains(nodeTarget)) { exceptionNodeTargets.add(nodeTarget); branches++; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -34,7 +34,6 @@ import org.apache.bcel.classfile.LocalVariableTable; import com.mebigfatguy.fbcontrib.utils.CodeByteUtils; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -81,14 +80,14 @@ } private static final Map<String, Integer> modifyingMethods = new HashMap<String, Integer>(); static { - modifyingMethods.put("add(Ljava/lang/Object;)Z", Integer14.valueOf(1)); - modifyingMethods.put("addAll(Ljava/util/Collection;)Z", Integer14.valueOf(1)); - modifyingMethods.put("addAll(ILjava/util/Collection;)Z", Integer14.valueOf(2)); - modifyingMethods.put("clear()V", Integer14.valueOf(0)); - modifyingMethods.put("remove(I)Ljava/lang/Object;", Integer14.valueOf(1)); - modifyingMethods.put("removeAll(Ljava/util/Collection;)Z", Integer14.valueOf(1)); - modifyingMethods.put("retainAll(Ljava/util/Collection;)Z", Integer14.valueOf(1)); - modifyingMethods.put("set(ILjava/lang/Object;)Ljava/lang/Object;", Integer14.valueOf(2)); + modifyingMethods.put("add(Ljava/lang/Object;)Z", Integer.valueOf(1)); + modifyingMethods.put("addAll(Ljava/util/Collection;)Z", Integer.valueOf(1)); + modifyingMethods.put("addAll(ILjava/util/Collection;)Z", Integer.valueOf(2)); + modifyingMethods.put("clear()V", Integer.valueOf(0)); + modifyingMethods.put("remove(I)Ljava/lang/Object;", Integer.valueOf(1)); + modifyingMethods.put("removeAll(Ljava/util/Collection;)Z", Integer.valueOf(1)); + modifyingMethods.put("retainAll(Ljava/util/Collection;)Z", Integer.valueOf(1)); + modifyingMethods.put("set(ILjava/lang/Object;)Ljava/lang/Object;", Integer.valueOf(2)); } @@ -182,7 +181,7 @@ OpcodeStack.Item itm = stack.getStackItem(1); int id = findCollectionGroup(itm, true); if (id >= 0) { - Integer it = groupToIterator.get(Integer14.valueOf(id)); + Integer it = groupToIterator.get(Integer.valueOf(id)); Loop loop = loops.get(it); if (loop != null) { int pc = getPC(); @@ -217,7 +216,7 @@ OpcodeStack.Item itm = stack.getStackItem(numArgs.intValue()); int id = findCollectionGroup(itm, true); if (id >= 0) { - Integer it = groupToIterator.get(Integer14.valueOf(id)); + Integer it = groupToIterator.get(Integer.valueOf(id)); if (it != null) { Loop loop = loops.get(it); if (loop != null) { @@ -263,7 +262,7 @@ try { JavaClass cls = itm.getJavaClass(); if ((cls != null) && cls.implementationOf(iteratorClass)) { - Integer regIt = Integer14.valueOf(reg); + Integer regIt = Integer.valueOf(reg); Iterator<Integer> curIt = groupToIterator.values().iterator(); while (curIt.hasNext()) { if (curIt.next().equals(regIt)) @@ -274,7 +273,7 @@ Set<Comparable<?>> group = collectionGroups.get(id.intValue()); if (group != null) { - group.add(Integer14.valueOf(reg)); + group.add(Integer.valueOf(reg)); } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); @@ -307,10 +306,10 @@ stack.sawOpcode(this, seen); if ((groupId >= 0) && (stack.getStackDepth() > 0)) { OpcodeStack.Item itm = stack.getStackItem(0); - itm.setUserValue(Integer14.valueOf(groupId)); + itm.setUserValue(Integer.valueOf(groupId)); } - processEndOfScopes(Integer14.valueOf(getPC())); + processEndOfScopes(Integer.valueOf(getPC())); } } @@ -329,7 +328,7 @@ int reg = itm.getRegisterNumber(); if (reg >= 0) - groupElement = Integer14.valueOf(reg); + groupElement = Integer.valueOf(reg); else { XField field = itm.getXField(); if (field != null) { @@ -391,13 +390,13 @@ @SuppressWarnings("deprecation") LocalVariable lv = lvt.getLocalVariable(i); if (lv != null) { - Integer endPC = Integer14.valueOf(lv.getStartPC() + lv.getLength()); + Integer endPC = Integer.valueOf(lv.getStartPC() + lv.getLength()); Set<Integer> vars = endOfScopes.get(endPC); if (vars == null) { vars = new HashSet<Integer>(); endOfScopes.put(endPC, vars); } - vars.add(Integer14.valueOf(lv.getIndex())); + vars.add(Integer.valueOf(lv.getIndex())); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -41,7 +41,6 @@ import org.apache.bcel.classfile.LocalVariableTable; import org.apache.bcel.classfile.Method; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; @@ -134,7 +133,7 @@ try { stack.mergeJumps(this); int pc = getPC(); - CodeException ex = catchHandlerPCs.get(Integer14.valueOf(pc)); + CodeException ex = catchHandlerPCs.get(Integer.valueOf(pc)); if (ex != null) { int endPC; if ((seen == GOTO) || (seen == GOTO_W)) @@ -243,7 +242,7 @@ LinkedHashMap<Integer, CodeException> handlers = new LinkedHashMap<Integer, CodeException>(); for (CodeException ex : filteredEx) { - handlers.put(Integer14.valueOf(ex.getEndPC()), ex); + handlers.put(Integer.valueOf(ex.getEndPC()), ex); } return handlers; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -33,7 +33,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -189,7 +188,7 @@ BugInstance bi = null; for (int i = 0; i < parmCount; i++) { - if (changedParms.remove(Integer14.valueOf(i))) + if (changedParms.remove(Integer.valueOf(i))) continue; int reg; @@ -221,7 +220,7 @@ if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { int parm = getAStoreParameter(seen); if (parm >= 0) - changedParms.add(Integer14.valueOf(parm)); + changedParms.add(Integer.valueOf(parm)); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -27,7 +27,6 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; @@ -165,7 +164,7 @@ || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); - Integer reg = Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen)); + Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)); if (item.getUserValue() != null) { XMethod xm = item.getReturnValueOf(); if (xm != null) { @@ -179,7 +178,7 @@ } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { - Integer reg = Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen)); + Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)); methodPackage = toStringRegisters.get(reg); } } catch (ClassNotFoundException cnfe) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -25,7 +25,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -81,8 +80,8 @@ for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); if (isJDBCClass(sig)) { - jdbcLocals.put(Integer14.valueOf(parmRegs[t]), - Integer14.valueOf(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), parmRegs[t], 0))); + jdbcLocals.put(Integer.valueOf(parmRegs[t]), + Integer.valueOf(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), parmRegs[t], 0))); } } } @@ -134,13 +133,13 @@ OpcodeStack.Item itm = stack.getStackItem(0); if (itm.getUserValue() != null) { int reg = RegisterUtils.getAStoreReg(this, seen); - jdbcLocals.put(Integer14.valueOf(reg), Integer14.valueOf(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC()))); + jdbcLocals.put(Integer.valueOf(reg), Integer.valueOf(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC()))); } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = RegisterUtils.getALoadReg(this, seen); - if (jdbcLocals.containsKey(Integer14.valueOf(reg))) + if (jdbcLocals.containsKey(Integer.valueOf(reg))) tosIsJDBC = true; } } finally { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -29,7 +29,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -48,9 +47,9 @@ { private static Map<String, Integer> syncCtors = new HashMap<String, Integer>(); static { - syncCtors.put("java/util/Vector", Integer14.valueOf(Constants.MAJOR_1_1)); - syncCtors.put("java/util/Hashtable", Integer14.valueOf(Constants.MAJOR_1_1)); - syncCtors.put("java/lang/StringBuffer", Integer14.valueOf(Constants.MAJOR_1_5)); + syncCtors.put("java/util/Vector", Integer.valueOf(Constants.MAJOR_1_1)); + syncCtors.put("java/util/Hashtable", Integer.valueOf(Constants.MAJOR_1_1)); + syncCtors.put("java/lang/StringBuffer", Integer.valueOf(Constants.MAJOR_1_5)); } private static Set<String> syncMethods = new HashSet<String>(); static { @@ -102,7 +101,7 @@ syncRegs.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); for (int pr : parmRegs) { - syncRegs.put(Integer14.valueOf(pr), + syncRegs.put(Integer.valueOf(pr), new CollectionRegInfo(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), pr, 0))); } } @@ -144,13 +143,13 @@ if ("<init>".equals(getNameConstantOperand())) { Integer minVersion = syncCtors.get(getClassConstantOperand()); if ((minVersion != null) && (classVersion >= minVersion.intValue())) { - tosIsSyncColReg = Integer14.valueOf(-1); + tosIsSyncColReg = Integer.valueOf(-1); } } } else if (seen == INVOKESTATIC) { if ("java/util/Collections".equals(getClassConstantOperand())) { if (syncMethods.contains(getNameConstantOperand())) { - tosIsSyncColReg = Integer14.valueOf(-1); + tosIsSyncColReg = Integer.valueOf(-1); } } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { @@ -158,25 +157,25 @@ OpcodeStack.Item item = stack.getStackItem(0); int reg = RegisterUtils.getAStoreReg(this, seen); if (item.getUserValue() != null) { - if (!syncRegs.containsKey(Integer14.valueOf(reg))) { + if (!syncRegs.containsKey(Integer.valueOf(reg))) { CollectionRegInfo cri = new CollectionRegInfo(SourceLineAnnotation.fromVisitedInstruction(this), RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC())); - syncRegs.put(Integer14.valueOf(reg), cri); + syncRegs.put(Integer.valueOf(reg), cri); } } else { - CollectionRegInfo cri = syncRegs.get(Integer14.valueOf(reg)); + CollectionRegInfo cri = syncRegs.get(Integer.valueOf(reg)); if (cri == null) { cri = new CollectionRegInfo(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC())); - syncRegs.put(Integer14.valueOf(reg), cri); + syncRegs.put(Integer.valueOf(reg), cri); } cri.setIgnore(); } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = RegisterUtils.getALoadReg(this, seen); - CollectionRegInfo cri = syncRegs.get(Integer14.valueOf(reg)); + CollectionRegInfo cri = syncRegs.get(Integer.valueOf(reg)); if ((cri != null) && !cri.getIgnore()) - tosIsSyncColReg = Integer14.valueOf(reg); + tosIsSyncColReg = Integer.valueOf(reg); } else if ((seen == PUTFIELD) || (seen == ARETURN)) { 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 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -37,7 +37,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -225,7 +224,7 @@ int reg = itm.getRegisterNumber(); if (reg >= 0) { - exReg.put(Integer14.valueOf(reg), Boolean.TRUE); + exReg.put(Integer.valueOf(reg), Boolean.TRUE); } markAsValid = true; // Fixes javac generated code } @@ -266,13 +265,13 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); int reg = RegisterUtils.getAStoreReg(this, seen); - exReg.put(Integer14.valueOf(reg), (Boolean)itm.getUserValue()); + exReg.put(Integer.valueOf(reg), (Boolean)itm.getUserValue()); if ((reg == catchInfo.getRegister() && catchInfo.getFinish() == Integer.MAX_VALUE)) { it.remove(); } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { - Boolean valid = exReg.get(Integer14.valueOf(RegisterUtils.getALoadReg(this, seen))); + Boolean valid = exReg.get(Integer.valueOf(RegisterUtils.getALoadReg(this, seen))); if (valid != null) { markAsValid = valid.booleanValue(); @@ -380,7 +379,7 @@ if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); - exReg.put(Integer14.valueOf(reg), Boolean.TRUE); + exReg.put(Integer.valueOf(reg), Boolean.TRUE); LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, pc+2); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -24,8 +24,6 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.Detector; @@ -39,9 +37,9 @@ */ public class MisleadingOverloadModel extends PreorderVisitor implements Detector { - private static final Integer INSTANCE = Integer14.valueOf(0); - private static final Integer STATIC = Integer14.valueOf(1); - private static final Integer BOTH = Integer14.valueOf(2); + private static final Integer INSTANCE = Integer.valueOf(0); + private static final Integer STATIC = Integer.valueOf(1); + private static final Integer BOTH = Integer.valueOf(2); private final BugReporter bugReporter; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -29,8 +29,6 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -281,7 +279,7 @@ } else { int reg = item.getRegisterNumber(); if (reg >= 0) { - Integer register = Integer14.valueOf(reg); + Integer register = Integer.valueOf(reg); String fName = aliases.get(register); if (fName != null) { collectionFields.remove(fName); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -27,7 +27,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -45,9 +44,9 @@ */ public class NonOwnedSynchronization extends BytecodeScanningDetector { - private static final Integer OWNED = Integer14.valueOf(Integer.MAX_VALUE); - private static final Integer LOW = Integer14.valueOf(LOW_PRIORITY); - private static final Integer NORMAL = Integer14.valueOf(NORMAL_PRIORITY); + private static final Integer OWNED = Integer.valueOf(Integer.MAX_VALUE); + private static final Integer LOW = Integer.valueOf(LOW_PRIORITY); + private static final Integer NORMAL = Integer.valueOf(NORMAL_PRIORITY); private BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, Integer> regPriorities; @@ -98,9 +97,9 @@ regPriorities.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int reg : parmRegs) - regPriorities.put(Integer14.valueOf(reg), NORMAL); + regPriorities.put(Integer.valueOf(reg), NORMAL); if (!method.isStatic()) - regPriorities.put(Integer14.valueOf(0), LOW); + regPriorities.put(Integer.valueOf(0), LOW); super.visitCode(obj); } } @@ -130,7 +129,7 @@ if (getMethod().isStatic() && (reg == 0)) tosIsPriority = LOW; else { - tosIsPriority = regPriorities.get(Integer14.valueOf(reg)); + tosIsPriority = regPriorities.get(Integer.valueOf(reg)); if (tosIsPriority == null) tosIsPriority = NORMAL; } @@ -145,7 +144,7 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Integer priority = (Integer)item.getUserValue(); - regPriorities.put(Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen)), priority); + regPriorities.put(Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)), priority); } } break; @@ -164,7 +163,7 @@ } else { int reg = itm.getRegisterNumber(); if (reg > 0) - tosIsPriority = regPriorities.get(Integer14.valueOf(reg)); + tosIsPriority = regPriorities.get(Integer.valueOf(reg)); else tosIsPriority = OWNED; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -23,10 +23,10 @@ import java.util.Map; import org.apache.bcel.Constants; +import org.apache.bcel.Repository; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; -import org.apache.bcel.Repository; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -26,7 +26,6 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -137,22 +136,22 @@ if ("org/w3c/dom/Document".equals(className)) { if (domCreationMethods.contains(methodInfo)) { sawCreate = true; - itemPC = Integer14.valueOf(getPC()); + itemPC = Integer.valueOf(getPC()); } } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && seen <= ASTORE_3)) { Integer pc = findDOMNodeCreationPoint(0); int reg = RegisterUtils.getAStoreReg(this, seen); if (pc != null) - nodeStores.put(Integer14.valueOf(reg), pc); + nodeStores.put(Integer.valueOf(reg), pc); else - nodeStores.remove(Integer14.valueOf(reg)); + nodeStores.remove(Integer.valueOf(reg)); } else if (seen == PUTFIELD) { //Stores to member variables are assumed ok findDOMNodeCreationPoint(0); } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = RegisterUtils.getALoadReg(this, seen); - itemPC = nodeStores.get(Integer14.valueOf(reg)); + itemPC = nodeStores.get(Integer.valueOf(reg)); if (itemPC != null) sawCreate = true; } else if (seen == ARETURN) { @@ -160,7 +159,7 @@ OpcodeStack.Item itm = stack.getStackItem(0); int reg = itm.getRegisterNumber(); nodeCreations.remove(itm); - nodeStores.remove(Integer14.valueOf(reg)); + nodeStores.remove(Integer.valueOf(reg)); } } @@ -177,7 +176,7 @@ if (nodeCreations.containsKey(itm)) { int reg = itm.getRegisterNumber(); nodeCreations.remove(itm); - nodeStores.remove(Integer14.valueOf(reg)); + nodeStores.remove(Integer.valueOf(reg)); } } if ((seen != INVOKESTATIC) && (stack.getStackDepth() > argCount)) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -37,7 +37,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -203,7 +202,7 @@ if (!methodIsStatic) parm--; if ((parm >= 0) && (parm < parmCount)) - parameterDefiners.remove(Integer14.valueOf(reg)); + parameterDefiners.remove(Integer.valueOf(reg)); } else { parameterDefiners.clear(); } @@ -216,7 +215,7 @@ if (!methodIsStatic) parm--; if ((parm >= 0) && (parm < parmCount)) - parameterDefiners.remove(Integer14.valueOf(reg)); + parameterDefiners.remove(Integer.valueOf(reg)); } else { parameterDefiners.clear(); } @@ -229,7 +228,7 @@ if (!methodIsStatic) parm--; if ((parm >= 0) && (parm < parmCount)) - usedParameters.add(Integer14.valueOf(reg)); + usedParameters.add(Integer.valueOf(reg)); } else if (seen == AASTORE) { //Don't check parameters that are stored in if (stack.getStackDepth() >= 3) { @@ -239,7 +238,7 @@ if (!methodIsStatic) parm--; if ((parm >= 0) && (parm < parmCount)) - parameterDefiners.remove(Integer14.valueOf(reg)); + parameterDefiners.remove(Integer.valueOf(reg)); } else { parameterDefiners.clear(); } @@ -319,7 +318,7 @@ Map<JavaClass, List<MethodInfo>> definers = getClassDefiners(cls); if (definers.size() > 0) { - parameterDefiners.put( Integer14.valueOf(i + (methodIsStatic ? 0 : 1)), definers ); + parameterDefiners.put( Integer.valueOf(i + (methodIsStatic ? 0 : 1)), definers ); hasPossiblyOverlyConcreteParm = true; } } @@ -371,7 +370,7 @@ private void removeUselessDefiners(final int reg) { - Map<JavaClass, List<MethodInfo>> definers = parameterDefiners.get(Integer14.valueOf(reg)); + Map<JavaClass, List<MethodInfo>> definers = parameterDefiners.get(Integer.valueOf(reg)); if ((definers != null) && (definers.size() > 0)) { String methodSig = getSigConstantOperand(); String methodName = getNameConstantOperand(); @@ -401,7 +400,7 @@ it.remove(); } if (definers.isEmpty()) { - parameterDefiners.remove(Integer14.valueOf(reg)); + parameterDefiners.remove(Integer.valueOf(reg)); } } } @@ -452,11 +451,11 @@ if (parmSig.startsWith("L")) { parmSig = parmSig.substring( 1, parmSig.length() - 1).replace('/', '.'); if ("java.lang.Object".equals(parmSig)) { - parameterDefiners.remove(Integer14.valueOf(reg)); + parameterDefiners.remove(Integer.valueOf(reg)); return; } - Map<JavaClass, List<MethodInfo>> definers = parameterDefiners.get(Integer14.valueOf(reg)); + Map<JavaClass, List<MethodInfo>> definers = parameterDefiners.get(Integer.valueOf(reg)); if ((definers != null) && (definers.size() > 0)) { Iterator<JavaClass> it = definers.keySet().iterator(); while (it.hasNext()) { @@ -466,7 +465,7 @@ } if (definers.isEmpty()) - parameterDefiners.remove(Integer14.valueOf(reg)); + parameterDefiners.remove(Integer.valueOf(reg)); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -27,8 +27,6 @@ import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.JavaClass; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -111,7 +109,7 @@ indexToFieldMap.clear(); } else if ((seen == ISTORE) || (seen == IINC) || ((seen >= ISTORE_0) && (seen <= ISTORE_3))) { int reg = getIntOpRegister(seen); - indexToFieldMap.remove(Integer14.valueOf(reg)); + indexToFieldMap.remove(Integer.valueOf(reg)); } else if ((seen >= IALOAD) && (seen <= SALOAD)) { checkParms(); } @@ -136,7 +134,7 @@ if ((indexReg >= 0) && (field != null)) { if (listFields.contains(field.getName())) { - String f = indexToFieldMap.get(Integer14.valueOf(indexReg)); + String f = indexToFieldMap.get(Integer.valueOf(indexReg)); if ((f != null) && (!f.equals(field.getName()))) { bugReporter.reportBug( new BugInstance( this, "PL_PARALLEL_LISTS", NORMAL_PRIORITY) .addClass(this) @@ -146,7 +144,7 @@ indexToFieldMap.clear(); } else - indexToFieldMap.put(Integer14.valueOf(indexReg), field.getName()); + indexToFieldMap.put(Integer.valueOf(indexReg), field.getName()); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -28,7 +28,6 @@ import org.apache.bcel.classfile.LocalVariableTable; import org.apache.bcel.classfile.Method; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; @@ -115,7 +114,7 @@ case SAW_NOTHING: if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { loadedReg = RegisterUtils.getALoadReg(this, seen); - parmSig = parmSigs.get(Integer14.valueOf(loadedReg)); + parmSig = parmSigs.get(Integer.valueOf(loadedReg)); if (parmSig != null) { parmSig = parmSig.substring(1, parmSig.length() - 1); state = SAW_LOAD; @@ -132,7 +131,7 @@ } } else if (seen == INSTANCEOF) { // probably an if guard... assume the code is reasonable - parmSigs.remove(Integer14.valueOf(loadedReg)); + parmSigs.remove(Integer.valueOf(loadedReg)); } state = SAW_NOTHING; break; @@ -156,7 +155,7 @@ .addMethod(this) .addSourceLine(this) .addString(parmName); - Integer lr = Integer14.valueOf(loadedReg); + Integer lr = Integer.valueOf(loadedReg); BugInfo bi = bugs.get(lr); if (bi == null) { bugs.put(lr, new BugInfo(castClass, bug)); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -30,7 +30,6 @@ import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.collect.Statistics; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -156,7 +155,7 @@ branchTargets.clear(); CodeException[] codeExceptions = obj.getExceptionTable(); for (CodeException codeEx : codeExceptions) { - branchTargets.add(Integer14.valueOf(codeEx.getHandlerPC())); + branchTargets.add(Integer.valueOf(codeEx.getHandlerPC())); } super.visitCode(obj); } @@ -171,21 +170,21 @@ public void sawOpcode(int seen) { try { stack.mergeJumps(this); - if (branchTargets.remove(Integer14.valueOf(getPC()))) { + if (branchTargets.remove(Integer.valueOf(getPC()))) { localMethodCalls.clear(); fieldMethodCalls.clear(); } if (((seen >= IFEQ) && (seen <= GOTO)) || ((seen >= IFNULL) && (seen <= GOTO_W))) { - branchTargets.add(Integer14.valueOf(getBranchTarget())); + branchTargets.add(Integer.valueOf(getBranchTarget())); } else if ((seen == TABLESWITCH) || (seen == LOOKUPSWITCH)) { int[] offsets = getSwitchOffsets(); int pc = getPC(); for (int offset : offsets) { - branchTargets.add(Integer14.valueOf(offset + pc)); + branchTargets.add(Integer.valueOf(offset + pc)); } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { - localMethodCalls.remove(Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen))); + localMethodCalls.remove(Integer.valueOf(RegisterUtils.getAStoreReg(this, seen))); } else if (seen == PUTFIELD) { fieldMethodCalls.remove(getNameConstantOperand()); } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { @@ -207,7 +206,7 @@ MethodCall mc; if (reg >= 0) { - mc = localMethodCalls.get(Integer14.valueOf(reg)); + mc = localMethodCalls.get(Integer.valueOf(reg)); } else if (field != null) { mc = fieldMethodCalls.get(field.getName()); } else @@ -235,13 +234,13 @@ } } if (reg >= 0) { - localMethodCalls.remove(Integer14.valueOf(reg)); + localMethodCalls.remove(Integer.valueOf(reg)); } else { fieldMethodCalls.remove(field.getName()); } } else { if (reg >= 0) { - localMethodCalls.put(Integer14.valueOf(reg), new MethodCall(methodName, signature, parmConstants)); + localMethodCalls.put(Integer.valueOf(reg), new MethodCall(methodName, signature, parmConstants)); } else if (field != null) { fieldMethodCalls.put(field.getName(), new MethodCall(methodName, signature, parmConstants)); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -25,8 +25,6 @@ import org.apache.bcel.classfile.Code; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -115,7 +113,7 @@ String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) - queryLocations.add(Integer14.valueOf(getPC())); + queryLocations.add(Integer.valueOf(getPC())); } else if ((seen == GOTO) || (seen == GOTO_W)) { int branchTarget = getBranchTarget(); int pc = getPC(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -29,7 +29,6 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -177,7 +176,7 @@ if ("Ljavax/swing/JLabel;".equals(item.getSignature()) && (item.getUserValue() != null)) { int reg = RegisterUtils.getAStoreReg(this, seen); - localLabels.put(Integer14.valueOf(reg), SourceLineAnnotation.fromVisitedInstruction(this)); + localLabels.put(Integer.valueOf(reg), SourceLineAnnotation.fromVisitedInstruction(this)); } } } else if (seen == PUTFIELD) { @@ -224,7 +223,7 @@ } else { int reg = item.getRegisterNumber(); if (reg >= 0) { - localLabels.remove(Integer14.valueOf(reg)); + localLabels.remove(Integer.valueOf(reg)); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -38,7 +38,6 @@ import org.apache.bcel.classfile.LocalVariableTable; import com.mebigfatguy.fbcontrib.utils.CodeByteUtils; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -145,14 +144,14 @@ stack.mergeJumps(this); if (((seen >= IFEQ) && (seen <= GOTO)) || (seen == IFNULL) || (seen == IFNONNULL) || (seen == GOTO_W)) { - Integer branchTarget = Integer14.valueOf(getBranchTarget()); + Integer branchTarget = Integer.valueOf(getBranchTarget()); Set<Integer> branchInsSet = branchTargets.get(branchTarget); if (branchInsSet == null) { branchInsSet = new HashSet<Integer>(); branchTargets.put(branchTarget, branchInsSet); } - branchInsSet.add(Integer14.valueOf(getPC())); + branchInsSet.add(Integer.valueOf(getPC())); } if ((seen == IFEQ) || (seen == IFLE) || (seen == IFNE)) { @@ -274,12 +273,12 @@ && ((0x00FF & bytes[lastPCs[0]]) == IFEQ)) { if (getMethod().getSignature().endsWith("Z")) { boolean bug = true; - Set<Integer> branchInsSet = branchTargets.get(Integer14.valueOf(lastPCs[1])); + Set<Integer> branchInsSet = branchTargets.get(Integer.valueOf(lastPCs[1])); if (branchInsSet != null) { bug = false; } - branchInsSet = branchTargets.get(Integer14.valueOf(lastPCs[3])); + branchInsSet = branchTargets.get(Integer.valueOf(lastPCs[3])); if ((branchInsSet != null) && branchInsSet.size() > 1) { bug = false; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -27,8 +27,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -47,12 +45,12 @@ try { cloneableClass = Repository.lookupClass("java/lang/Cloneable"); changingMethods = new HashMap<String, Integer>(); - changingMethods.put("add", Integer14.valueOf(NORMAL_PRIORITY)); - changingMethods.put("addAll", Integer14.valueOf(NORMAL_PRIORITY)); - changingMethods.put("put", Integer14.valueOf(NORMAL_PRIORITY)); - changingMethods.put("putAll", Integer14.valueOf(NORMAL_PRIORITY)); - changingMethods.put("insert", Integer14.valueOf(LOW_PRIORITY)); - changingMethods.put("set", Integer14.valueOf(LOW_PRIORITY)); + changingMethods.put("add", Integer.valueOf(NORMAL_PRIORITY)); + changingMethods.put("addAll", Integer.valueOf(NORMAL_PRIORITY)); + changingMethods.put("put", Integer.valueOf(NORMAL_PRIORITY)); + changingMethods.put("putAll", Integer.valueOf(NORMAL_PRIORITY)); + changingMethods.put("insert", Integer.valueOf(LOW_PRIORITY)); + changingMethods.put("set", Integer.valueOf(LOW_PRIORITY)); } catch (ClassNotFoundException cnfe) { cloneableClass = null; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -26,7 +26,6 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -112,14 +111,14 @@ } } else if (((seen >= ALOAD_0) && (seen <= ALOAD_3)) || (seen == ALOAD)) { int reg = RegisterUtils.getALoadReg(this, seen); - attributeName = savedAttributes.get(Integer14.valueOf(reg)); + attributeName = savedAttributes.get(Integer.valueOf(reg)); sawGetAttribute = attributeName != null; } else if (((seen >= ASTORE_0) && (seen <= ASTORE_3)) || (seen == ASTORE)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); attributeName = (String)item.getUserValue(); int reg = RegisterUtils.getAStoreReg(this, seen); - savedAttributes.put(Integer14.valueOf(reg), attributeName); + savedAttributes.put(Integer.valueOf(reg), attributeName); } } @@ -133,7 +132,7 @@ OpcodeStack.Item item = stack.getStackItem(numArgs); attributeName = (String)item.getUserValue(); if (attributeName != null) { - changedAttributes.put(attributeName, Integer14.valueOf(getPC())); + changedAttributes.put(attributeName, Integer.valueOf(getPC())); } } } @@ -142,7 +141,7 @@ OpcodeStack.Item item = stack.getStackItem(2); attributeName = (String)item.getUserValue(); if (attributeName != null) { - changedAttributes.put(attributeName, Integer14.valueOf(getPC())); + changedAttributes.put(attributeName, Integer.valueOf(getPC())); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -40,8 +40,6 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -51,21 +49,21 @@ { private static final Map<Integer, String> verRegEx = new HashMap<Integer, String>(); static { - verRegEx.put(Integer14.valueOf(Constants.MAJOR_1_1), "(jdk|j2?re)1.1"); - verRegEx.put(Integer14.valueOf(Constants.MAJOR_1_2), "(jdk|j2?re)1.2"); - verRegEx.put(Integer14.valueOf(Constants.MAJOR_1_3), "(jdk|j2?re)1.3"); - verRegEx.put(Integer14.valueOf(Constants.MAJOR_1_4), "(jdk|j2?re)1.4"); - verRegEx.put(Integer14.valueOf(Constants.MAJOR_1_5), "(jdk|j2?re)1.5"); - verRegEx.put(Integer14.valueOf(50), "(jdk|j2?re)1.6"); + verRegEx.put(Integer.valueOf(Constants.MAJOR_1_1), "(jdk|j2?re)1.1"); + verRegEx.put(Integer.valueOf(Constants.MAJOR_1_2), "(jdk|j2?re)1.2"); + verRegEx.put(Integer.valueOf(Constants.MAJOR_1_3), "(jdk|j2?re)1.3"); + verRegEx.put(Integer.valueOf(Constants.MAJOR_1_4), "(jdk|j2?re)1.4"); + verRegEx.put(Integer.valueOf(Constants.MAJOR_1_5), "(jdk|j2?re)1.5"); + verRegEx.put(Integer.valueOf(50), "(jdk|j2?re)1.6"); } private static final Map<Integer, String> versionStrings = new HashMap<Integer, String>(); static { - versionStrings.put(Integer14.valueOf(Constants.MAJOR_1_1), "JDK 1.1"); - versionStrings.put(Integer14.valueOf(Constants.MAJOR_1_2), "JDK 1.2"); - versionStrings.put(Integer14.valueOf(Constants.MAJOR_1_3), "JDK 1.3"); - versionStrings.put(Integer14.valueOf(Constants.MAJOR_1_4), "JDK 1.4"); - versionStrings.put(Integer14.valueOf(Constants.MAJOR_1_5), "JDK 1.5"); - versionStrings.put(Integer14.valueOf(50), "JDK 1.6"); + versionStrings.put(Integer.valueOf(Constants.MAJOR_1_1), "JDK 1.1"); + versionStrings.put(Integer.valueOf(Constants.MAJOR_1_2), "JDK 1.2"); + versionStrings.put(Integer.valueOf(Constants.MAJOR_1_3), "JDK 1.3"); + versionStrings.put(Integer.valueOf(Constants.MAJOR_1_4), "JDK 1.4"); + versionStrings.put(Integer.valueOf(Constants.MAJOR_1_5), "JDK 1.5"); + versionStrings.put(Integer.valueOf(50), "JDK 1.6"); } private static final Pattern jarPattern = Pattern.compile("jar:file:/*([^!]*)"); private static final String SJVU_JDKHOME = "fb-contrib.sjvu.jdkhome"; @@ -90,7 +88,7 @@ public void visitClassContext(ClassContext classContext) { try { cls = classContext.getJavaClass(); - clsMajorVersion = Integer14.valueOf(cls.getMajor()); + clsMajorVersion = Integer.valueOf(cls.getMajor()); File rtJar = getRTJarFile(); if (rtJar == null) rtJar = getRTJarFromProperty(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -23,7 +23,6 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; @@ -167,7 +166,7 @@ if (stack.getStackDepth() >= 2) { OpcodeStack.Item item = stack.getStackItem(1); if (UNINIT_ARRAY.equals(item.getUserValue())) { - userValue = Integer14.valueOf(item.getRegisterNumber()); + userValue = Integer.valueOf(item.getRegisterNumber()); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -27,8 +27,6 @@ import org.apache.bcel.classfile.ConstantFieldref; import org.apache.bcel.classfile.ConstantNameAndType; -import com.mebigfatguy.fbcontrib.utils.Integer14; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -119,14 +117,14 @@ } } else if (seen == ALOAD) { int reg = getRegisterOperand(); - if (localCollections.contains(Integer14.valueOf(reg))) { - collectionInfo = Integer14.valueOf(reg); + if (localCollections.contains(Integer.valueOf(reg))) { + collectionInfo = Integer.valueOf(reg); state = SEEN_LOAD; } } else if ((seen >= ALOAD_0) && (seen <= ALOAD_3)) { int reg = seen - ALOAD_0; - if (localCollections.contains(Integer14.valueOf(reg))) { - collectionInfo = Integer14.valueOf(reg); + if (localCollections.contains(Integer.valueOf(reg))) { + collectionInfo = Integer.valueOf(reg); state = SEEN_LOAD; } } else if (seen == GETFIELD) { @@ -144,10 +142,10 @@ case SEEN_SYNC: if (seen == ASTORE) { int reg = getRegisterOperand(); - localCollections.add(Integer14.valueOf(reg)); + localCollections.add(Integer.valueOf(reg)); } else if ((seen >= ASTORE_0) && (seen <= ASTORE_3)) { int reg = seen - ASTORE_0; - localCollections.add(Integer14.valueOf(reg)); + localCollections.add(Integer.valueOf(reg)); } else if (seen == PUTFIELD) { ConstantFieldref ref = (ConstantFieldref)getConstantRefOperand(); @@ -200,7 +198,7 @@ OpcodeStack.Item item = stack.getStackItem(0); int reg = item.getRegisterNumber(); if (reg >= 0) - monitorObjects.add(Integer14.valueOf(reg)); + monitorObjects.add(Integer.valueOf(reg)); else { XField field = item.getXField(); if (field != null) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2009-12-20 00:42:19 UTC (rev 1404) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2009-12-20 00:52:13 UTC (rev 1405) @@ -27,7 +27,6 @@ import org.apache.bcel.classfile.CodeException; import com.mebigfatguy.fbcontrib.utils.AttributesUtils; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfat... [truncated message content] |
From: <dbr...@us...> - 2009-12-20 00:43:27
|
Revision: 1399 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1399&view=rev Author: dbrosius Date: 2009-12-20 00:16:30 +0000 (Sun, 20 Dec 2009) Log Message: ----------- report WNG for fields as LOW_PRIORITY Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-20 00:09:04 UTC (rev 1398) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-20 00:16:30 UTC (rev 1399) @@ -94,7 +94,7 @@ NullGuard guard = nullGuards.remove(pc); if (guard != null) { boolean localBug = guard.getRegister() >= 0; - bugReporter.reportBug(new BugInstance(this, localBug ? "WNG_WRONG_NULL_LOCAL_GUARD" : "WNG_WRONG_NULL_FIELD_GUARD", NORMAL_PRIORITY) + bugReporter.reportBug(new BugInstance(this, localBug ? "WNG_WRONG_NULL_LOCAL_GUARD" : "WNG_WRONG_NULL_FIELD_GUARD", localBug ? NORMAL_PRIORITY : LOW_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this, guard.getLocation())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:43:21
|
Revision: 1396 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1396&view=rev Author: dbrosius Date: 2009-12-19 23:35:21 +0000 (Sat, 19 Dec 2009) Log Message: ----------- add HttpSession attribute samples Modified Paths: -------------- trunk/fb-contrib/samples/IKNC_Sample.java Modified: trunk/fb-contrib/samples/IKNC_Sample.java =================================================================== --- trunk/fb-contrib/samples/IKNC_Sample.java 2009-12-19 23:34:51 UTC (rev 1395) +++ trunk/fb-contrib/samples/IKNC_Sample.java 2009-12-19 23:35:21 UTC (rev 1396) @@ -1,6 +1,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; @SuppressWarnings("all") public class IKNC_Sample @@ -14,4 +15,12 @@ { String id = req.getParameter("ID"); } + + public Object getScore1(HttpSession session) { + return session.getAttribute("score"); + } + + public void putScore(HttpSession session) { + session.setAttribute("Score", null); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:42:29
|
Revision: 1404 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1404&view=rev Author: dbrosius Date: 2009-12-20 00:42:19 +0000 (Sun, 20 Dec 2009) Log Message: ----------- no need for Integer14 anymore Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2009-12-20 00:41:53 UTC (rev 1403) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2009-12-20 00:42:19 UTC (rev 1404) @@ -32,7 +32,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; import edu.umd.cs.findbugs.BugInstance; @@ -291,13 +290,13 @@ private void addLineNumber(Set<Integer> lineNumbers) { LineNumberTable lnt = getCode().getLineNumberTable(); if (lnt == null) { - lineNumbers.add(Integer14.valueOf(-lineNumbers.size())); + lineNumbers.add(Integer.valueOf(-lineNumbers.size())); } else { int line = lnt.getSourceLine(getPC()); if (line < 0) { - lineNumbers.add(Integer14.valueOf(lineNumbers.size())); + lineNumbers.add(Integer.valueOf(lineNumbers.size())); } else { - lineNumbers.add(Integer14.valueOf(line)); + lineNumbers.add(Integer.valueOf(line)); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:42:01
|
Revision: 1403 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1403&view=rev Author: dbrosius Date: 2009-12-20 00:41:53 +0000 (Sun, 20 Dec 2009) Log Message: ----------- no need for Integer14 anymore Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2009-12-20 00:40:49 UTC (rev 1402) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2009-12-20 00:41:53 UTC (rev 1403) @@ -29,7 +29,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -105,7 +104,7 @@ syncPC = -1; isStatic = m.isStatic(); unsafeAliases.clear(); - unsafeAliases.add(Integer14.valueOf(0)); + unsafeAliases.add(Integer.valueOf(0)); branchInfo.clear(); unsafeCallOccurred = false; stack.resetForMethodEntry(this); @@ -126,7 +125,7 @@ if (unsafeCallOccurred && ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3)))) { int storeReg = RegisterUtils.getAStoreReg(this, seen); if (storeReg >= 0) - unsafeAliases.add(Integer14.valueOf(storeReg)); + unsafeAliases.add(Integer.valueOf(storeReg)); } if ((seen == INVOKEVIRTUAL) @@ -138,7 +137,7 @@ int parmCount = Type.getArgumentTypes(methodSig).length; if (stack.getStackDepth() > parmCount) { OpcodeStack.Item itm = stack.getStackItem(parmCount); - unsafeCallOccurred = unsafeAliases.contains(Integer14.valueOf(itm.getRegisterNumber())); + unsafeCallOccurred = unsafeAliases.contains(Integer.valueOf(itm.getRegisterNumber())); } else unsafeCallOccurred = false; } else @@ -147,8 +146,8 @@ unsafeCallOccurred = (getDottedClassConstantOperand().equals(this.getClassContext().getJavaClass().getClassName())); else if (((seen >= IFEQ) && (seen <= GOTO)) || (seen == GOTO_W)) { - Integer from = Integer14.valueOf(getPC()); - Integer to = Integer14.valueOf(getBranchTarget()); + Integer from = Integer.valueOf(getPC()); + Integer to = Integer.valueOf(getBranchTarget()); branchInfo.put(from, to); unsafeCallOccurred = false; } @@ -162,7 +161,7 @@ OpcodeStack.Item itm = stack.getStackItem(0); int monitorReg = itm.getRegisterNumber(); if (monitorReg >= 0) { - unsafeAliases.add(Integer14.valueOf(monitorReg)); + unsafeAliases.add(Integer.valueOf(monitorReg)); } } } @@ -175,7 +174,7 @@ unsafe |= ((seen == PUTFIELD) || (seen == GETFIELD) || (seen == GETSTATIC) || (seen == PUTSTATIC)); unsafe |= (!isStatic) && ((seen == ALOAD_0) || (seen == ASTORE_0)); int aloadReg = RegisterUtils.getALoadReg(this, seen); - unsafe |= (aloadReg >= 0) && unsafeAliases.contains(Integer14.valueOf(aloadReg)); + unsafe |= (aloadReg >= 0) && unsafeAliases.contains(Integer.valueOf(aloadReg)); if (unsafe) { //If a branch exists in the safe code, make sure the entire branch //is in the safe code, otherwise trim before the branch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:40:57
|
Revision: 1402 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1402&view=rev Author: dbrosius Date: 2009-12-20 00:40:49 +0000 (Sun, 20 Dec 2009) Log Message: ----------- no need for Integer14 anymore 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 2009-12-20 00:39:13 UTC (rev 1401) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2009-12-20 00:40:49 UTC (rev 1402) @@ -31,7 +31,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -104,12 +103,12 @@ Method method = getMethod(); if (!method.isStatic()) { - ignoreRegs.add(Integer14.valueOf(0)); + ignoreRegs.add(Integer.valueOf(0)); } int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int parm : parmRegs) { - ignoreRegs.add(Integer14.valueOf(parm)); + ignoreRegs.add(Integer.valueOf(parm)); } rootScopeBlock = new ScopeBlock(0, obj.getLength()); @@ -117,7 +116,7 @@ CodeException[] exceptions = obj.getExceptionTable(); if (exceptions != null) { for (CodeException ex : exceptions) { - catchHandlers.add(Integer14.valueOf(ex.getHandlerPC())); + catchHandlers.add(Integer.valueOf(ex.getHandlerPC())); } } @@ -159,9 +158,9 @@ || ((seen >= FSTORE_0) && (seen <= FSTORE_1)) || ((seen >= DSTORE_0) && (seen <= DSTORE_1))) { int reg = RegisterUtils.getStoreReg(this, seen); - Integer iReg = Integer14.valueOf(reg); + Integer iReg = Integer.valueOf(reg); int pc = getPC(); - if (catchHandlers.contains(Integer14.valueOf(pc))) + if (catchHandlers.contains(Integer.valueOf(pc))) { ignoreRegs.add(iReg); } @@ -194,7 +193,7 @@ } } else if (seen == IINC) { int reg = getRegisterOperand(); - Integer iReg = Integer14.valueOf(reg); + Integer iReg = Integer.valueOf(reg); if (!ignoreRegs.contains(iReg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, getPC()); if (sb != null) @@ -207,7 +206,7 @@ } } int pc = getPC(); - if (catchHandlers.contains(Integer14.valueOf(pc))) + if (catchHandlers.contains(Integer.valueOf(pc))) { ignoreRegs.add(iReg); } @@ -245,7 +244,7 @@ || ((seen >= FLOAD_0) && (seen <= FLOAD_1)) || ((seen >= DLOAD_0) && (seen <= DLOAD_1))) { int reg = RegisterUtils.getLoadReg(this, seen); - if (!ignoreRegs.contains(Integer14.valueOf(reg))) { + if (!ignoreRegs.contains(Integer.valueOf(reg))) { ScopeBlock sb = findScopeBlock(rootScopeBlock, getPC()); if (sb != null) { @@ -253,14 +252,14 @@ } else { - ignoreRegs.add(Integer14.valueOf(reg)); + ignoreRegs.add(Integer.valueOf(reg)); } } } else if (((seen >= IFEQ) && (seen <= GOTO)) || (seen == GOTO_W)) { int target = getBranchTarget(); if (target > getPC()) { if ((seen == GOTO) || (seen == GOTO_W)) { - Integer nextPC = Integer14.valueOf(getNextPC()); + Integer nextPC = Integer.valueOf(getNextPC()); if (!switchTargets.contains(nextPC)) { ScopeBlock sb = findScopeBlockWithTarget(rootScopeBlock, getPC(), getNextPC()); if (sb == null) { @@ -309,9 +308,9 @@ List<Integer> targets = new ArrayList<Integer>(); for (int offset : offsets) { - targets.add(Integer14.valueOf(offset + pc)); + targets.add(Integer.valueOf(offset + pc)); } - Integer defOffset = Integer14.valueOf(getDefaultSwitchOffset() + pc); + Integer defOffset = Integer.valueOf(getDefaultSwitchOffset() + pc); if (!targets.contains(defOffset)) { targets.add(defOffset); @@ -343,7 +342,7 @@ } } else if (seen == MONITORENTER) { - monitorSyncPCs.add(Integer14.valueOf(getPC())); + monitorSyncPCs.add(Integer.valueOf(getPC())); } else if (seen == MONITOREXIT) { if (monitorSyncPCs.size() > 0) { @@ -386,7 +385,7 @@ int reg = caller.getRegisterNumber(); if (reg >= 0) { - return Integer14.valueOf(reg); + return Integer.valueOf(reg); } /* We ignore the possibility of two fields with the same name in different classes */ @@ -581,12 +580,12 @@ stores = new HashMap<Integer, Integer>(); } - stores.put(Integer14.valueOf(reg), Integer14.valueOf(pc)); + stores.put(Integer.valueOf(reg), Integer.valueOf(pc)); if (assocs == null) { assocs = new HashMap<Object, Integer>(); } - assocs.put(assocObject, Integer14.valueOf(reg)); + assocs.put(assocObject, Integer.valueOf(reg)); } /** @@ -620,7 +619,7 @@ loads = new HashMap<Integer, Integer>(); } - loads.put(Integer14.valueOf(reg), Integer14.valueOf(pc)); + loads.put(Integer.valueOf(reg), Integer.valueOf(pc)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:39:23
|
Revision: 1401 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1401&view=rev Author: dbrosius Date: 2009-12-20 00:39:13 +0000 (Sun, 20 Dec 2009) Log Message: ----------- no need for Integer14 anymore Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2009-12-20 00:36:25 UTC (rev 1400) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2009-12-20 00:39:13 UTC (rev 1401) @@ -27,7 +27,6 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; -import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -124,7 +123,7 @@ OpcodeStack.Item itm = stack.getStackItem(0); Integer size = (Integer)itm.getConstant(); if ((size != null) && (size.intValue() == 1)) { - userValue = Integer14.valueOf(-1); + userValue = Integer.valueOf(-1); } } } else if ((seen >= IASTORE) && (seen <= SASTORE)) { @@ -132,7 +131,7 @@ OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { - WrapperInfo wi = wrappers.get(Integer14.valueOf(reg)); + WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); if (wi != null) { OpcodeStack.Item elItm = stack.getStackItem(0); wi.wrappedReg = elItm.getRegisterNumber(); @@ -140,7 +139,7 @@ } else { OpcodeStack.Item elItm = stack.getStackItem(0); if (elItm.getRegisterNumber() != -1) - userValue = Integer14.valueOf(elItm.getRegisterNumber()); + userValue = Integer.valueOf(elItm.getRegisterNumber()); } } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { @@ -151,7 +150,7 @@ int reg = RegisterUtils.getAStoreReg(this, seen); Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) - wrappers.put(Integer14.valueOf(reg), new WrapperInfo(elReg.intValue())); + wrappers.put(Integer.valueOf(reg), new WrapperInfo(elReg.intValue())); } else { Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) { @@ -178,7 +177,7 @@ if ((argSig.length() > 0) && (argSig.charAt(0) == '[')) { OpcodeStack.Item itm = stack.getStackItem(args.length - i - 1); int arrayReg = itm.getRegisterNumber(); - WrapperInfo wi = wrappers.get(Integer14.valueOf(arrayReg)); + WrapperInfo wi = wrappers.get(Integer.valueOf(arrayReg)); if (wi != null) wi.wasArg = true; } @@ -188,16 +187,16 @@ if (stack.getStackDepth() >= 2) { OpcodeStack.Item arItm = stack.getStackItem(1); int arReg = arItm.getRegisterNumber(); - WrapperInfo wi = wrappers.get(Integer14.valueOf(arReg)); + WrapperInfo wi = wrappers.get(Integer.valueOf(arReg)); if ((wi != null) && wi.wasArg) { - userValue = Integer14.valueOf(wi.wrappedReg); + userValue = Integer.valueOf(wi.wrappedReg); } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = RegisterUtils.getALoadReg(this, seen); - WrapperInfo wi = wrappers.get(Integer14.valueOf(reg)); + WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); if (wi != null) - userValue = Integer14.valueOf(wi.wrappedReg); + userValue = Integer.valueOf(wi.wrappedReg); } else if (((seen == ISTORE) || ((seen >= ISTORE_0) && (seen <= ISTORE_3))) || ((seen == LSTORE) || ((seen >= LSTORE_0) && (seen <= LSTORE_3))) || ((seen == DSTORE) || ((seen >= DSTORE_0) && (seen <= DSTORE_3))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:36:33
|
Revision: 1400 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1400&view=rev Author: dbrosius Date: 2009-12-20 00:36:25 +0000 (Sun, 20 Dec 2009) Log Message: ----------- don't report returns if they are the first statement after the IFNULL Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-20 00:16:30 UTC (rev 1399) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-20 00:36:25 UTC (rev 1400) @@ -122,8 +122,10 @@ nullGuards.clear(); } } - } else if ((seen == RETURN) || (seen == IRETURN) || (seen == ATHROW)) { + } else if (seen == ATHROW) { nullGuards.clear(); + } else if ((seen >= IRETURN) && (seen <= RETURN)) { + nullGuards.remove(Integer.valueOf(getPC() - 3)); } } finally { stack.sawOpcode(this, seen); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-20 00:09:11
|
Revision: 1398 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1398&view=rev Author: dbrosius Date: 2009-12-20 00:09:04 +0000 (Sun, 20 Dec 2009) Log Message: ----------- add IRETURN as a clearing event for return a != null; Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-19 23:45:00 UTC (rev 1397) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-20 00:09:04 UTC (rev 1398) @@ -122,7 +122,7 @@ nullGuards.clear(); } } - } else if ((seen == RETURN) || (seen == ATHROW)) { + } else if ((seen == RETURN) || (seen == IRETURN) || (seen == ATHROW)) { nullGuards.clear(); } } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-19 23:45:12
|
Revision: 1397 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1397&view=rev Author: dbrosius Date: 2009-12-19 23:45:00 +0000 (Sat, 19 Dec 2009) Log Message: ----------- add support for IKNC for HttpSession.getAttribute/setAttribute Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java Added Paths: ----------- trunk/fb-contrib/javadoc/ Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-12-19 23:35:21 UTC (rev 1396) +++ trunk/fb-contrib/etc/findbugs.xml 2009-12-19 23:45:00 UTC (rev 1397) @@ -295,7 +295,7 @@ speed="fast" reports="ITU_INAPPROPRIATE_TOSTRING_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.InconsistentKeyNameCasing" - speed="fast" reports="IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> + speed="fast" reports="IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING,IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> <Detector class="com.mebigfatguy.fbcontrib.detect.OverzealousCasting" speed="fast" reports="OC_OVERZEALOUS_CASTING" /> @@ -550,6 +550,8 @@ category="CORRECTNESS" /> <BugPattern abbrev="ITU" type="ITU_INAPPROPRIATE_TOSTRING_USE" category="CORRECTNESS" /> + <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING" + category="STYLE" experimental="true" /> <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_PARAM_CASING" category="STYLE" experimental="true" /> <BugPattern abbrev="OC" type="OC_OVERZEALOUS_CASTING" Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-12-19 23:35:21 UTC (rev 1396) +++ trunk/fb-contrib/etc/messages.xml 2009-12-19 23:45:00 UTC (rev 1397) @@ -1006,8 +1006,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.InconsistentKeyNameCasing"> <Details> <![CDATA[ - <p>looks for methods that use the same name with different casing to access objects in HttpRequest Parameters. - As these parameter names are case sensitive this will lead to confusion.</p> + <p>looks for methods that use the same name with different casing to access objects in HttpRequest parameters + and attributes. As these parameter names are case sensitive this will lead to confusion.</p> <p>It is a fast detector</p> ]]> </Details> @@ -2700,6 +2700,17 @@ </Details> </BugPattern> + <BugPattern type="IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING"> + <ShortDescription>method uses the same HttpSession attribute name but with different casing</ShortDescription> + <LongDescription>method {1} uses the same HttpSession attribute name but with different casing</LongDescription> + <Details> + <![CDATA[ + <p>This method sets or gets an HttpSession attribute with a parmeter name that was used in other locations + but with a different casing. As HttpSession attribute are case sensitive, this will be very confusing. + ]]> + </Details> + </BugPattern> + <BugPattern type="IKNC_INCONSISTENT_HTTP_PARAM_CASING"> <ShortDescription>method uses the same HttpRequestRequest parameter name but with different casing</ShortDescription> <LongDescription>method {1} uses the same HttpRequestRequest parameter name but with different casing</LongDescription> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2009-12-19 23:35:21 UTC (rev 1396) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2009-12-19 23:45:00 UTC (rev 1397) @@ -19,6 +19,7 @@ package com.mebigfatguy.fbcontrib.detect; import java.util.ArrayList; +import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -26,6 +27,8 @@ import org.apache.bcel.classfile.Code; +import com.sun.org.apache.bcel.internal.generic.Type; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -38,13 +41,34 @@ * name with different cases like 'id' and 'Id'. */ public class InconsistentKeyNameCasing extends BytecodeScanningDetector -{ +{ + private static final String HTTP_SESSION = "javax/servlet/http/HttpSession"; private static final String HTTP_SERVLET_REQUEST = "javax/servlet/http/HttpServletRequest"; + private static final String GET_ATTRIBUTE = "getAttribute"; + private static final String SET_ATTRIBUTE = "setAttribute"; private static final String GET_PARAMETER = "getParameter"; + private static final String GET_ATTRIBUTE_SIG = "(Ljava/lang/String;)Ljava/lang/Object;"; + private static final String SET_ATTRIBUTE_SIG = "(Ljava/lang/String;Ljava/lang/Object;)V"; private static final String GET_PARAMETER_SIG = "(Ljava/lang/String;)Ljava/lang/String;"; + + enum KeyType { + ATTRIBUTE("IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING"), + PARAMETER("IKNC_INCONSISTENT_HTTP_PARAM_CASING"); + + private String key; + + KeyType(String descriptionKey) { + key = descriptionKey; + } + + public String getDescription() { + return key; + } + }; + BugReporter bugReporter; OpcodeStack stack; - Map<String, Map<String, List<SourceInfo>>> parmInfo = new HashMap<String, Map<String, List<SourceInfo>>>(); + Map<KeyType, Map<String, Map<String, List<SourceInfo>>>> parmInfo; /** * constructs a IKNC detector given the reporter to report bugs on @@ -52,6 +76,9 @@ */ public InconsistentKeyNameCasing(BugReporter reporter) { bugReporter = reporter; + parmInfo = new EnumMap<KeyType, Map<String, Map<String, List<SourceInfo>>>>(KeyType.class); + parmInfo.put(KeyType.ATTRIBUTE, new HashMap<String, Map<String, List<SourceInfo>>>()); + parmInfo.put(KeyType.PARAMETER, new HashMap<String, Map<String, List<SourceInfo>>>()); } /** @@ -87,36 +114,32 @@ public void sawOpcode(int seen) { try { if (seen == INVOKEINTERFACE) { - String clsName = getClassConstantOperand(); - if (HTTP_SERVLET_REQUEST.equals(clsName)) { - String methodName = getNameConstantOperand(); - if (GET_PARAMETER.equals(methodName)) { - String signature = getSigConstantOperand(); - if (GET_PARAMETER_SIG.equals(signature)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - String parmName = (String)item.getConstant(); - if (parmName != null) - { - String upperParmName = parmName.toUpperCase(Locale.getDefault()); - Map<String, List<SourceInfo>> parmCaseInfo = parmInfo.get(upperParmName); - if (parmCaseInfo == null) { - parmCaseInfo = new HashMap<String, List<SourceInfo>>(); - parmInfo.put(upperParmName, parmCaseInfo); - } - - List<SourceInfo> annotations = parmCaseInfo.get(parmName); - if (annotations == null) { - annotations = new ArrayList<SourceInfo>(); - parmCaseInfo.put(parmName, annotations); - } - - annotations.add(new SourceInfo(getClassName(), getMethodName(), getMethodSig(), getMethod().isStatic(), SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, getPC()))); - } + KeyType type = isKeyAccessMethod(seen); + if (type != null) { + int numParms = Type.getArgumentTypes(getSigConstantOperand()).length; + if (stack.getStackDepth() >= numParms) { + OpcodeStack.Item item = stack.getStackItem(numParms - 1); + String parmName = (String)item.getConstant(); + if (parmName != null) + { + String upperParmName = parmName.toUpperCase(Locale.getDefault()); + Map<String, Map<String, List<SourceInfo>>> typeMap = parmInfo.get(KeyType.PARAMETER); + Map<String, List<SourceInfo>> parmCaseInfo = typeMap.get(upperParmName); + if (parmCaseInfo == null) { + parmCaseInfo = new HashMap<String, List<SourceInfo>>(); + typeMap.put(upperParmName, parmCaseInfo); } + + List<SourceInfo> annotations = parmCaseInfo.get(parmName); + if (annotations == null) { + annotations = new ArrayList<SourceInfo>(); + parmCaseInfo.put(parmName, annotations); + } + + annotations.add(new SourceInfo(getClassName(), getMethodName(), getMethodSig(), getMethod().isStatic(), SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, getPC()))); } } - } + } } } finally { stack.sawOpcode(this, seen); @@ -129,25 +152,53 @@ */ @Override public void report() { - for (Map<String, List<SourceInfo>> parmCaseInfo : parmInfo.values()) { - if (parmCaseInfo.size() > 1) { - BugInstance bi = new BugInstance(this, "IKNC_INCONSISTENT_HTTP_PARAM_CASING", NORMAL_PRIORITY); - - for (Map.Entry<String, List<SourceInfo>> sourceInfos :parmCaseInfo.entrySet()) { - for (SourceInfo sourceInfo : sourceInfos.getValue()) { - bi.addClass(sourceInfo.clsName); - bi.addMethod(sourceInfo.clsName, sourceInfo.methodName, sourceInfo.signature, sourceInfo.isStatic); - bi.addSourceLine(sourceInfo.srcLine); - bi.addString(sourceInfos.getKey()); - } - } - - bugReporter.reportBug(bi); - } - } + for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) { + KeyType type = entry.getKey(); + Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue(); + + for (Map<String, List<SourceInfo>> parmCaseInfo : typeMap.values()) { + if (parmCaseInfo.size() > 1) { + BugInstance bi = new BugInstance(this, type.getDescription(), NORMAL_PRIORITY); + + for (Map.Entry<String, List<SourceInfo>> sourceInfos :parmCaseInfo.entrySet()) { + for (SourceInfo sourceInfo : sourceInfos.getValue()) { + bi.addClass(sourceInfo.clsName); + bi.addMethod(sourceInfo.clsName, sourceInfo.methodName, sourceInfo.signature, sourceInfo.isStatic); + bi.addSourceLine(sourceInfo.srcLine); + bi.addString(sourceInfos.getKey()); + } + } + + bugReporter.reportBug(bi); + } + } + } parmInfo.clear(); } + private KeyType isKeyAccessMethod(int seen) { + if (seen == INVOKEINTERFACE) { + String clsName = getClassConstantOperand(); + if (HTTP_SESSION.equals(clsName)) { + String methodName = getNameConstantOperand(); + if (GET_ATTRIBUTE.equals(methodName)) { + String signature = getSigConstantOperand(); + return (GET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null; + } else if (SET_ATTRIBUTE.equals(methodName)) { + String signature = getSigConstantOperand(); + return (SET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null; + } + } else if (HTTP_SERVLET_REQUEST.equals(clsName)) { + String methodName = getNameConstantOperand(); + if (GET_PARAMETER.equals(methodName)) { + String signature = getSigConstantOperand(); + return (GET_PARAMETER_SIG.equals(signature)) ? KeyType.PARAMETER : null; + } + } + } + + return null; + } /** * a holder for location information of a getParameter call */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-19 23:34:57
|
Revision: 1395 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1395&view=rev Author: dbrosius Date: 2009-12-19 23:34:51 +0000 (Sat, 19 Dec 2009) Log Message: ----------- match 1.5 Modified Paths: -------------- trunk/fb-contrib/samples/JVR_Sample.java Modified: trunk/fb-contrib/samples/JVR_Sample.java =================================================================== --- trunk/fb-contrib/samples/JVR_Sample.java 2009-12-19 23:34:07 UTC (rev 1394) +++ trunk/fb-contrib/samples/JVR_Sample.java 2009-12-19 23:34:51 UTC (rev 1395) @@ -63,11 +63,9 @@ public void truncate(long arg0) throws SQLException { } - @Override public void free() throws SQLException { } - @Override public InputStream getBinaryStream(long arg0, long arg1) throws SQLException { return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-19 23:34:18
|
Revision: 1394 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1394&view=rev Author: dbrosius Date: 2009-12-19 23:34:07 +0000 (Sat, 19 Dec 2009) Log Message: ----------- can't @Override interfaces in 1.5 Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2009-12-19 23:32:13 UTC (rev 1393) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2009-12-19 23:34:07 UTC (rev 1394) @@ -61,7 +61,6 @@ * @param classContext the context object of the currently parsed class */ - @Override public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); @@ -81,7 +80,6 @@ } } - @Override public void report() { } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-19 23:32:20
|
Revision: 1393 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1393&view=rev Author: dbrosius Date: 2009-12-19 23:32:13 +0000 (Sat, 19 Dec 2009) Log Message: ----------- move up to building with 1.5 to match findbugs Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-12-19 18:08:12 UTC (rev 1392) +++ trunk/fb-contrib/build.xml 2009-12-19 23:32:13 UTC (rev 1393) @@ -16,7 +16,7 @@ <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="jsr14"/> + <property name="javac.target" value="1.5"/> <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-19 18:08:21
|
Revision: 1392 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1392&view=rev Author: dbrosius Date: 2009-12-19 18:08:12 +0000 (Sat, 19 Dec 2009) Log Message: ----------- document NFF and WNG Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2009-12-19 18:05:32 UTC (rev 1391) +++ trunk/fb-contrib/htdocs/index.html 2009-12-19 18:08:12 UTC (rev 1392) @@ -73,6 +73,16 @@ Looks for contravariant array assignments. Since arrays are mutable data structures, their use must be restricted to covariant or invariant usage. <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li> + <li><b>[NFF] Non Functional Field</b><br/> + Looks for fields in serializable classes that are defined as both final and + transient. As a transient field is not initialized when streamed, and is not + initialized in a constructor, it will remain null because it is defined final.</li> + <li><b>[WNG] Wrong Null Guard</b><br/> + Looks for code that checks to see if a field or local variable is not null, + before entering a code block either an if, or while statement, and then doesn't + reference that field or local in the block of code that is guarded by the null + check. It is likely that null check is being done on the wrong variable, either + because of a copy/paste error, or a change in implementation.</li> </ul> </div> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |