fb-contrib-commit Mailing List for fb-contrib (Page 11)
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...> - 2010-08-22 04:43:34
|
Revision: 1590 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1590&view=rev Author: dbrosius Date: 2010-08-22 04:43:28 +0000 (Sun, 22 Aug 2010) Log Message: ----------- catch someMethod().staticMethod(); Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2010-08-22 04:40:23 UTC (rev 1589) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2010-08-22 04:43:28 UTC (rev 1590) @@ -35,7 +35,7 @@ { enum State {SEEN_NOTHING, SEEN_INVOKE, SEEN_POP} - private BugReporter bugReporter; + private final BugReporter bugReporter; private LineNumberTable lnTable; private State state; private int invokePC; @@ -58,6 +58,7 @@ lnTable = obj.getLineNumberTable(); if (lnTable != null) { state = State.SEEN_NOTHING; + invokePC = -1; super.visitCode(obj); } } finally { @@ -76,8 +77,8 @@ switch (state) { case SEEN_NOTHING: - if ((seen == INVOKEINTERFACE) - || (seen == INVOKEVIRTUAL)) { + if (seen == INVOKEINTERFACE + || seen == INVOKEVIRTUAL) { String sig = getSigConstantOperand(); Type retType = Type.getReturnType(sig); if (retType.getSignature().startsWith("L")) { @@ -99,7 +100,7 @@ break; case SEEN_POP: - if ((seen >= ACONST_NULL) && (seen <= DCONST_1)) { + if (seen >= ACONST_NULL && seen <= DCONST_1 || seen == INVOKESTATIC) { if (lnTable.getSourceLine(invokePC) == lnTable.getSourceLine(getPC())) { bugReporter.reportBug(new BugInstance(this, "NIR_NEEDLESS_INSTANCE_RETRIEVAL", NORMAL_PRIORITY) .addClass(this) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-08-22 04:40:30
|
Revision: 1589 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1589&view=rev Author: dbrosius Date: 2010-08-22 04:40:23 +0000 (Sun, 22 Aug 2010) Log Message: ----------- more tests Modified Paths: -------------- trunk/fb-contrib/samples/NIR_Sample.java Modified: trunk/fb-contrib/samples/NIR_Sample.java =================================================================== --- trunk/fb-contrib/samples/NIR_Sample.java 2010-08-17 04:37:16 UTC (rev 1588) +++ trunk/fb-contrib/samples/NIR_Sample.java 2010-08-22 04:40:23 UTC (rev 1589) @@ -22,13 +22,21 @@ System.out.println(getColorModel().TRANSLUCENT); } + public void test3() + { + getSample().staticMethod(); + } + public void fpStacked() { JButton ok = new JButton("ok"); JButton cancel = new JButton("cancel"); JPanel p = new JPanel(); - //hmm this is reported sometimes p.add(ok); p.add(cancel); } + + public static void staticMethod() + { + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-08-17 04:37:22
|
Revision: 1588 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1588&view=rev Author: dbrosius Date: 2010-08-17 04:37:16 +0000 (Tue, 17 Aug 2010) Log Message: ----------- commit delete of old sample Removed Paths: ------------- trunk/fb-contrib/samples/RMC_Sample.java Deleted: trunk/fb-contrib/samples/RMC_Sample.java =================================================================== --- trunk/fb-contrib/samples/RMC_Sample.java 2010-08-17 04:36:40 UTC (rev 1587) +++ trunk/fb-contrib/samples/RMC_Sample.java 2010-08-17 04:37:16 UTC (rev 1588) @@ -1,34 +0,0 @@ -import java.nio.ByteBuffer; -import java.util.Calendar; -import java.util.Date; - -@SuppressWarnings("all") -public class RMC_Sample -{ - String data; - - public boolean test1(Calendar c) - { - Date d = c.getTime(); - long l = d.getTime(); - Date e = c.getTime(); - long j = e.getTime(); - return l == j; - } - - public void rmcFP(ByteBuffer bb) - { - int i = bb.getInt(); - int j = bb.getInt(); - } - - @Override - public boolean equals(Object o) - { - RMC_Sample rmc = (RMC_Sample)o; - if (data.equals("INF") || rmc.data.equals("INF")) - return false; - - return data.equals(rmc.data); - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-08-17 04:36:46
|
Revision: 1587 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1587&view=rev Author: dbrosius Date: 2010-08-17 04:36:40 +0000 (Tue, 17 Aug 2010) Log Message: ----------- don't report WOC on synthetic fields, as an inner class can obtain a member from an owning method Modified Paths: -------------- trunk/fb-contrib/samples/WOC_Sample.java Modified: trunk/fb-contrib/samples/WOC_Sample.java =================================================================== --- trunk/fb-contrib/samples/WOC_Sample.java 2010-08-17 04:36:13 UTC (rev 1586) +++ trunk/fb-contrib/samples/WOC_Sample.java 2010-08-17 04:36:40 UTC (rev 1587) @@ -1,3 +1,5 @@ +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; @@ -2,2 +4,3 @@ import java.util.LinkedList; +import java.util.List; import java.util.Map; @@ -9,7 +12,7 @@ public class WOC_Sample { - private Set<String> memberSet = new HashSet<String>(); + private final Set<String> memberSet = new HashSet<String>(); private Set<String> fpSet; public void testWOCSimple() @@ -70,4 +73,15 @@ private void helper(int i, Map<String, String> x) { } + + public void testFPInnerClass(final Set<String> data) + { + ActionListener al = new ActionListener() + { + public void actionPerformed(ActionEvent ae) + { + data.add("Woot"); + } + }; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-08-17 04:36:20
|
Revision: 1586 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1586&view=rev Author: dbrosius Date: 2010-08-17 04:36:13 +0000 (Tue, 17 Aug 2010) Log Message: ----------- don't report WOC on synthetic fields, as an inner class can obtain a member from an owning method Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-08-08 04:25:28 UTC (rev 1585) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-08-17 04:36:13 UTC (rev 1586) @@ -143,7 +143,7 @@ @Override public void visitField(Field obj) { - if (obj.isPrivate()) { + if (obj.isPrivate() && !obj.isSynthetic()) { String sig = obj.getSignature(); if (sig.startsWith("L")) { String type = sig.substring(1, sig.length() - 1).replace('/', '.'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-08-08 04:25:35
|
Revision: 1585 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1585&view=rev Author: dbrosius Date: 2010-08-08 04:25:28 +0000 (Sun, 08 Aug 2010) Log Message: ----------- DDC_DOUBLE_DATE_COMPARISON provides wrong solution - ID: 3039854 Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2010-07-21 02:38:08 UTC (rev 1584) +++ trunk/fb-contrib/etc/messages.xml 2010-08-08 04:25:28 UTC (rev 1585) @@ -1722,7 +1722,7 @@ </pre> could become <pre> - if (!date2.before( date1 )) + if (date1.compareTo( date2 ) >= 0) </pre> and <pre> @@ -1730,7 +1730,7 @@ </pre> could become <pre> - if (!date1.after( date2 )) + if (date1.compareTo( date2 ) <= 0) </pre> and <pre> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-07-21 02:38:14
|
Revision: 1584 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1584&view=rev Author: dbrosius Date: 2010-07-21 02:38:08 +0000 (Wed, 21 Jul 2010) Log Message: ----------- spilleng Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2010-07-17 15:49:17 UTC (rev 1583) +++ trunk/fb-contrib/etc/messages.xml 2010-07-21 02:38:08 UTC (rev 1584) @@ -2801,8 +2801,8 @@ </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> + <ShortDescription>method uses the same HttpRequest parameter name but with different casing</ShortDescription> + <LongDescription>method {1} uses the same HttpRequest parameter name but with different casing</LongDescription> <Details> <![CDATA[ <p>This method fetches an HttpServletRequest parameter with a parmeter name that was used in other locations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-07-17 15:49:24
|
Revision: 1583 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1583&view=rev Author: dbrosius Date: 2010-07-17 15:49:17 +0000 (Sat, 17 Jul 2010) Log Message: ----------- remove experimental flag on some Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2010-07-17 15:45:44 UTC (rev 1582) +++ trunk/fb-contrib/etc/findbugs.xml 2010-07-17 15:49:17 UTC (rev 1583) @@ -512,8 +512,7 @@ <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE" /> <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" category="STYLE" /> - <BugPattern abbrev="SPP" type="SPP_USELESS_CASING" category="PERFORMANCE" - experimental="true" /> + <BugPattern abbrev="SPP" type="SPP_USELESS_CASING" category="PERFORMANCE" /> <BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" category="STYLE" /> <BugPattern abbrev="SPP" type="SPP_NON_ARRAY_PARM" category="CORRECTNESS" /> @@ -633,15 +632,15 @@ <BugPattern abbrev="ROOM" type="ROOM_REFLECTION_ON_OBJECT_METHODS" category="CORRECTNESS" /> <BugPattern abbrev="IPU" type="IPU_IMPROPER_PROPERTIES_USE" - category="CORRECTNESS" experimental="true" /> + category="CORRECTNESS" /> <BugPattern abbrev="IPU" type="IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY" - category="CORRECTNESS" experimental="true" /> + category="CORRECTNESS" /> <BugPattern abbrev="PCAIL" type="PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP" - category="PERFORMANCE" experimental="true" /> + category="PERFORMANCE" /> <BugPattern abbrev="WOC" type="WOC_WRITE_ONLY_COLLECTION_LOCAL" - category="CORRECTNESS" experimental="true" /> + category="CORRECTNESS" /> <BugPattern abbrev="WOC" type="WOC_WRITE_ONLY_COLLECTION_FIELD" - category="CORRECTNESS" experimental="true" /> + category="CORRECTNESS" /> <BugPattern abbrev="UVA" type="UVA_USE_VAR_ARGS" - category="STYLE" experimental="true" /> + category="STYLE" /> </FindbugsPlugin> \ 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...> - 2010-07-17 15:45:51
|
Revision: 1582 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1582&view=rev Author: dbrosius Date: 2010-07-17 15:45:44 +0000 (Sat, 17 Jul 2010) Log Message: ----------- make it a little less ugly Modified Paths: -------------- trunk/fb-contrib/htdocs/index.shtml Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2010-07-17 15:40:55 UTC (rev 1581) +++ trunk/fb-contrib/htdocs/index.shtml 2010-07-17 15:45:44 UTC (rev 1582) @@ -44,6 +44,14 @@ automatically pick up the jar file, and incorporate these detectors with its own. </p> + <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> + <img src="vbar.gif" height="12"/> + <a href="javadoc/index.html">JavaDoc</a> + <img src="vbar.gif" height="12"/> + <a href="bugdescriptions.html">Bug Descriptions</a> + <!--#include virtual="mbfg_menu.shtml" --> + <hr/> + <div style="margin: 15px; padding: 10px 5px 10px 5px; font-size: 14px; color: #4444FF;"> <p> fb-contrib can be used from the Findbugs™ Gui, Ant, or the eclipse plugin.<br/> @@ -63,12 +71,7 @@ </ul> </p> </div> - <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> - <img src="vbar.gif" height="12"/> - <a href="javadoc/index.html">JavaDoc</a> - <img src="vbar.gif" height="12"/> - <a href="bugdescriptions.html">Bug Descriptions</a> - <!--#include virtual="mbfg_menu.shtml" --> + <hr/> <img id="svn_image" src="flip1.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> Detectors added in svn<br/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-07-17 15:41:02
|
Revision: 1581 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1581&view=rev Author: dbrosius Date: 2010-07-17 15:40:55 +0000 (Sat, 17 Jul 2010) Log Message: ----------- add more info about how to install the plugin Modified Paths: -------------- trunk/fb-contrib/htdocs/index.shtml Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2010-07-16 04:29:12 UTC (rev 1580) +++ trunk/fb-contrib/htdocs/index.shtml 2010-07-17 15:40:55 UTC (rev 1581) @@ -40,10 +40,29 @@ <p>fb-contrib™ is an extra detector plugin to be used with the static bug finder FindBugs™ (findbugs.sourceforge.net). Just download the fb-contrib.jar - file, and place it in your FindBugs™' plugin directory. FindBugs™ will + file, and place it in the appropriate location based on how you wish to use it. (See below). FindBugs™ will automatically pick up the jar file, and incorporate these detectors with its own. </p> + <div style="margin: 15px; padding: 10px 5px 10px 5px; font-size: 14px; color: #4444FF;"> + <p> + fb-contrib can be used from the Findbugs™ Gui, Ant, or the eclipse plugin.<br/> + <ul> + <li style="margin-left: -10px; padding-bottom: 10px;"> + To run fb-contrib from the gui, or ant, just place the fb-contrib jar in the plugins directory inside of the + Findbugs™ directory. + </li> + <li style="margin-left: -10px;"> + To run fb-contrib from eclipse, you will need to find the plugin directory for Findbugs™ inside + of Eclipse's plugin directory. The directory will look something like + <div style="color: #FF2266; margin: 10px;"> + eclipse\plugins\edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821\plugin + </div> + depending on what version of Findbugs™ you are using. + </li> + </ul> + </p> + </div> <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> <img src="vbar.gif" height="12"/> <a href="javadoc/index.html">JavaDoc</a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-07-16 04:29:18
|
Revision: 1580 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1580&view=rev Author: dbrosius Date: 2010-07-16 04:29:12 +0000 (Fri, 16 Jul 2010) Log Message: ----------- don't report WEM for UnsupportedOperationException Modified Paths: -------------- trunk/fb-contrib/samples/WEM_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java Modified: trunk/fb-contrib/samples/WEM_Sample.java =================================================================== --- trunk/fb-contrib/samples/WEM_Sample.java 2010-07-16 04:17:14 UTC (rev 1579) +++ trunk/fb-contrib/samples/WEM_Sample.java 2010-07-16 04:29:12 UTC (rev 1580) @@ -17,5 +17,9 @@ { throw new RuntimeException("Wow"); } - + + public void fpunimpled() + { + throw new UnsupportedOperationException("fpunimpled is unimpled"); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2010-07-16 04:17:14 UTC (rev 1579) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2010-07-16 04:29:12 UTC (rev 1580) @@ -19,6 +19,8 @@ package com.mebigfatguy.fbcontrib.detect; import java.util.BitSet; +import java.util.HashSet; +import java.util.Set; import org.apache.bcel.Constants; import org.apache.bcel.Repository; @@ -37,15 +39,19 @@ public class WeakExceptionMessaging extends BytecodeScanningDetector { private static JavaClass exceptionClass; + private static final Set<String> ignorableExceptionTypes = new HashSet<String>(); + static { try { exceptionClass = Repository.lookupClass("java/lang/Exception"); } catch (ClassNotFoundException cnfe) { exceptionClass = null; } + + ignorableExceptionTypes.add("java.lang.UnsupportedOperationException"); } - private BugReporter bugReporter; + private final BugReporter bugReporter; private OpcodeStack stack; /** @@ -116,10 +122,13 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getUserValue() != null) { - bugReporter.reportBug(new BugInstance(this, "WEM_WEAK_EXCEPTION_MESSAGING", LOW_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + JavaClass exClass = item.getJavaClass(); + if ((exClass == null) || !ignorableExceptionTypes.contains(item.getJavaClass().getClassName())) { + bugReporter.reportBug(new BugInstance(this, "WEM_WEAK_EXCEPTION_MESSAGING", LOW_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } else if ((seen == LDC) || (seen == LDC_W)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-07-16 04:17:20
|
Revision: 1579 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1579&view=rev Author: dbrosius Date: 2010-07-16 04:17:14 +0000 (Fri, 16 Jul 2010) Log Message: ----------- don't report PRMC for System.currentTimeMillis Modified Paths: -------------- trunk/fb-contrib/samples/PRMC_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java Modified: trunk/fb-contrib/samples/PRMC_Sample.java =================================================================== --- trunk/fb-contrib/samples/PRMC_Sample.java 2010-07-10 19:11:41 UTC (rev 1578) +++ trunk/fb-contrib/samples/PRMC_Sample.java 2010-07-16 04:17:14 UTC (rev 1579) @@ -69,4 +69,13 @@ { } } + + public long fpCurrentTimeMillis(Object o) + { + long time = -System.currentTimeMillis(); + o.hashCode(); + time += System.currentTimeMillis(); + + return time; + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2010-07-10 19:11:41 UTC (rev 1578) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2010-07-16 04:17:14 UTC (rev 1579) @@ -21,7 +21,6 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -import java.util.Locale; import java.util.Map; import java.util.Set; @@ -80,7 +79,7 @@ if (userNameProp != null) { String[] userNames = userNameProp.split("\\s*,\\s*"); for (String name : userNames) - riskyMethodNameContents.add(name.toLowerCase(Locale.getDefault())); + riskyMethodNameContents.add(name); } Integer prop = Integer.getInteger(PRMC_HIGH_BYTECOUNT); if (prop != null) @@ -108,7 +107,7 @@ } } - private BugReporter bugReporter; + private final BugReporter bugReporter; private OpcodeStack stack = null; private Map<Integer, MethodCall> localMethodCalls = null; private Map<String, MethodCall> fieldMethodCalls = null; @@ -288,7 +287,6 @@ if (riskyClassNames.contains(className)) return true; - methodName = methodName.toLowerCase(Locale.ENGLISH); for (String riskyName : riskyMethodNameContents) { if (methodName.indexOf(riskyName) >= 0) return true; @@ -301,9 +299,9 @@ */ static class MethodCall { - private String methodName; - private String methodSignature; - private Object[] methodParms; + private final String methodName; + private final String methodSignature; + private final Object[] methodParms; public MethodCall(String name, String signature, Object[] parms) { methodName = name; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-07-10 19:11:48
|
Revision: 1578 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1578&view=rev Author: dbrosius Date: 2010-07-10 19:11:41 +0000 (Sat, 10 Jul 2010) Log Message: ----------- don't report USBR for x += y; return x; Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2010-06-09 07:14:47 UTC (rev 1577) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2010-07-10 19:11:41 UTC (rev 1578) @@ -18,6 +18,7 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.BitSet; import java.util.HashSet; import java.util.Set; @@ -29,6 +30,7 @@ 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; /** @@ -39,31 +41,54 @@ { enum State {SEEN_NOTHING, SEEN_STORE, SEEN_LOAD } - private static final Set<Integer> branchInstructions = new HashSet<Integer>(); + private static final BitSet branchInstructions = new BitSet(); + private static final BitSet binaryOps = new BitSet(); static { - branchInstructions.add(Integer.valueOf(GOTO)); - branchInstructions.add(Integer.valueOf(GOTO_W)); - branchInstructions.add(Integer.valueOf(IFEQ)); - branchInstructions.add(Integer.valueOf(IFNE)); - branchInstructions.add(Integer.valueOf(IFLT)); - branchInstructions.add(Integer.valueOf(IFGE)); - branchInstructions.add(Integer.valueOf(IFGT)); - branchInstructions.add(Integer.valueOf(IFLE)); - branchInstructions.add(Integer.valueOf(IF_ICMPEQ)); - branchInstructions.add(Integer.valueOf(IF_ICMPNE)); - branchInstructions.add(Integer.valueOf(IF_ICMPLT)); - branchInstructions.add(Integer.valueOf(IF_ICMPGE)); - branchInstructions.add(Integer.valueOf(IF_ICMPGT)); - branchInstructions.add(Integer.valueOf(IF_ICMPLE)); - branchInstructions.add(Integer.valueOf(IF_ACMPEQ)); - branchInstructions.add(Integer.valueOf(IF_ACMPNE)); - branchInstructions.add(Integer.valueOf(IFNULL)); - branchInstructions.add(Integer.valueOf(IFNONNULL)); + branchInstructions.set(GOTO); + branchInstructions.set(GOTO_W); + branchInstructions.set(IFEQ); + branchInstructions.set(IFNE); + branchInstructions.set(IFLT); + branchInstructions.set(IFGE); + branchInstructions.set(IFGT); + branchInstructions.set(IFLE); + branchInstructions.set(IF_ICMPEQ); + branchInstructions.set(IF_ICMPNE); + branchInstructions.set(IF_ICMPLT); + branchInstructions.set(IF_ICMPGE); + branchInstructions.set(IF_ICMPGT); + branchInstructions.set(IF_ICMPLE); + branchInstructions.set(IF_ACMPEQ); + branchInstructions.set(IF_ACMPNE); + branchInstructions.set(IFNULL); + branchInstructions.set(IFNONNULL); + + binaryOps.set(IADD); + binaryOps.set(LADD); + binaryOps.set(FADD); + binaryOps.set(DADD); + binaryOps.set(ISUB); + binaryOps.set(LSUB); + binaryOps.set(FSUB); + binaryOps.set(DSUB); + binaryOps.set(IMUL); + binaryOps.set(LMUL); + binaryOps.set(FMUL); + binaryOps.set(DMUL); + binaryOps.set(IDIV); + binaryOps.set(LDIV); + binaryOps.set(FDIV); + binaryOps.set(DDIV); + binaryOps.set(IREM); + binaryOps.set(LREM); + binaryOps.set(FREM); + binaryOps.set(DREM); } private final BugReporter bugReporter; private Set<Integer> branchTargets; private Set<Integer> catchTargets; + private OpcodeStack stack; private State state; private int storeReg; @@ -85,10 +110,12 @@ try { branchTargets = new HashSet<Integer>(); catchTargets = new HashSet<Integer>(); + stack = new OpcodeStack(); super.visitClassContext(classContext); } finally { branchTargets = null; catchTargets = null; + stack = null; } } /** @@ -106,6 +133,7 @@ branchTargets.clear(); CodeException[] ces = obj.getExceptionTable(); catchTargets.clear(); + stack.resetForMethodEntry(this); for (CodeException ce : ces) { if (ce.getCatchType() != 0) { catchTargets.add(Integer.valueOf(ce.getHandlerPC())); @@ -123,38 +151,58 @@ */ @Override public void sawOpcode(int seen) { - switch (state) { - case SEEN_NOTHING: - if (!catchTargets.contains(Integer.valueOf(getPC()))) { - if (lookForStore(seen)) - state = State.SEEN_STORE; - } - break; - - case SEEN_STORE: - if (branchTargets.contains(Integer.valueOf(getPC()))) { + int lhsReg = -1; + try { + switch (state) { + case SEEN_NOTHING: + if (!catchTargets.contains(Integer.valueOf(getPC()))) { + if (lookForStore(seen)) { + if (stack.getStackDepth() >= 1) { + OpcodeStack.Item item = stack.getStackItem(0); + Integer reg = (Integer)item.getUserValue(); + if ((reg == null) || (reg.intValue() != storeReg)) { + state = State.SEEN_STORE; + } + } + + } + } + break; + + case SEEN_STORE: + if (branchTargets.contains(Integer.valueOf(getPC()))) { + state = State.SEEN_NOTHING; + break; + } + + state = lookForLoad(seen) ? State.SEEN_LOAD : State.SEEN_NOTHING; + break; + + case SEEN_LOAD: + if ((seen >= IRETURN) && (seen <= ARETURN)) { + bugReporter.reportBug(new BugInstance(this, "USBR_UNNECESSARY_STORE_BEFORE_RETURN", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } state = State.SEEN_NOTHING; - break; - } - - state = lookForLoad(seen) ? State.SEEN_LOAD : State.SEEN_NOTHING; - break; + break; + } - case SEEN_LOAD: - if ((seen >= IRETURN) && (seen <= ARETURN)) { - bugReporter.reportBug(new BugInstance(this, "USBR_UNNECESSARY_STORE_BEFORE_RETURN", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } - state = State.SEEN_NOTHING; - break; + if (branchInstructions.get(seen)) { + branchTargets.add(Integer.valueOf(getBranchTarget())); + } + + lhsReg = processBinOp(seen); + + } finally { + stack.sawOpcode(this, seen); + if ((lhsReg > -1) && (stack.getStackDepth() >= 1)) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(Integer.valueOf(lhsReg)); + } } - if (branchInstructions.contains(Integer.valueOf(seen))) { - branchTargets.add(Integer.valueOf(getBranchTarget())); - } - } /** @@ -206,4 +254,21 @@ return (storeReg == loadReg); } + + /** + * looks for instructions that are binary operators, and if it is + * saves the left hand side register (if it exists) in the userValue. + * + * @param seen the opcode of the currently parsed instruction + * @return the lhs register number if it exists or -1 + */ + private int processBinOp(int seen) { + if (binaryOps.get(seen)) { + if (stack.getStackDepth() >= 2) { + OpcodeStack.Item item = stack.getStackItem(1); + return item.getRegisterNumber(); + } + } + return -1; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 07:14:54
|
Revision: 1577 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1577&view=rev Author: dbrosius Date: 2010-06-09 07:14:47 +0000 (Wed, 09 Jun 2010) Log Message: ----------- ok, good enough for now Modified Paths: -------------- trunk/fb-contrib/etc/bugdescriptions.xsl Modified: trunk/fb-contrib/etc/bugdescriptions.xsl =================================================================== --- trunk/fb-contrib/etc/bugdescriptions.xsl 2010-06-09 07:08:08 UTC (rev 1576) +++ trunk/fb-contrib/etc/bugdescriptions.xsl 2010-06-09 07:14:47 UTC (rev 1577) @@ -8,7 +8,7 @@ h1 { font-size: 30px; } ul { display: block; list-style-type: none; width: 60%; } .bugcode { font-weight: bold; font-size: 18px; padding-left: 10px; border-left: 0.5em solid #6666FF; } - .bugdetail { font-size: 16px; padding: 5px 20px 15px 40px; border-left: 1px solid #6666FF; } + .bugdetail { font-size: 16px; margin: 4px; padding: 5px 20px 15px 40px; border-left: 1px solid #6666FF; } </style> </head> <body background="true"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 07:08:14
|
Revision: 1576 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1576&view=rev Author: dbrosius Date: 2010-06-09 07:08:08 +0000 (Wed, 09 Jun 2010) Log Message: ----------- fix bugpattern messages Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2010-06-09 07:06:51 UTC (rev 1575) +++ trunk/fb-contrib/etc/messages.xml 2010-06-09 07:08:08 UTC (rev 1576) @@ -2863,8 +2863,7 @@ B[] b = new B[2]; A[] a = b; - </pre> - <p>It is a fast detector</p> + </pre> ]]> </Details> </BugPattern> @@ -2884,8 +2883,7 @@ B[] b = new B[2]; A[] a = b; a[0] = new A(); // results in ArrayStoreException (Runtime) - </pre> - <p>It is a fast detector</p> + </pre> ]]> </Details> </BugPattern> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 07:06:57
|
Revision: 1575 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1575&view=rev Author: dbrosius Date: 2010-06-09 07:06:51 +0000 (Wed, 09 Jun 2010) Log Message: ----------- even better Modified Paths: -------------- trunk/fb-contrib/etc/bugdescriptions.xsl Modified: trunk/fb-contrib/etc/bugdescriptions.xsl =================================================================== --- trunk/fb-contrib/etc/bugdescriptions.xsl 2010-06-09 06:57:16 UTC (rev 1574) +++ trunk/fb-contrib/etc/bugdescriptions.xsl 2010-06-09 07:06:51 UTC (rev 1575) @@ -6,9 +6,9 @@ <title>fb-contrib: Bug Descriptions</title> <style type="text/css"> h1 { font-size: 30px; } - ul { width: 90%; display: block; list-style-type: none;} + ul { display: block; list-style-type: none; width: 60%; } .bugcode { font-weight: bold; font-size: 18px; padding-left: 10px; border-left: 0.5em solid #6666FF; } - .bugdetail { font-size: 14px; padding: 30px 20px 20px 20px; border-left: 1px solid #6666FF; } + .bugdetail { font-size: 16px; padding: 5px 20px 15px 40px; border-left: 1px solid #6666FF; } </style> </head> <body background="true"> @@ -44,7 +44,7 @@ <xsl:value-of select="@type"/> </div> <div class="bugdetail"> - <xsl:value-of select="normalize-space(Details/text())"/> + <xsl:value-of select="normalize-space(Details/text())" disable-output-escaping="yes"/> </div> </li> </xsl:for-each> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 06:57:22
|
Revision: 1574 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1574&view=rev Author: dbrosius Date: 2010-06-09 06:57:16 +0000 (Wed, 09 Jun 2010) Log Message: ----------- slightly better xsl Modified Paths: -------------- trunk/fb-contrib/etc/bugdescriptions.xsl Modified: trunk/fb-contrib/etc/bugdescriptions.xsl =================================================================== --- trunk/fb-contrib/etc/bugdescriptions.xsl 2010-06-09 05:48:26 UTC (rev 1573) +++ trunk/fb-contrib/etc/bugdescriptions.xsl 2010-06-09 06:57:16 UTC (rev 1574) @@ -2,7 +2,15 @@ <xsl:template match="/MessageCollection"> <html> - <head><title>fb-contrib: Bug Descriptions</title></head> + <head> + <title>fb-contrib: Bug Descriptions</title> + <style type="text/css"> + h1 { font-size: 30px; } + ul { width: 90%; display: block; list-style-type: none;} + .bugcode { font-weight: bold; font-size: 18px; padding-left: 10px; border-left: 0.5em solid #6666FF; } + .bugdetail { font-size: 14px; padding: 30px 20px 20px 20px; border-left: 1px solid #6666FF; } + </style> + </head> <body background="true"> <div style="position:absolute;top:0;left:0;width:256;height:65535;z-index:1;background-image:url(blend.jpg);"> </div> @@ -10,12 +18,12 @@ <div style="position:absolute;top:20;left:20;z-index:2;"> <h1>fb-contrib: Bug Descriptions</h1> - <table border="1" width="100%"> + <ul> <xsl:for-each select="BugCode"> <xsl:sort select="@abbrev"/> <xsl:call-template name="BugCode"/> </xsl:for-each> - </table> + </ul> </div> </body> </html> @@ -31,12 +39,15 @@ <xsl:param name="abbrev"/> <xsl:for-each select="//BugPattern[starts-with(@type,$abbrev)]"> <xsl:sort select="."/> - <tr><td><b><xsl:value-of select="@type"/></b></td></tr> - <xsl:variable name="desc1"><xsl:value-of select="normalize-space(Details/text())"/></xsl:variable> - <xsl:variable name="desc2"><xsl:value-of select="substring($desc1, 9)"/></xsl:variable> - <xsl:variable name="desc"><xsl:value-of select="substring($desc2, 0, string-length($desc2) - 3)"/></xsl:variable> - <tr><td><xsl:copy-of select="$desc"/></td></tr> + <li> + <div class="bugcode"> + <xsl:value-of select="@type"/> + </div> + <div class="bugdetail"> + <xsl:value-of select="normalize-space(Details/text())"/> + </div> + </li> </xsl:for-each> </xsl:template> -</xsl:transform> \ No newline at end of file +</xsl:transform> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 05:48:32
|
Revision: 1573 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1573&view=rev Author: dbrosius Date: 2010-06-09 05:48:26 +0000 (Wed, 09 Jun 2010) Log Message: ----------- fix possible npes Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2010-06-09 05:43:09 UTC (rev 1572) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2010-06-09 05:48:26 UTC (rev 1573) @@ -155,7 +155,7 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); JavaClass exClass = itm.getJavaClass(); - if (exClass.instanceOf(runtimeClass)) { + if ((exClass != null) && exClass.instanceOf(runtimeClass)) { if (catchInfos.size() > 0) { Set<String> possibleCatchSignatures = findPossibleCatchSignatures(catchInfos, pc); if (!possibleCatchSignatures.contains(exClass.getClassName())) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-06-09 05:43:09 UTC (rev 1572) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-06-09 05:48:26 UTC (rev 1573) @@ -336,7 +336,7 @@ */ private boolean isPre14Class(JavaClass cls) { - return cls.getMajor() < Constants.MAJOR_1_4; + return (cls != null) && cls.getMajor() < Constants.MAJOR_1_4; } private void removePreviousHandlers(int pc) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-06-09 05:43:09 UTC (rev 1572) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-06-09 05:48:26 UTC (rev 1573) @@ -265,7 +265,7 @@ if ((windowClass != null) && (stack.getStackDepth() > argCount)) { OpcodeStack.Item item = stack.getStackItem(argCount); JavaClass cls = item.getJavaClass(); - if (cls.instanceOf(windowClass)) { + if ((cls != null) && cls.instanceOf(windowClass)) { bugReporter.reportBug(new BugInstance(this, "S508C_NO_SETSIZE", NORMAL_PRIORITY) .addClass(this) .addMethod(this) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java 2010-06-09 05:43:09 UTC (rev 1572) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java 2010-06-09 05:48:26 UTC (rev 1573) @@ -201,7 +201,7 @@ return false; JavaClass cls = item.getJavaClass(); - if (!cls.isEnum()) + if ((cls == null) || !cls.isEnum()) return false; //If the cls implements any interface, it's possible the collection Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-06-09 05:43:09 UTC (rev 1572) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-06-09 05:48:26 UTC (rev 1573) @@ -283,9 +283,11 @@ OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 0) { XField field = getXFieldOperand(); - String fieldName = field.getName(); - if (fieldWOCollections.containsKey(fieldName)) { - userObject = fieldName; + if (field != null) { + String fieldName = field.getName(); + if (fieldWOCollections.containsKey(fieldName)) { + userObject = fieldName; + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 05:43:16
|
Revision: 1572 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1572&view=rev Author: dbrosius Date: 2010-06-09 05:43:09 +0000 (Wed, 09 Jun 2010) Log Message: ----------- change to switch 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 2010-06-09 05:30:59 UTC (rev 1571) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2010-06-09 05:43:09 UTC (rev 1572) @@ -52,7 +52,7 @@ } } - private BugReporter bugReporter; + private final BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, WrapperInfo> wrappers; @@ -118,102 +118,162 @@ try { stack.mergeJumps(this); - if ((seen == NEWARRAY) || (seen == ANEWARRAY)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item itm = stack.getStackItem(0); - Integer size = (Integer)itm.getConstant(); - if ((size != null) && (size.intValue() == 1)) { - userValue = Integer.valueOf(-1); + switch (seen) { + case NEWARRAY: + case ANEWARRAY: { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item itm = stack.getStackItem(0); + Integer size = (Integer)itm.getConstant(); + if ((size != null) && (size.intValue() == 1)) { + userValue = Integer.valueOf(-1); + } } } - } else if ((seen >= IASTORE) && (seen <= SASTORE)) { - if (stack.getStackDepth() >= 2) { - OpcodeStack.Item itm = stack.getStackItem(2); - int reg = itm.getRegisterNumber(); - if (reg != -1) { - WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); - if (wi != null) { + break; + + case IASTORE: + case LASTORE: + case FASTORE: + case DASTORE: + case AASTORE: + case BASTORE: + case CASTORE: + case SASTORE: { + if (stack.getStackDepth() >= 2) { + OpcodeStack.Item itm = stack.getStackItem(2); + int reg = itm.getRegisterNumber(); + if (reg != -1) { + WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); + if (wi != null) { + OpcodeStack.Item elItm = stack.getStackItem(0); + wi.wrappedReg = elItm.getRegisterNumber(); + } + } else { OpcodeStack.Item elItm = stack.getStackItem(0); - wi.wrappedReg = elItm.getRegisterNumber(); + if (elItm.getRegisterNumber() != -1) + userValue = Integer.valueOf(elItm.getRegisterNumber()); } - } else { - OpcodeStack.Item elItm = stack.getStackItem(0); - if (elItm.getRegisterNumber() != -1) - userValue = Integer.valueOf(elItm.getRegisterNumber()); } } - } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { - if (stack.getStackDepth() >= 1) { - OpcodeStack.Item itm = stack.getStackItem(0); - String sig = itm.getSignature(); - if ((sig.length() > 0) && (itm.getSignature().charAt(0) == '[')) { - int reg = RegisterUtils.getAStoreReg(this, seen); - Integer elReg = (Integer)itm.getUserValue(); - if (elReg != null) - wrappers.put(Integer.valueOf(reg), new WrapperInfo(elReg.intValue())); - } else { - Integer elReg = (Integer)itm.getUserValue(); - if (elReg != null) { + break; + + case ASTORE: + case ASTORE_0: + case ASTORE_1: + case ASTORE_2: + case ASTORE_3: { + if (stack.getStackDepth() >= 1) { + OpcodeStack.Item itm = stack.getStackItem(0); + String sig = itm.getSignature(); + if ((sig.length() > 0) && (itm.getSignature().charAt(0) == '[')) { int reg = RegisterUtils.getAStoreReg(this, seen); - if (elReg.intValue() == reg) { - bugReporter.reportBug(new BugInstance(this, "AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE", NORMAL_PRIORITY ) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + Integer elReg = (Integer)itm.getUserValue(); + if (elReg != null) + wrappers.put(Integer.valueOf(reg), new WrapperInfo(elReg.intValue())); + } else { + Integer elReg = (Integer)itm.getUserValue(); + if (elReg != null) { + int reg = RegisterUtils.getAStoreReg(this, seen); + if (elReg.intValue() == reg) { + bugReporter.reportBug(new BugInstance(this, "AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE", NORMAL_PRIORITY ) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } } - } else if ((seen == INVOKEVIRTUAL) - || (seen == INVOKEINTERFACE) - || (seen == INVOKESPECIAL) - || (seen == INVOKESTATIC)) { - String sig = getSigConstantOperand(); - Type[] args = Type.getArgumentTypes(sig); - if (stack.getStackDepth() >= args.length) { - for (int i = 0; i < args.length; i++) { - Type t = args[i]; - String argSig = t.getSignature(); - if ((argSig.length() > 0) && (argSig.charAt(0) == '[')) { - OpcodeStack.Item itm = stack.getStackItem(args.length - i - 1); - int arrayReg = itm.getRegisterNumber(); - WrapperInfo wi = wrappers.get(Integer.valueOf(arrayReg)); - if (wi != null) - wi.wasArg = true; + break; + + case INVOKEVIRTUAL: + case INVOKEINTERFACE: + case INVOKESPECIAL: + case INVOKESTATIC: { + String sig = getSigConstantOperand(); + Type[] args = Type.getArgumentTypes(sig); + if (stack.getStackDepth() >= args.length) { + for (int i = 0; i < args.length; i++) { + Type t = args[i]; + String argSig = t.getSignature(); + if ((argSig.length() > 0) && (argSig.charAt(0) == '[')) { + OpcodeStack.Item itm = stack.getStackItem(args.length - i - 1); + int arrayReg = itm.getRegisterNumber(); + WrapperInfo wi = wrappers.get(Integer.valueOf(arrayReg)); + if (wi != null) + wi.wasArg = true; + } } } } - } else if ((seen >= IALOAD) && (seen <= SALOAD)) { - if (stack.getStackDepth() >= 2) { - OpcodeStack.Item arItm = stack.getStackItem(1); - int arReg = arItm.getRegisterNumber(); - WrapperInfo wi = wrappers.get(Integer.valueOf(arReg)); - if ((wi != null) && wi.wasArg) { - userValue = Integer.valueOf(wi.wrappedReg); + break; + + case IALOAD: + case LALOAD: + case FALOAD: + case DALOAD: + case AALOAD: + case BALOAD: + case CALOAD: + case SALOAD: { + if (stack.getStackDepth() >= 2) { + OpcodeStack.Item arItm = stack.getStackItem(1); + int arReg = arItm.getRegisterNumber(); + WrapperInfo wi = wrappers.get(Integer.valueOf(arReg)); + if ((wi != null) && wi.wasArg) { + 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(Integer.valueOf(reg)); - if (wi != null) - 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))) - || ((seen == FSTORE) || ((seen >= FSTORE_0) && (seen <= FSTORE_3)))) { - if (stack.getStackDepth() >= 1) { - OpcodeStack.Item itm = stack.getStackItem(0); - Integer elReg = (Integer)itm.getUserValue(); - if (elReg != null) { - int reg = RegisterUtils.getStoreReg(this, seen); - if (elReg.intValue() == reg) { - bugReporter.reportBug(new BugInstance(this, "AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE", NORMAL_PRIORITY ) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + break; + + case ALOAD: + case ALOAD_0: + case ALOAD_1: + case ALOAD_2: + case ALOAD_3: { + int reg = RegisterUtils.getALoadReg(this, seen); + WrapperInfo wi = wrappers.get(Integer.valueOf(reg)); + if (wi != null) + userValue = Integer.valueOf(wi.wrappedReg); + } + break; + + case ISTORE: + case ISTORE_0: + case ISTORE_1: + case ISTORE_2: + case ISTORE_3: + case LSTORE: + case LSTORE_0: + case LSTORE_1: + case LSTORE_2: + case LSTORE_3: + case DSTORE: + case DSTORE_0: + case DSTORE_1: + case DSTORE_2: + case DSTORE_3: + case FSTORE: + case FSTORE_0: + case FSTORE_1: + case FSTORE_2: + case FSTORE_3: { + if (stack.getStackDepth() >= 1) { + OpcodeStack.Item itm = stack.getStackItem(0); + Integer elReg = (Integer)itm.getUserValue(); + if (elReg != null) { + int reg = RegisterUtils.getStoreReg(this, seen); + if (elReg.intValue() == reg) { + bugReporter.reportBug(new BugInstance(this, "AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE", NORMAL_PRIORITY ) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } + 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...> - 2010-06-09 05:31:06
|
Revision: 1571 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1571&view=rev Author: dbrosius Date: 2010-06-09 05:30:59 +0000 (Wed, 09 Jun 2010) Log Message: ----------- LEST Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/XClassUtils.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/XClassUtils.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/XClassUtils.java 2010-06-09 04:54:33 UTC (rev 1570) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/XClassUtils.java 2010-06-09 05:30:59 UTC (rev 1571) @@ -46,7 +46,9 @@ return Global.getAnalysisCache().getClassAnalysis(XClass.class, classDesc); } catch (CheckedAnalysisException e) { - throw new AssertionError("Can't find ClassInfo for " + classDesc); + AssertionError ae = new AssertionError("Can't find ClassInfo for " + classDesc); + ae.initCause(e); + throw(ae); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 04:54:40
|
Revision: 1570 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1570&view=rev Author: dbrosius Date: 2010-06-09 04:54:33 +0000 (Wed, 09 Jun 2010) Log Message: ----------- move to 4.5.0 development Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2010-06-09 04:53:45 UTC (rev 1569) +++ trunk/fb-contrib/build.xml 2010-06-09 04:54:33 UTC (rev 1570) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="4.4.0"/> + <property name="fb-contrib.version" value="4.5.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-09 04:53:53
|
Revision: 1569 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1569&view=rev Author: dbrosius Date: 2010-06-09 04:53:45 +0000 (Wed, 09 Jun 2010) Log Message: ----------- warnings Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.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/MoreDumbMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -28,7 +28,7 @@ { private int numMethodCalls; - public CollectStatistics(BugReporter bugReporter) { + public CollectStatistics(@SuppressWarnings("unused") BugReporter bugReporter) { Statistics.getStatistics().clear(); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -202,11 +202,11 @@ * catch exceptions that are thrown, but doing so would be prohibitively slow. * But it should catch some problems. * - * @param fbInfo the finally block the pc is currently in + * @param fBlockInfo the finally block the pc is currently in * * @return if all exceptions are caught inside this finally block */ - private boolean catchBlockInFinally(FinallyBlockInfo fbInfo) { + private boolean catchBlockInFinally(FinallyBlockInfo fBlockInfo) { CodeException[] catchExceptions = getCode().getExceptionTable(); if ((catchExceptions == null) || (catchExceptions.length == 0)) @@ -215,7 +215,7 @@ int pc = getPC(); for (CodeException ex : catchExceptions) { if ((ex.getStartPC() <= pc) && (ex.getEndPC() >= pc)) { - if (ex.getStartPC() >= fbInfo.startPC) { + if (ex.getStartPC() >= fBlockInfo.startPC) { return true; } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -35,7 +35,7 @@ */ public class AbstractClassEmptyMethods extends BytecodeScanningDetector { - enum State {SAW_NOTHING, SAW_NEW, SAW_DUP, SAW_LDC, SAW_INVOKESPECIAL, SAW_DONE}; + enum State {SAW_NOTHING, SAW_NEW, SAW_DUP, SAW_LDC, SAW_INVOKESPECIAL, SAW_DONE} private static JavaClass EXCEPTION_CLASS; static { @@ -45,7 +45,7 @@ //ignore } } - private BugReporter bugReporter; + private final BugReporter bugReporter; private String methodName; private State state; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -41,7 +41,7 @@ */ public class ConstantListIndex extends BytecodeScanningDetector { - enum State {SAW_NOTHING, SAW_CONSTANT_0, SAW_CONSTANT}; + enum State {SAW_NOTHING, SAW_CONSTANT_0, SAW_CONSTANT} private static final String MAX_ICONST0_LOOP_DISTANCE_PROPERTY = "fb-contrib.cli.maxloopdistance"; private static final Set<String> ubiquitousMethods = new HashSet<String>(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -64,14 +64,14 @@ /** * overrides the visitor to accept classes derived from non java.lang.Object classes. * - * @param classContext the context object of the currently parsed class + * @param clsContext the context object of the currently parsed class */ - public void visitClassContext(ClassContext classContext) { + public void visitClassContext(ClassContext clsContext) { try { - JavaClass cls = classContext.getJavaClass(); + JavaClass cls = clsContext.getJavaClass(); String superName = cls.getSuperclassName(); if (!"java.lang.Object".equals(superName)) { - this.classContext = classContext; + this.classContext = clsContext; superclassCode = new HashMap<String, Code>(); JavaClass superCls = cls.getSuperClass(); childPoolGen = new ConstantPoolGen(cls.getConstantPool()); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -35,7 +35,7 @@ */ public class DateComparison extends BytecodeScanningDetector { - enum State {SAW_NOTHING, SAW_LOAD1_1, SAW_LOAD1_2, SAW_CMP1, SAW_IFNE, SAW_LOAD2_1, SAW_LOAD2_2, SAW_CMP2}; + enum State {SAW_NOTHING, SAW_LOAD1_1, SAW_LOAD1_2, SAW_CMP1, SAW_IFNE, SAW_LOAD2_1, SAW_LOAD2_2, SAW_CMP2} private static final Set<String> dateClasses = new HashSet<String>(); static { @@ -44,7 +44,7 @@ dateClasses.add("java.sql.Timestamp"); } - private BugReporter bugReporter; + private final BugReporter bugReporter; private State state; private int register1_1; private int register1_2; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -39,7 +39,7 @@ */ public class DeprecatedTypesafeEnumPattern extends BytecodeScanningDetector { - enum State {SAW_NOTHING, SAW_INVOKESPECIAL, SAW_BUG}; + enum State {SAW_NOTHING, SAW_INVOKESPECIAL, SAW_BUG} private final BugReporter bugReporter; private int firstEnumPC; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -250,11 +250,11 @@ /** remove catchinfo blocks from the map where the handler end is before the current pc * - * @param catchInfos the exception handlers installed + * @param infos the exception handlers installed * @param pc the current pc */ - private void removeFinishedCatchBlocks(List<CatchInfo> catchInfos, int pc) { - Iterator<CatchInfo> it = catchInfos.iterator(); + private void removeFinishedCatchBlocks(List<CatchInfo> infos, int pc) { + Iterator<CatchInfo> it = infos.iterator(); while (it.hasNext()) { if (it.next().getFinish() < pc) it.remove(); @@ -263,13 +263,13 @@ /** reduces the end pc based on the optional LocalVariableTable's exception register scope * - * @param catchInfos the list of active catch blocks + * @param infos the list of active catch blocks * @param pc the current pc */ - private void updateEndPCsOnCatchRegScope(List<CatchInfo> catchInfos, int pc, int seen) + private void updateEndPCsOnCatchRegScope(List<CatchInfo> infos, int pc, int seen) { if (lvt != null) { - for (CatchInfo ci : catchInfos) { + for (CatchInfo ci : infos) { if (ci.getStart() == pc) { if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { int exReg = RegisterUtils.getAStoreReg(this, seen); @@ -286,13 +286,13 @@ /** returns an array of catch types that the current pc is in * - * @param catchInfos the list of catch infos for this method + * @param infos the list of catch infos for this method * @param pc the current pc * @return an set of catch exception types that the pc is currently in */ - public Set<String> findPossibleCatchSignatures(List<CatchInfo> catchInfos, int pc) { + public Set<String> findPossibleCatchSignatures(List<CatchInfo> infos, int pc) { Set<String> catchTypes = new HashSet<String>(); - ListIterator<CatchInfo> it = catchInfos.listIterator(catchInfos.size()); + ListIterator<CatchInfo> it = infos.listIterator(infos.size()); while (it.hasPrevious()) { CatchInfo ci = it.previous(); if ((pc >= ci.getStart()) && (pc < ci.getFinish())) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -37,7 +37,7 @@ */ public class FloatingPointLoops extends BytecodeScanningDetector { - enum State {SAW_LOAD, SAW_CMPX, SAW_IFX, SAW_STORE}; + enum State {SAW_LOAD, SAW_CMPX, SAW_IFX, SAW_STORE} BugReporter bugReporter; private Set<FloatForLoop> forLoops = new HashSet<FloatForLoop>(); @@ -91,8 +91,8 @@ public class FloatForLoop { private State state; - private int loopPC; - private int loopReg; + private final int loopPC; + private final int loopReg; private int gotoPC; public FloatForLoop(int reg, int pc) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -35,7 +35,7 @@ */ public class ImproperPropertiesUse extends BytecodeScanningDetector { - private BugReporter bugReporter; + private final BugReporter bugReporter; private OpcodeStack stack; /** @@ -51,6 +51,7 @@ * * @param classContext the context object of the currently parsed class */ + @Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); @@ -65,6 +66,7 @@ * * @param obj the context object for the currently parsed code block */ + @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); super.visitCode(obj); @@ -76,6 +78,8 @@ * * @param seen the currently parsed op code */ + + @Override public void sawOpcode(int seen) { try { if (seen == INVOKEVIRTUAL) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -63,7 +63,7 @@ public String getDescription() { return key; } - }; + } BugReporter bugReporter; OpcodeStack stack; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -142,12 +142,12 @@ /** * collects all the valid exception objects (ones where start and finish are before the target * - * @param exceptions the exceptions from the class file + * @param exs the exceptions from the class file * @return the filtered exceptions */ - public CodeException[] collectExceptions(CodeException[] exceptions) { + public CodeException[] collectExceptions(CodeException[] exs) { List<CodeException> filteredEx = new ArrayList<CodeException>(); - for (CodeException ce : exceptions) { + for (CodeException ce : exs) { if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) { filteredEx.add(ce); } @@ -303,10 +303,10 @@ /** returns whether the method called might be a method that builds an exception using * the original exception. It does so by looking to see if the method returns an exception, * and if one of the parameters is the original exception - * @param exReg the register of the original exception caught + * @param excReg the register of the original exception caught * @return whether this method call could be an exception builder method */ - public boolean isPossibleExBuilder(int exReg) throws ClassNotFoundException { + public boolean isPossibleExBuilder(int excReg) throws ClassNotFoundException { String sig = getSigConstantOperand(); Type returnType = Type.getReturnType(sig); String returnSig = returnType.getSignature(); @@ -318,7 +318,7 @@ if (stack.getStackDepth() >= numParms) { for (int p = 0; p < numParms; p++) { OpcodeStack.Item item = stack.getStackItem(p); - if (item.getRegisterNumber() == exReg) + if (item.getRegisterNumber() == excReg) { return true; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -37,7 +37,7 @@ */ public class MisleadingOverloadModel extends PreorderVisitor implements Detector { - enum MethodFoundType {Instance, Static, Both}; + enum MethodFoundType {Instance, Static, Both} private final BugReporter bugReporter; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -22,12 +22,9 @@ import java.util.HashMap; import java.util.Map; -import com.mebigfatguy.fbcontrib.utils.XClassUtils; - import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; -import edu.umd.cs.findbugs.ba.XMethod; /** * looks for method calls that are unsafe or might indicate bugs. @@ -35,8 +32,8 @@ public class MoreDumbMethods extends BytecodeScanningDetector { private static class ReportInfo { - private String bugPattern; - private int bugPriority; + private final String bugPattern; + private final int bugPriority; ReportInfo(String pattern, int priority) { bugPattern = pattern; @@ -115,7 +112,6 @@ } private final BugReporter bugReporter; - private final XClassUtils classUtil = new XClassUtils(); /** * constructs an MDM detector given the reporter to report bugs on @@ -137,18 +133,6 @@ reportBug(info); } } - -// ReportInfo info = null; -// if (seen == INVOKESPECIAL || seen == INVOKESTATIC) { -// // static method invocation: no dispatch, straight call -// info = dumbMethods.get(getMethodSignature()); -// } else if (seen == INVOKEVIRTUAL || seen == INVOKEINTERFACE) { -// // virtual method invocation: dispatch is based on the class -// info = dumbMethods.get(getVirtualMethodSignature()); -// } -// if (info != null) { -// reportBug(info); -// } } private String getMethodSignature() { @@ -157,20 +141,8 @@ final String methodSig = getSigConstantOperand(); return String.format("%s.%s%s", className, methodName, methodSig); } - - private String getVirtualMethodSignature() { - final XMethod declaredMethod = classUtil.getXMethod( - getClassConstantOperand(), getNameConstantOperand(), - getSigConstantOperand()); - final String className = declaredMethod.getClassDescriptor() - .getClassName(); - final String methodName = declaredMethod.getName(); - final String methodSig = declaredMethod.getSignature(); - return String.format("%s.%s%s", className, methodName, methodSig); - } - private void reportBug(ReportInfo info) { bugReporter.reportBug(new BugInstance(this, info.getPattern(), info.getPriority()) .addClass(this) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -123,7 +123,7 @@ * @return the map of possible attributes/types */ private Map<String, String> getAttributes(JavaClass cls) { - Map<String, String> attributes = new HashMap<String, String>(); + Map<String, String> atts = new HashMap<String, String>(); Method[] methods = cls.getMethods(); for (Method m : methods) { String name = m.getName(); @@ -136,13 +136,13 @@ if (validAttrTypes.contains(parmSig)) { Code code = m.getCode(); if ((code != null) && (code.getCode().length < MAX_ATTRIBUTE_CODE_LENGTH)) { - attributes.put(name + ":" + sig, parmSig); + atts.put(name + ":" + sig, parmSig); } } } } } - return attributes; + return atts; } /** Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -34,7 +34,7 @@ public class PossibleConstantAllocationInLoop extends BytecodeScanningDetector { - private BugReporter bugReporter; + private final BugReporter bugReporter; private OpcodeStack stack; /** allocation number, info where allocated */ private Map<Integer, AllocationInfo> allocations; @@ -46,6 +46,7 @@ this.bugReporter = bugReporter; } + @Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); @@ -59,6 +60,7 @@ } } + @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); allocations.clear(); @@ -74,9 +76,9 @@ .addSourceLine(getClassContext(), this, info.allocationPC)); } } - } - + + @Override public void sawOpcode(int seen) { boolean sawAllocation = false; Integer sawAllocationNumber = null; @@ -117,12 +119,12 @@ if ("<init>".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) { String clsName = getClassConstantOperand(); if (!"java/lang/StringBuffer".equals(clsName) && !"java/lang/StringBuilder".equals(clsName)) { - allocations.put(Integer.valueOf(nextAllocationNumber), new AllocationInfo(getPC())); + sawAllocationNumber = Integer.valueOf(nextAllocationNumber); + allocations.put(sawAllocationNumber, new AllocationInfo(getPC())); sawAllocation = true; - sawAllocationNumber = nextAllocationNumber; } } - //FALL_THRU + //$FALL-THROUGH$ case INVOKEINTERFACE: case INVOKEVIRTUAL: Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -197,10 +197,10 @@ XField field = itm.getXField(); if (field != null) { if (bloatableFields.containsKey(field)) { - String methodName = getNameConstantOperand(); - if (decreasingMethods.contains(methodName)) { + String mName = getNameConstantOperand(); + if (decreasingMethods.contains(mName)) { bloatableFields.remove(field); - } else if (increasingMethods.contains(methodName)) { + } else if (increasingMethods.contains(mName)) { if (bloatableFields.get(field) == null) { SourceLineAnnotation sla = SourceLineAnnotation.fromVisitedInstruction(this); bloatableFields.put(field, sla); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -255,7 +255,7 @@ } else { if (reg >= 0) { localMethodCalls.remove(Integer.valueOf(reg)); - } else { + } else if (field != null) { fieldMethodCalls.remove(field.getName()); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -47,9 +47,9 @@ static { queryMethods.add("execute"); queryMethods.add("executeQuery"); - }; + } - private BugReporter bugReporter; + private final BugReporter bugReporter; List<Integer> queryLocations; List<LoopLocation> loops; @@ -127,8 +127,8 @@ * holds the start and end position of a loop */ private static class LoopLocation { - private int startPC; - private int endPC; + private final int startPC; + private final int endPC; public LoopLocation(int start, int end) { startPC = start; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -191,9 +191,9 @@ || (seen == INVOKESPECIAL) || (seen == INVOKESTATIC)) { String clsName = getClassConstantOperand(); - String methodName = getNameConstantOperand(); - String methodInfo = clsName + ":" + methodName; - String thisMethodInfo = (clsName.equals(getClassName())) ? (methodName + ":" + methodSig) : "0"; + String mName = getNameConstantOperand(); + String methodInfo = clsName + ":" + mName; + String thisMethodInfo = (clsName.equals(getClassName())) ? (mName + ":" + methodSig) : "0"; if (expensiveCalls.contains(methodInfo) || expensiveThisCalls.contains(thisMethodInfo)) { if (isListenerMethod) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -174,15 +174,15 @@ /** * looks for duplicate arguments that are not constants * - * @param stack the stack to look thru + * @param opStack the stack to look thru * @param parms the arguments to the method being called * @return if there are duplicates */ - private boolean duplicateArguments(OpcodeStack stack, Type[] parms) + private boolean duplicateArguments(OpcodeStack opStack, Type[] parms) { Set<String> args = new HashSet<String>(); for (int i = 0; i < parms.length; i++) { - OpcodeStack.Item item = stack.getStackItem(i); + OpcodeStack.Item item = opStack.getStackItem(i); String signature = item.getSignature(); if (signature.startsWith("L") && !signature.startsWith("Ljava/lang/") && (item.getConstant() == null)) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -42,7 +42,7 @@ private static Map<JavaClass, String> compareClasses = new HashMap<JavaClass, String>(); static { try { - compareClasses.put(Repository.lookupClass("java/lang/Comparable"), "compareTo:1:I");; + compareClasses.put(Repository.lookupClass("java/lang/Comparable"), "compareTo:1:I"); compareClasses.put(Repository.lookupClass("java/util/Comparator"), "compare:2:I"); } catch (ClassNotFoundException cnfe) { } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -159,8 +159,8 @@ private Method findCalledMethod() { try { - JavaClass cls = Repository.lookupClass(getClassConstantOperand()); - Method[] methods = cls.getMethods(); + JavaClass clss = Repository.lookupClass(getClassConstantOperand()); + Method[] methods = clss.getMethods(); String calledMethod = getNameConstantOperand(); String calledSignature = getSigConstantOperand(); for (Method m : methods) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -212,9 +212,9 @@ } } - private boolean syncIsMap(Object syncObject, Object collectionInfo) { - if ((syncObject != null) && (collectionInfo != null) && syncObject.getClass().equals(collectionInfo.getClass())) - return syncObject.equals(collectionInfo); + private boolean syncIsMap(Object syncObject, Object colInfo) { + if ((syncObject != null) && (colInfo != null) && syncObject.getClass().equals(colInfo.getClass())) + return syncObject.equals(colInfo); //Something went wrong... don't report return true; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -31,7 +31,7 @@ public class UseVarArgs extends PreorderVisitor implements Detector { - private BugReporter bugReporter; + private final BugReporter bugReporter; private JavaClass javaClass; public UseVarArgs(BugReporter bugReporter) { @@ -49,6 +49,7 @@ } } + @Override public void visitMethod(Method obj) { try { if (obj.isSynthetic()) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-06-07 02:59:33 UTC (rev 1568) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java 2010-06-09 04:53:45 UTC (rev 1569) @@ -242,7 +242,7 @@ if (uo != null) { if (uo instanceof Boolean) { int reg = RegisterUtils.getAStoreReg(this, seen); - localWOCollections.put(reg, Integer.valueOf(getPC())); + localWOCollections.put(Integer.valueOf(reg), Integer.valueOf(getPC())); } else { clearUserValue(item); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-07 02:59:40
|
Revision: 1568 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1568&view=rev Author: dbrosius Date: 2010-06-07 02:59:33 +0000 (Mon, 07 Jun 2010) Log Message: ----------- sigh Modified Paths: -------------- trunk/fb-contrib/htdocs/mbfg_menu.shtml Modified: trunk/fb-contrib/htdocs/mbfg_menu.shtml =================================================================== --- trunk/fb-contrib/htdocs/mbfg_menu.shtml 2010-06-07 02:21:00 UTC (rev 1567) +++ trunk/fb-contrib/htdocs/mbfg_menu.shtml 2010-06-07 02:59:33 UTC (rev 1568) @@ -12,7 +12,7 @@ <li><a href="http://schemalizer.sf.net">Schemalizer</a></li> <li><a href="http://tomailer.sf.net">ToMailer</a></li> <li><a href="http://jd4a.sf.net">JavaDoc for Android</a></li> - <il><a href="http://damus.sf.net">Damus</a></il> + <il><a href="http://damus.sf.net">Damus</a></li> <li><a href="http://www.heartofgoldfarm.com">Heart of Gold Farm</a></li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-07 02:21:06
|
Revision: 1567 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1567&view=rev Author: dbrosius Date: 2010-06-07 02:21:00 +0000 (Mon, 07 Jun 2010) Log Message: ----------- add damus Modified Paths: -------------- trunk/fb-contrib/htdocs/mbfg_menu.shtml Modified: trunk/fb-contrib/htdocs/mbfg_menu.shtml =================================================================== --- trunk/fb-contrib/htdocs/mbfg_menu.shtml 2010-06-05 23:59:03 UTC (rev 1566) +++ trunk/fb-contrib/htdocs/mbfg_menu.shtml 2010-06-07 02:21:00 UTC (rev 1567) @@ -12,6 +12,7 @@ <li><a href="http://schemalizer.sf.net">Schemalizer</a></li> <li><a href="http://tomailer.sf.net">ToMailer</a></li> <li><a href="http://jd4a.sf.net">JavaDoc for Android</a></li> + <il><a href="http://damus.sf.net">Damus</a></il> <li><a href="http://www.heartofgoldfarm.com">Heart of Gold Farm</a></li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-06-05 23:59:09
|
Revision: 1566 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1566&view=rev Author: dbrosius Date: 2010-06-05 23:59:03 +0000 (Sat, 05 Jun 2010) Log Message: ----------- Tag the 4.4.0 release Added Paths: ----------- tags/v4_4_0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |