fb-contrib-commit Mailing List for fb-contrib (Page 26)
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-07-03 05:43:32
|
Revision: 1216 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1216&view=rev Author: dbrosius Date: 2009-07-03 05:43:31 +0000 (Fri, 03 Jul 2009) Log Message: ----------- initial checkin Added Paths: ----------- trunk/fb-contrib/samples/TBP_Sample.java Added: trunk/fb-contrib/samples/TBP_Sample.java =================================================================== --- trunk/fb-contrib/samples/TBP_Sample.java (rev 0) +++ trunk/fb-contrib/samples/TBP_Sample.java 2009-07-03 05:43:31 UTC (rev 1216) @@ -0,0 +1,10 @@ + +public class TBP_Sample +{ + public Boolean questionable(String in) { + if (in.equals("Foo")) + return Boolean.TRUE; + + return null; + } +} Property changes on: trunk/fb-contrib/samples/TBP_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-03 05:42:31
|
Revision: 1215 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1215&view=rev Author: dbrosius Date: 2009-07-03 05:42:30 +0000 (Fri, 03 Jul 2009) Log Message: ----------- initial checkin Added Paths: ----------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java 2009-07-03 05:42:30 UTC (rev 1215) @@ -0,0 +1,109 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2009 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.fbcontrib.detect; + +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.Method; + +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; +import edu.umd.cs.findbugs.OpcodeStack; +import edu.umd.cs.findbugs.ba.ClassContext; + +/** + * looks for methods that are defined to return Boolean, but return null. This thus + * allows three return values, Boolean.FALSE, Boolean.TRUE and null. If three values + * intended, it would be more clear to just create an enumeration with three values + * and return that type. + */ +public class TristateBooleanPattern extends BytecodeScanningDetector +{ + private BugReporter bugReporter; + private OpcodeStack stack; + private boolean methodReported; + + /** + * constructs a TBP detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public TristateBooleanPattern(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + /** + * implements the visitor to allocate the opcode stack + * + * @param classContext the context object of the currently parsed class + */ + @Override + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } finally { + stack = null; + } + } + + /** + * implements the visitor to filter out methods that don't return Boolean, + * and to reset the methodReported flag + * + * @param obj the context object for the currently parsed code block + */ + @Override + public void visitCode(Code obj) { + Method m = getMethod(); + if (Type.BOOLEAN.equals(m.getReturnType())) { + stack.resetForMethodEntry(this); + methodReported = false; + super.visitCode(obj); + } + } + + /** + * implements the visitor to look for null returns + */ + @Override + public void sawOpcode(int seen) { + try { + if (methodReported) + return; + + if (seen == ARETURN) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + if (item.isNull()) { + bugReporter.reportBug(new BugInstance(this, "TBP_TRISTATE_BOOLEAN_PATTERN", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + methodReported = true; + } + } + } + } finally { + stack.sawOpcode(this, seen); + } + } + +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-03 05:03:15
|
Revision: 1214 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1214&view=rev Author: dbrosius Date: 2009-07-03 05:03:14 +0000 (Fri, 03 Jul 2009) Log Message: ----------- Fix for 2813241, hopefully Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2009-07-03 04:34:52 UTC (rev 1213) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2009-07-03 05:03:14 UTC (rev 1214) @@ -217,12 +217,14 @@ if (ins instanceof FieldInstruction) { FieldInstruction fi = (FieldInstruction) ins; String fieldName = fi.getFieldName(cpg); - uncheckedFields.remove(fieldName); + boolean justRemoved = uncheckedFields.remove(fieldName); if (ins instanceof GETFIELD) { - localizableFields.remove(fieldName); - if (localizableFields.isEmpty()) - return; + if (justRemoved) { + localizableFields.remove(fieldName); + if (localizableFields.isEmpty()) + return; + } } else { FieldInfo finfo = localizableFields.get(fieldName); if (finfo != null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-03 04:34:53
|
Revision: 1213 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1213&view=rev Author: dbrosius Date: 2009-07-03 04:34:52 +0000 (Fri, 03 Jul 2009) Log Message: ----------- formatting Modified Paths: -------------- trunk/fb-contrib/samples/FCBL_Sample.java Modified: trunk/fb-contrib/samples/FCBL_Sample.java =================================================================== --- trunk/fb-contrib/samples/FCBL_Sample.java 2009-07-03 04:32:35 UTC (rev 1212) +++ trunk/fb-contrib/samples/FCBL_Sample.java 2009-07-03 04:34:52 UTC (rev 1213) @@ -19,11 +19,12 @@ fp = 4; } - public void method1() { + public void method1() + { x = 50; System.out.println(x); System.out.println(y); -} + } public void test1() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-03 04:32:36
|
Revision: 1212 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1212&view=rev Author: dbrosius Date: 2009-07-03 04:32:35 +0000 (Fri, 03 Jul 2009) Log Message: ----------- add false negative from #2813241 Modified Paths: -------------- trunk/fb-contrib/samples/FCBL_Sample.java Modified: trunk/fb-contrib/samples/FCBL_Sample.java =================================================================== --- trunk/fb-contrib/samples/FCBL_Sample.java 2009-07-03 04:06:08 UTC (rev 1211) +++ trunk/fb-contrib/samples/FCBL_Sample.java 2009-07-03 04:32:35 UTC (rev 1212) @@ -7,6 +7,8 @@ int hoo; private int fp; private String test; + private int x = 1; + private int y = 2; public FCBL_Sample() { @@ -17,6 +19,12 @@ fp = 4; } + public void method1() { + x = 50; + System.out.println(x); + System.out.println(y); +} + public void test1() { foo = 2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-03 04:06:10
|
Revision: 1211 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1211&view=rev Author: dbrosius Date: 2009-07-03 04:06:08 +0000 (Fri, 03 Jul 2009) Log Message: ----------- add bugrank.txt to jar Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-07-03 04:03:08 UTC (rev 1210) +++ trunk/fb-contrib/build.xml 2009-07-03 04:06:08 UTC (rev 1211) @@ -103,6 +103,7 @@ <fileset dir="etc"> <include name="findbugs.xml"/> <include name="messages*.xml"/> + <include name="bugrank.txt"/> <include name="*.license"/> </fileset> <fileset dir="${classes.dir}"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-03 04:03:09
|
Revision: 1210 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1210&view=rev Author: dbrosius Date: 2009-07-03 04:03:08 +0000 (Fri, 03 Jul 2009) Log Message: ----------- add new needed config file Added Paths: ----------- trunk/fb-contrib/etc/bugrank.txt Added: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt (rev 0) +++ trunk/fb-contrib/etc/bugrank.txt 2009-07-03 04:03:08 UTC (rev 1210) @@ -0,0 +1,118 @@ +0 BugPattern ISB_INEFFICIENT_STRING_BUFFERING +0 BugPattern ISB_EMPTY_STRING_APPENDING +0 BugPattern SCI_SYNCHRONIZED_COLLECTION_ITERATORS +0 BugPattern CC_CYCLOMATIC_COMPLEXITY +0 BugPattern OCP_OVERLY_CONCRETE_PARAMETER +0 BugPattern LII_LIST_INDEXED_ITERATING +0 BugPattern UCC_UNRELATED_COLLECTION_CONTENTS +0 BugPattern DRE_DECLARED_RUNTIME_EXCEPTION +0 BugPattern CE_CLASS_ENVY +0 BugPattern LSC_LITERAL_STRING_COMPARISON +0 BugPattern PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS +0 BugPattern DLC_DUBIOUS_LIST_COLLECTION +0 BugPattern PL_PARALLEL_LISTS +0 BugPattern FP_FINAL_PARAMETERS +0 BugPattern ACEM_ABSTRACT_CLASS_EMPTY_METHODS +0 BugPattern MAC_MANUAL_ARRAY_COPY +0 BugPattern FPL_FLOATING_POINT_LOOPS +0 BugPattern NCMU_NON_COLLECTION_METHOD_USE +0 BugPattern CAO_CONFUSING_AUTOBOXED_OVERLOADING +0 BugPattern AFBR_ABNORMAL_FINALLY_BLOCK_RETURN +0 BugPattern SMII_STATIC_METHOD_INSTANCE_INVOCATION +0 BugPattern STS_SPURIOUS_THREAD_STATES +0 BugPattern NAB_NEEDLESS_AUTOBOXING_CTOR +0 BugPattern NAB_NEEDLESS_BOXING_STRING_CTOR +0 BugPattern NAB_NEEDLESS_AUTOBOXING_VALUEOF +0 BugPattern NAB_NEEDLESS_BOXING_PARSE +0 BugPattern NAB_NEEDLESS_BOXING_VALUEOF +0 BugPattern NAB_NEEDLESS_BOX_TO_UNBOX +0 BugPattern NAB_NEEDLESS_BOX_TO_CAST +0 BugPattern NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION +0 BugPattern USBR_UNNECESSARY_STORE_BEFORE_RETURN +0 BugPattern COM_COPIED_OVERRIDDEN_METHOD +0 BugPattern ABC_ARRAY_BASED_COLLECTIONS +0 BugPattern ODN_ORPHANED_DOM_NODE +0 BugPattern AOM_ABSTRACT_OVERRIDDEN_METHOD +0 BugPattern CBX_CUSTOM_BUILT_XML +0 BugPattern BSB_BLOATED_SYNCHRONIZED_BLOCK +0 BugPattern CLI_CONSTANT_LIST_INDEX +0 BugPattern SCR_SLOPPY_CLASS_REFLECTION +0 BugPattern AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE +0 BugPattern SG_SLUGGISH_GUI +0 BugPattern NIR_NEEDLESS_INSTANCE_RETRIEVAL +0 BugPattern DDC_DOUBLE_DATE_COMPARISON +0 BugPattern SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT +0 BugPattern JVR_JDBC_VENDOR_RELIANCE +0 BugPattern PMB_POSSIBLE_MEMORY_BLOAT +0 BugPattern LSYC_LOCAL_SYNCHRONIZED_COLLECTION +0 BugPattern FCBL_FIELD_COULD_BE_LOCAL +0 BugPattern NOS_NON_OWNED_SYNCHRONIZATION +0 BugPattern NRTL_NON_RECYCLEABLE_TAG_LIB +0 BugPattern S508C_NULL_LAYOUT +0 BugPattern S508C_NO_SETLABELFOR +0 BugPattern S508C_NO_SETSIZE +0 BugPattern S508C_NON_ACCESSIBLE_JCOMPONENT +0 BugPattern S508C_SET_COMP_COLOR +0 BugPattern UEC_USE_ENUM_COLLECTIONS +0 BugPattern SIL_SQL_IN_LOOP +0 BugPattern NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION +0 BugPattern ITC_INHERITANCE_TYPE_CHECKING +0 BugPattern SACM_STATIC_ARRAY_CREATED_IN_METHOD +0 BugPattern PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS +0 BugPattern UTA_USE_TO_ARRAY +0 BugPattern LEST_LOST_EXCEPTION_STACK_TRACE +0 BugPattern UCPM_USE_CHARACTER_PARAMETERIZED_METHOD +0 BugPattern TR_TAIL_RECURSION +0 BugPattern URV_UNRELATED_RETURN_VALUES +0 BugPattern URV_CHANGE_RETURN_TYPE +0 BugPattern URV_INHERITED_METHOD_WITH_RELATED_TYPES +0 BugPattern PIS_POSSIBLE_INCOMPLETE_SERIALIZATION +0 BugPattern SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES +0 BugPattern SPP_NEGATIVE_BITSET_ITEM +0 BugPattern SPP_INTERN_ON_CONSTANT +0 BugPattern SPP_NO_CHAR_SB_CTOR +0 BugPattern SPP_USE_MATH_CONSTANT +0 BugPattern SPP_STUTTERED_ASSIGNMENT +0 BugPattern SPP_USE_ISNAN +0 BugPattern SPP_USE_BIGDECIMAL_STRING_CTOR +0 BugPattern SPP_STRINGBUFFER_WITH_EMPTY_STRING +0 BugPattern SPP_EQUALS_ON_ENUM +0 BugPattern SPP_INVALID_BOOLEAN_NULL_CHECK +0 BugPattern SPP_USE_CHARAT +0 BugPattern SPP_USELESS_TRINARY +0 BugPattern SPP_SUSPECT_STRING_TEST +0 BugPattern SPP_USE_STRINGBUILDER_LENGTH +0 BugPattern SPP_INVALID_CALENDAR_COMPARE" category="CORRECTNESS"/> +0 BugPattern SPP_USE_CONTAINSKEY" category="STYLE"/> +0 BugPattern SPP_USE_ISEMPTY" category="STYLE"/> +0 BugPattern SPP_USE_GETPROPERTY" category="STYLE"/> +0 BugPattern SPP_SERIALVER_SHOULD_BE_PRIVATE" category="STYLE"/> +0 BugPattern BAS_BLOATED_ASSIGNMENT_SCOPE +0 BugPattern SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR +0 BugPattern DWI_DELETING_WHILE_ITERATING +0 BugPattern DWI_MODIFYING_WHILE_ITERATING +0 BugPattern USS_USE_STRING_SPLIT +0 BugPattern SJVU_SUSPICIOUS_JDK_VERSION_USE +0 BugPattern UAA_USE_ADD_ALL +0 BugPattern MRC_METHOD_RETURNS_CONSTANT +0 BugPattern NCS_NEEDLESS_CUSTOM_SERIALIZATION +0 BugPattern MOM_MISLEADING_OVERLOAD_MODEL +0 BugPattern EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS +0 BugPattern EXS_EXCEPTION_SOFTENING_HAS_CHECKED +0 BugPattern EXS_EXCEPTION_SOFTENING_NO_CHECKED +0 BugPattern CFS_CONFUSING_FUNCTION_SEMANTICS +0 BugPattern JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT +0 BugPattern JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE +0 BugPattern JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT +0 BugPattern JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL +0 BugPattern SCA_SUSPICIOUS_CLONE_ALGORITHM +0 BugPattern WEM_WEAK_EXCEPTION_MESSAGING +0 BugPattern SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT +0 BugPattern LO_SUSPECT_LOG_CLASS +0 BugPattern LO_SUSPECT_LOG_PARAMETER +0 BugPattern IICU_INCORRECT_INTERNAL_CLASS_USE +0 BugPattern DSOC_DUBIOUS_SET_OF_COLLECTIONS +0 BugPattern BED_BOGUS_EXCEPTION_DECLARATION +0 BugPattern UNNC_UNNECESSARY_NEW_NULL_CHECK +0 BugPattern DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN +0 BugPattern SMA_STUTTERED_METHOD_ARGUMENTS Property changes on: trunk/fb-contrib/etc/bugrank.txt ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-13 21:57:27
|
Revision: 1209 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1209&view=rev Author: dbrosius Date: 2009-05-13 21:57:18 +0000 (Wed, 13 May 2009) Log Message: ----------- move goto to transitional code Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2009-05-11 16:49:10 UTC (rev 1208) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2009-05-13 21:57:18 UTC (rev 1209) @@ -88,7 +88,9 @@ boolean sawAlloc = false; try { if (transitionPoints.contains(Integer14.valueOf(getPC()))) + { allocationRegs.clear(); + } switch (seen) { case NEW: @@ -155,6 +157,8 @@ case IF_ICMPLE: case IF_ACMPEQ: case IF_ACMPNE: + case GOTO: + case GOTO_W: transitionPoints.add(Integer14.valueOf(getBranchTarget())); allocationRegs.clear(); break; @@ -167,8 +171,6 @@ case DRETURN: case ARETURN: case RETURN: - case GOTO: - case GOTO_W: case ATHROW: allocationRegs.clear(); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-11 16:49:19
|
Revision: 1208 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1208&view=rev Author: dbrosius Date: 2009-05-11 16:49:10 +0000 (Mon, 11 May 2009) Log Message: ----------- add GETSTATIC Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 23:38:50 UTC (rev 1207) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-11 16:49:10 UTC (rev 1208) @@ -112,9 +112,13 @@ String packageName; int slashPos = clsName.lastIndexOf('/'); if (slashPos >= 0) + { packageName = clsName.substring(0, slashPos); + } else + { packageName = ""; + } if (SignatureUtils.similarPackages(processedPackageName, packageName, 2)) { String methodName = getNameConstantOperand(); @@ -137,11 +141,14 @@ break; case GETFIELD: + case GETSTATIC: if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); int reg = item.getRegisterNumber(); if (reg >= 0) + { fieldSource = String.valueOf(reg); + } else { XField f = item.getXField(); if (f != null) { @@ -190,7 +197,9 @@ if (f != null) { String fieldSource = (String)item.getUserValue(); if (fieldSource == null) + { fieldSource = ""; + } arg = fieldSource + '|' + f.getClassName() + ':' + f.getName(); } } @@ -198,7 +207,9 @@ if (arg != null) { arg += "--" + parms[i].getSignature(); if (args.contains(arg)) + { return true; + } args.add(arg); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 23:38:54
|
Revision: 1207 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1207&view=rev Author: dbrosius Date: 2009-05-10 23:38:50 +0000 (Sun, 10 May 2009) Log Message: ----------- make sure caller and callee are in the same basic package Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 15:22:44 UTC (rev 1206) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 23:38:50 UTC (rev 1207) @@ -24,6 +24,8 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.SignatureUtils; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -42,6 +44,7 @@ } private final BugReporter bugReporter; private OpcodeStack stack; + private String processedPackageName; private String processedMethodName; /** @@ -64,9 +67,11 @@ { try { stack = new OpcodeStack(); + processedPackageName = classContext.getJavaClass().getPackageName(); super.visitClassContext(classContext); } finally { stack = null; + processedPackageName = null; } } @@ -77,9 +82,14 @@ */ @Override public void visitCode(Code obj) { - stack.resetForMethodEntry(this); - processedMethodName = getMethod().getName(); - super.visitCode(obj); + try { + stack.resetForMethodEntry(this); + processedMethodName = getMethod().getName(); + super.visitCode(obj); + } finally { + processedMethodName = null; + } + } /** @@ -99,18 +109,27 @@ case INVOKEINTERFACE: case INVOKESPECIAL: String clsName = getClassConstantOperand(); - String methodName = getNameConstantOperand(); - String signature = getSigConstantOperand(); - String methodInfo = clsName + ":" + methodName + signature; - if ((!processedMethodName.equals(methodName)) && !ignorableSignatures.contains(methodInfo)) { - Type[] parms = Type.getArgumentTypes(signature); - if (parms.length > 1) { - if (stack.getStackDepth() > parms.length) { - if (duplicateArguments(stack, parms)) { - bugReporter.reportBug(new BugInstance(this, "SMA_STUTTERED_METHOD_ARGUMENTS", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + String packageName; + int slashPos = clsName.lastIndexOf('/'); + if (slashPos >= 0) + packageName = clsName.substring(0, slashPos); + else + packageName = ""; + + if (SignatureUtils.similarPackages(processedPackageName, packageName, 2)) { + String methodName = getNameConstantOperand(); + String signature = getSigConstantOperand(); + String methodInfo = clsName + ":" + methodName + signature; + if ((!processedMethodName.equals(methodName)) && !ignorableSignatures.contains(methodInfo)) { + Type[] parms = Type.getArgumentTypes(signature); + if (parms.length > 1) { + if (stack.getStackDepth() > parms.length) { + if (duplicateArguments(stack, parms)) { + bugReporter.reportBug(new BugInstance(this, "SMA_STUTTERED_METHOD_ARGUMENTS", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 15:22:47
|
Revision: 1206 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1206&view=rev Author: dbrosius Date: 2009-05-10 15:22:44 +0000 (Sun, 10 May 2009) Log Message: ----------- add overloaded method check Modified Paths: -------------- trunk/fb-contrib/samples/SMA_Sample.java Modified: trunk/fb-contrib/samples/SMA_Sample.java =================================================================== --- trunk/fb-contrib/samples/SMA_Sample.java 2009-05-10 15:22:28 UTC (rev 1205) +++ trunk/fb-contrib/samples/SMA_Sample.java 2009-05-10 15:22:44 UTC (rev 1206) @@ -1,3 +1,5 @@ +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.HashMap; import java.util.Map; @@ -2,15 +4,14 @@ -public class SMA_Sample +public class SMA_Sample implements ActionListener { SMA_Sample proto; - public void testSMA(SMA_Sample s1, SMA_Sample s2) + public void testSMA(SMA_Sample s1) { - if (!s1.equals(s2)) - testSMA(s1, s1); + doubleSMAs(s1, s1); } public void testNonReport(int a, int b) { - testNonReport(4, 4); + doubleInts(4, 4); } @@ -26,12 +27,39 @@ public void testFPTwoInstances(SMA_Sample other) { - testSMA(proto, proto.proto); + doubleSMAs(proto, proto.proto); } - public void testFPPrimitives(float f, float f2) + public void testFPPrimitives(int i) { - if (f != f2) - testFPPrimitives(f, f); + doubleInts(i, i); } + + public void testMultiTypes(SMA_Sample a) + { + twoInfs(a, a); + } + + public void doubleInts(int i, int j) + { + } + + public void doubleSMAs(SMA_Sample s) + { + doubleSMAs(s, s); + } + + public void doubleSMAs(SMA_Sample s1, SMA_Sample s2) + { + + } + + public void twoInfs(SMA_Sample a, ActionListener al) + { + + } + + public void actionPerformed(ActionEvent ae) + { + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 15:22:30
|
Revision: 1205 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1205&view=rev Author: dbrosius Date: 2009-05-10 15:22:28 +0000 (Sun, 10 May 2009) Log Message: ----------- don't report when calling an overloaded method Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 15:14:13 UTC (rev 1204) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 15:22:28 UTC (rev 1205) @@ -42,6 +42,7 @@ } private final BugReporter bugReporter; private OpcodeStack stack; + private String processedMethodName; /** * constructs a SMA detector given the reporter to report bugs on. @@ -77,6 +78,7 @@ @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); + processedMethodName = getMethod().getName(); super.visitCode(obj); } @@ -100,7 +102,7 @@ String methodName = getNameConstantOperand(); String signature = getSigConstantOperand(); String methodInfo = clsName + ":" + methodName + signature; - if (!ignorableSignatures.contains(methodInfo)) { + if ((!processedMethodName.equals(methodName)) && !ignorableSignatures.contains(methodInfo)) { Type[] parms = Type.getArgumentTypes(signature); if (parms.length > 1) { if (stack.getStackDepth() > parms.length) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 15:14:15
|
Revision: 1204 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1204&view=rev Author: dbrosius Date: 2009-05-10 15:14:13 +0000 (Sun, 10 May 2009) Log Message: ----------- don't report SMA when the parameter types for which the same arguments are passed, are different Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 01:57:46 UTC (rev 1203) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 15:14:13 UTC (rev 1204) @@ -101,10 +101,10 @@ String signature = getSigConstantOperand(); String methodInfo = clsName + ":" + methodName + signature; if (!ignorableSignatures.contains(methodInfo)) { - Type[] args = Type.getArgumentTypes(signature); - if (args.length > 1) { - if (stack.getStackDepth() > args.length) { - if (duplicateArguments(stack, args.length)) { + Type[] parms = Type.getArgumentTypes(signature); + if (parms.length > 1) { + if (stack.getStackDepth() > parms.length) { + if (duplicateArguments(stack, parms)) { bugReporter.reportBug(new BugInstance(this, "SMA_STUTTERED_METHOD_ARGUMENTS", NORMAL_PRIORITY) .addClass(this) .addMethod(this) @@ -149,13 +149,13 @@ * looks for duplicate arguments that are not constants * * @param stack the stack to look thru - * @param length the number of arguments + * @param parms the arguments to the method being called * @return if there are duplicates */ - private boolean duplicateArguments(OpcodeStack stack, int length) throws ClassNotFoundException + private boolean duplicateArguments(OpcodeStack stack, Type[] parms) throws ClassNotFoundException { Set<String> args = new HashSet<String>(); - for (int i = 0; i < length; i++) { + for (int i = 0; i < parms.length; i++) { OpcodeStack.Item item = stack.getStackItem(i); String signature = item.getSignature(); @@ -175,6 +175,7 @@ } if (arg != null) { + arg += "--" + parms[i].getSignature(); if (args.contains(arg)) return true; args.add(arg); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 02:22:18
|
Revision: 1202 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1202&view=rev Author: dbrosius Date: 2009-05-10 01:56:59 +0000 (Sun, 10 May 2009) Log Message: ----------- rule out classes from java/lang/... Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 00:01:59 UTC (rev 1201) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 01:56:59 UTC (rev 1202) @@ -158,7 +158,8 @@ for (int i = 0; i < length; i++) { OpcodeStack.Item item = stack.getStackItem(i); - if ((item.getSignature().startsWith("L")) && (item.getConstant() == null)) { + String signature = item.getSignature(); + if (signature.startsWith("L") && signature.startsWith("Ljava/lang/") && (item.getConstant() == null)) { String arg = null; int reg = item.getRegisterNumber(); if (reg >= 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 02:02:14
|
Revision: 1203 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1203&view=rev Author: dbrosius Date: 2009-05-10 01:57:46 +0000 (Sun, 10 May 2009) Log Message: ----------- should be !starts with Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 01:56:59 UTC (rev 1202) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 01:57:46 UTC (rev 1203) @@ -159,7 +159,7 @@ OpcodeStack.Item item = stack.getStackItem(i); String signature = item.getSignature(); - if (signature.startsWith("L") && signature.startsWith("Ljava/lang/") && (item.getConstant() == null)) { + if (signature.startsWith("L") && !signature.startsWith("Ljava/lang/") && (item.getConstant() == null)) { String arg = null; int reg = item.getRegisterNumber(); if (reg >= 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 00:02:06
|
Revision: 1201 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1201&view=rev Author: dbrosius Date: 2009-05-10 00:01:59 +0000 (Sun, 10 May 2009) Log Message: ----------- filter out primities Modified Paths: -------------- trunk/fb-contrib/samples/SMA_Sample.java Modified: trunk/fb-contrib/samples/SMA_Sample.java =================================================================== --- trunk/fb-contrib/samples/SMA_Sample.java 2009-05-10 00:01:44 UTC (rev 1200) +++ trunk/fb-contrib/samples/SMA_Sample.java 2009-05-10 00:01:59 UTC (rev 1201) @@ -27,6 +27,11 @@ public void testFPTwoInstances(SMA_Sample other) { testSMA(proto, proto.proto); - } + + public void testFPPrimitives(float f, float f2) + { + if (f != f2) + testFPPrimitives(f, f); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-10 00:01:45
|
Revision: 1200 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1200&view=rev Author: dbrosius Date: 2009-05-10 00:01:44 +0000 (Sun, 10 May 2009) Log Message: ----------- filter out primitives Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 23:35:15 UTC (rev 1199) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-10 00:01:44 UTC (rev 1200) @@ -132,6 +132,8 @@ } break; } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); } finally { stack.sawOpcode(this, seen); if (fieldSource != null) { @@ -150,13 +152,13 @@ * @param length the number of arguments * @return if there are duplicates */ - private boolean duplicateArguments(OpcodeStack stack, int length) + private boolean duplicateArguments(OpcodeStack stack, int length) throws ClassNotFoundException { Set<String> args = new HashSet<String>(); for (int i = 0; i < length; i++) { OpcodeStack.Item item = stack.getStackItem(i); - if (item.getConstant() == null) { + if ((item.getSignature().startsWith("L")) && (item.getConstant() == null)) { String arg = null; int reg = item.getRegisterNumber(); if (reg >= 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 23:35:18
|
Revision: 1199 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1199&view=rev Author: dbrosius Date: 2009-05-09 23:35:15 +0000 (Sat, 09 May 2009) Log Message: ----------- differentiate this.a and foo.a when this and foo are of the same class Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 23:17:00 UTC (rev 1198) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 23:35:15 UTC (rev 1199) @@ -88,6 +88,8 @@ */ @Override public void sawOpcode(int seen) { + String fieldSource = null; + try { switch (seen) { case INVOKEVIRTUAL: @@ -112,9 +114,32 @@ } } break; + + case GETFIELD: + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + int reg = item.getRegisterNumber(); + if (reg >= 0) + fieldSource = String.valueOf(reg); + else { + XField f = item.getXField(); + if (f != null) { + fieldSource = f.getClassName() + ':' + f.getName(); + } else { + fieldSource = ""; + } + } + } + break; } } finally { stack.sawOpcode(this, seen); + if (fieldSource != null) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(fieldSource); + } + } } } @@ -139,7 +164,10 @@ } else { XField f = item.getXField(); if (f != null) { - arg = f.getName(); + String fieldSource = (String)item.getUserValue(); + if (fieldSource == null) + fieldSource = ""; + arg = fieldSource + '|' + f.getClassName() + ':' + f.getName(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 23:17:06
|
Revision: 1198 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1198&view=rev Author: dbrosius Date: 2009-05-09 23:17:00 +0000 (Sat, 09 May 2009) Log Message: ----------- add fp Modified Paths: -------------- trunk/fb-contrib/samples/SMA_Sample.java Modified: trunk/fb-contrib/samples/SMA_Sample.java =================================================================== --- trunk/fb-contrib/samples/SMA_Sample.java 2009-05-09 22:48:28 UTC (rev 1197) +++ trunk/fb-contrib/samples/SMA_Sample.java 2009-05-09 23:17:00 UTC (rev 1198) @@ -4,6 +4,8 @@ public class SMA_Sample { + SMA_Sample proto; + public void testSMA(SMA_Sample s1, SMA_Sample s2) { if (!s1.equals(s2)) @@ -21,4 +23,10 @@ m.put(i, i); } + + public void testFPTwoInstances(SMA_Sample other) + { + testSMA(proto, proto.proto); + + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 22:48:35
|
Revision: 1197 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1197&view=rev Author: dbrosius Date: 2009-05-09 22:48:28 +0000 (Sat, 09 May 2009) Log Message: ----------- add check for java/util/Map:put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; Modified Paths: -------------- trunk/fb-contrib/samples/SMA_Sample.java Modified: trunk/fb-contrib/samples/SMA_Sample.java =================================================================== --- trunk/fb-contrib/samples/SMA_Sample.java 2009-05-09 22:48:08 UTC (rev 1196) +++ trunk/fb-contrib/samples/SMA_Sample.java 2009-05-09 22:48:28 UTC (rev 1197) @@ -1,4 +1,7 @@ +import java.util.HashMap; +import java.util.Map; + public class SMA_Sample { public void testSMA(SMA_Sample s1, SMA_Sample s2) @@ -11,4 +14,11 @@ { testNonReport(4, 4); } + + public void testSMAFPMaps(Integer i) + { + Map<Integer, Integer> m = new HashMap<Integer, Integer>(); + + m.put(i, i); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 22:48:16
|
Revision: 1196 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1196&view=rev Author: dbrosius Date: 2009-05-09 22:48:08 +0000 (Sat, 09 May 2009) Log Message: ----------- ignore map.puts Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 21:07:41 UTC (rev 1195) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 22:48:08 UTC (rev 1196) @@ -36,6 +36,10 @@ * method. It doesn't report method calls where the arguments are constants. */ public class StutteredMethodArguments extends BytecodeScanningDetector { + private static Set<String> ignorableSignatures = new HashSet<String>(); + static { + ignorableSignatures.add("java/util/Map:put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + } private final BugReporter bugReporter; private OpcodeStack stack; @@ -90,15 +94,20 @@ case INVOKESTATIC: case INVOKEINTERFACE: case INVOKESPECIAL: + String clsName = getClassConstantOperand(); + String methodName = getNameConstantOperand(); String signature = getSigConstantOperand(); - Type[] args = Type.getArgumentTypes(signature); - if (args.length > 1) { - if (stack.getStackDepth() > args.length) { - if (duplicateArguments(stack, args.length)) { - bugReporter.reportBug(new BugInstance(this, "SMA_STUTTERED_METHOD_ARGUMENTS", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + String methodInfo = clsName + ":" + methodName + signature; + if (!ignorableSignatures.contains(methodInfo)) { + Type[] args = Type.getArgumentTypes(signature); + if (args.length > 1) { + if (stack.getStackDepth() > args.length) { + if (duplicateArguments(stack, args.length)) { + bugReporter.reportBug(new BugInstance(this, "SMA_STUTTERED_METHOD_ARGUMENTS", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 21:07:42
|
Revision: 1195 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1195&view=rev Author: dbrosius Date: 2009-05-09 21:07:41 +0000 (Sat, 09 May 2009) Log Message: ----------- use the Type from BCEL not sun Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 21:06:27 UTC (rev 1194) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 21:07:41 UTC (rev 1195) @@ -22,9 +22,8 @@ import java.util.Set; 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-05-09 21:06:29
|
Revision: 1194 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1194&view=rev Author: dbrosius Date: 2009-05-09 21:06:27 +0000 (Sat, 09 May 2009) Log Message: ----------- make consistent Added Paths: ----------- trunk/fb-contrib/samples/JVR_Sample.java Removed Paths: ------------- trunk/fb-contrib/samples/JVRSample.java Deleted: trunk/fb-contrib/samples/JVRSample.java =================================================================== --- trunk/fb-contrib/samples/JVRSample.java 2009-05-09 21:02:26 UTC (rev 1193) +++ trunk/fb-contrib/samples/JVRSample.java 2009-05-09 21:06:27 UTC (rev 1194) @@ -1,65 +0,0 @@ -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.ResultSet; -import java.sql.SQLException; - - - -public class JVR_Sample -{ - public String getBlobAsString(ResultSet rs) throws SQLException - { - VendorBlob vb = (VendorBlob)rs.getBlob(1); - return vb.convertBlobToString(); - } - - public String falsePositive(ResultSet rs) throws SQLException - { - Blob vb = rs.getBlob(1); - return vb.getClass().getName(); - } -} - -class VendorBlob implements Blob -{ - public String convertBlobToString() - { - return "Booya"; - } - - public InputStream getBinaryStream() throws SQLException { - return null; - } - - public byte[] getBytes(long arg0, int arg1) throws SQLException { - return null; - } - - public long length() throws SQLException { - return 0; - } - - public long position(Blob arg0, long arg1) throws SQLException { - return 0; - } - - public long position(byte[] arg0, long arg1) throws SQLException { - return 0; - } - - public OutputStream setBinaryStream(long arg0) throws SQLException { - return null; - } - - public int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws SQLException { - return 0; - } - - public int setBytes(long arg0, byte[] arg1) throws SQLException { - return 0; - } - - public void truncate(long arg0) throws SQLException { - } -} \ No newline at end of file Copied: trunk/fb-contrib/samples/JVR_Sample.java (from rev 1193, trunk/fb-contrib/samples/JVRSample.java) =================================================================== --- trunk/fb-contrib/samples/JVR_Sample.java (rev 0) +++ trunk/fb-contrib/samples/JVR_Sample.java 2009-05-09 21:06:27 UTC (rev 1194) @@ -0,0 +1,65 @@ +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Blob; +import java.sql.ResultSet; +import java.sql.SQLException; + + + +public class JVR_Sample +{ + public String getBlobAsString(ResultSet rs) throws SQLException + { + VendorBlob vb = (VendorBlob)rs.getBlob(1); + return vb.convertBlobToString(); + } + + public String falsePositive(ResultSet rs) throws SQLException + { + Blob vb = rs.getBlob(1); + return vb.getClass().getName(); + } +} + +class VendorBlob implements Blob +{ + public String convertBlobToString() + { + return "Booya"; + } + + public InputStream getBinaryStream() throws SQLException { + return null; + } + + public byte[] getBytes(long arg0, int arg1) throws SQLException { + return null; + } + + public long length() throws SQLException { + return 0; + } + + public long position(Blob arg0, long arg1) throws SQLException { + return 0; + } + + public long position(byte[] arg0, long arg1) throws SQLException { + return 0; + } + + public OutputStream setBinaryStream(long arg0) throws SQLException { + return null; + } + + public int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws SQLException { + return 0; + } + + public int setBytes(long arg0, byte[] arg1) throws SQLException { + return 0; + } + + public void truncate(long arg0) throws SQLException { + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 21:02:27
|
Revision: 1193 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1193&view=rev Author: dbrosius Date: 2009-05-09 21:02:26 +0000 (Sat, 09 May 2009) Log Message: ----------- add back in Added Paths: ----------- trunk/fb-contrib/samples/JVRSample.java Added: trunk/fb-contrib/samples/JVRSample.java =================================================================== --- trunk/fb-contrib/samples/JVRSample.java (rev 0) +++ trunk/fb-contrib/samples/JVRSample.java 2009-05-09 21:02:26 UTC (rev 1193) @@ -0,0 +1,65 @@ +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Blob; +import java.sql.ResultSet; +import java.sql.SQLException; + + + +public class JVR_Sample +{ + public String getBlobAsString(ResultSet rs) throws SQLException + { + VendorBlob vb = (VendorBlob)rs.getBlob(1); + return vb.convertBlobToString(); + } + + public String falsePositive(ResultSet rs) throws SQLException + { + Blob vb = rs.getBlob(1); + return vb.getClass().getName(); + } +} + +class VendorBlob implements Blob +{ + public String convertBlobToString() + { + return "Booya"; + } + + public InputStream getBinaryStream() throws SQLException { + return null; + } + + public byte[] getBytes(long arg0, int arg1) throws SQLException { + return null; + } + + public long length() throws SQLException { + return 0; + } + + public long position(Blob arg0, long arg1) throws SQLException { + return 0; + } + + public long position(byte[] arg0, long arg1) throws SQLException { + return 0; + } + + public OutputStream setBinaryStream(long arg0) throws SQLException { + return null; + } + + public int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws SQLException { + return 0; + } + + public int setBytes(long arg0, byte[] arg1) throws SQLException { + return 0; + } + + public void truncate(long arg0) throws SQLException { + } +} \ No newline at end of file Property changes on: trunk/fb-contrib/samples/JVRSample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 20:59:26
|
Revision: 1192 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1192&view=rev Author: dbrosius Date: 2009-05-09 20:59:17 +0000 (Sat, 09 May 2009) Log Message: ----------- Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java Removed Paths: ------------- trunk/fb-contrib/samples/JVR_Sample.java Deleted: trunk/fb-contrib/samples/JVR_Sample.java =================================================================== --- trunk/fb-contrib/samples/JVR_Sample.java 2009-05-09 20:58:29 UTC (rev 1191) +++ trunk/fb-contrib/samples/JVR_Sample.java 2009-05-09 20:59:17 UTC (rev 1192) @@ -1,65 +0,0 @@ -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.ResultSet; -import java.sql.SQLException; - - - -public class JVR_Sample -{ - public String getBlobAsString(ResultSet rs) throws SQLException - { - VendorBlob vb = (VendorBlob)rs.getBlob(1); - return vb.convertBlobToString(); - } - - public String falsePositive(ResultSet rs) throws SQLException - { - Blob vb = rs.getBlob(1); - return vb.getClass().getName(); - } -} - -class VendorBlob implements Blob -{ - public String convertBlobToString() - { - return "Booya"; - } - - public InputStream getBinaryStream() throws SQLException { - return null; - } - - public byte[] getBytes(long arg0, int arg1) throws SQLException { - return null; - } - - public long length() throws SQLException { - return 0; - } - - public long position(Blob arg0, long arg1) throws SQLException { - return 0; - } - - public long position(byte[] arg0, long arg1) throws SQLException { - return 0; - } - - public OutputStream setBinaryStream(long arg0) throws SQLException { - return null; - } - - public int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws SQLException { - return 0; - } - - public int setBytes(long arg0, byte[] arg1) throws SQLException { - return 0; - } - - public void truncate(long arg0) throws SQLException { - } -} \ No newline at end of file Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2009-05-09 20:58:29 UTC (rev 1191) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2009-05-09 20:59:17 UTC (rev 1192) @@ -49,7 +49,7 @@ } private OpcodeStack stack; - private BugReporter bugReporter; + private final BugReporter bugReporter; private String[] methodInfo; private boolean indeterminate; private boolean seenNegative; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |