fb-contrib-commit Mailing List for fb-contrib (Page 14)
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-02-12 19:06:53
|
Revision: 1515 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1515&view=rev Author: dbrosius Date: 2010-02-12 19:06:45 +0000 (Fri, 12 Feb 2010) Log Message: ----------- add NIR fp 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-02-07 16:55:10 UTC (rev 1514) +++ trunk/fb-contrib/samples/NIR_Sample.java 2010-02-12 19:06:45 UTC (rev 1515) @@ -1,4 +1,6 @@ +import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JPanel; @SuppressWarnings("all") public class NIR_Sample extends JFrame @@ -19,4 +21,14 @@ { System.out.println(getColorModel().TRANSLUCENT); } + + 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); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-02-07 16:55:17
|
Revision: 1514 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1514&view=rev Author: dbrosius Date: 2010-02-07 16:55:10 +0000 (Sun, 07 Feb 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-01-25 14:16:22 UTC (rev 1513) +++ trunk/fb-contrib/etc/messages.xml 2010-02-07 16:55:10 UTC (rev 1514) @@ -2414,7 +2414,7 @@ <BugPattern type="UAA_USE_ADD_ALL"> <ShortDescription>method uses simple loop to copy contents of one collection to another</ShortDescription> - <LongDescription>method {1} uses simple loop to copy contents of one colleciton to another</LongDescription> + <LongDescription>method {1} uses simple loop to copy contents of one collection to another</LongDescription> <Details> <![CDATA[ <p>This method uses a simple for loop to copy the contents of a set, list, map key/value, array or other collection This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-25 14:16:41
|
Revision: 1513 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1513&view=rev Author: dbrosius Date: 2010-01-25 14:16:22 +0000 (Mon, 25 Jan 2010) Log Message: ----------- the ant task doesn't honor the hidden tag -- egads, so use commenting Modified Paths: -------------- tags/v4_2_0/etc/findbugs.xml Modified: tags/v4_2_0/etc/findbugs.xml =================================================================== --- tags/v4_2_0/etc/findbugs.xml 2010-01-25 02:13:06 UTC (rev 1512) +++ tags/v4_2_0/etc/findbugs.xml 2010-01-25 14:16:22 UTC (rev 1513) @@ -112,10 +112,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> - +<!-- <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> - +--> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> @@ -210,10 +210,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast" reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING" /> - +<!-- <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> - +--> <Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCI_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" /> @@ -279,10 +279,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> - +<!-- <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> - +--> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -305,17 +305,17 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> - +<!-- <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> - +--> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> - +<!-- <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousNullGuard" speed="fast" hidden="true" reports="SNG_SUSPICIOUS_NULL_FIELD_GUARD,SNG_SUSPICIOUS_NULL_LOCAL_GUARD" /> - +--> <Detector class="com.mebigfatguy.fbcontrib.detect.MoreDumbMethods" speed="fast" reports="MDM_RUNTIME_EXIT_OR_HALT,MDM_RUNFINALIZATION,EQ_BIGDECIMAL_EQUALS,MDM_INETADDRESS_GETLOCALHOST,MDM_PROMISCUOUS_SERVERSOCKET,MDM_RANDOM_SEED,MDM_SECURERANDOM_CTOR,MDM_SECURERANDOM_GETSEED,MDM_THREAD_PRIORITIES,MDM_THREAD_YIELD,MDM_WAIT_WITHOUT_TIMEOUT,MDM_THREAD_FAIRNESS,MDM_REENTRANTLOCK_HELDBY,MDM_STRING_BYTES_ENCODING,MDM_SETDEFAULTLOCALE" /> @@ -604,4 +604,4 @@ category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="MDM" type="MDM_SECURERANDOM" category="CORRECTNESS" experimental="true" /> -</FindbugsPlugin> \ No newline at end of file +</FindbugsPlugin> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-25 02:13:14
|
Revision: 1512 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1512&view=rev Author: dbrosius Date: 2010-01-25 02:13:06 +0000 (Mon, 25 Jan 2010) Log Message: ----------- more translation patterns Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-25 02:08:58 UTC (rev 1511) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-25 02:13:06 UTC (rev 1512) @@ -96,6 +96,11 @@ displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Frame;Ljava/lang/String;ZLjava/awt/GraphicsConfiguration;)", Integer.valueOf(2)); displayTextMethods.put("java/awt/Dialog#setTitle(Ljava/lang/String;)", Integer.valueOf(0)); displayTextMethods.put("java/awt/Frame#setTitle(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;Z)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;I)", Integer.valueOf(1)); } private final BugReporter bugReporter; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-25 02:09:04
|
Revision: 1511 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1511&view=rev Author: dbrosius Date: 2010-01-25 02:08:58 +0000 (Mon, 25 Jan 2010) Log Message: ----------- add more translation patterns Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-25 02:01:27 UTC (rev 1510) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-25 02:08:58 UTC (rev 1511) @@ -88,6 +88,14 @@ displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1)); displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;)", Integer.valueOf(0)); displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;Ljava/awt/GraphicsConfiguration;)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;Z)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;ZLjava/awt/GraphicsConfiguration;)", Integer.valueOf(2)); + displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Frame;Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Frame;Ljava/lang/String;Z)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Frame;Ljava/lang/String;ZLjava/awt/GraphicsConfiguration;)", Integer.valueOf(2)); + displayTextMethods.put("java/awt/Dialog#setTitle(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("java/awt/Frame#setTitle(Ljava/lang/String;)", Integer.valueOf(0)); } private final BugReporter bugReporter; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-25 02:01:36
|
Revision: 1510 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1510&view=rev Author: dbrosius Date: 2010-01-25 02:01:27 +0000 (Mon, 25 Jan 2010) Log Message: ----------- add S508C_NON_TRANSLATABLE_STRING Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2010-01-24 16:48:56 UTC (rev 1509) +++ trunk/fb-contrib/etc/findbugs.xml 2010-01-25 02:01:27 UTC (rev 1510) @@ -160,7 +160,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.Section508Compliance" speed="fast" - reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR" /> + reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR,S508C_NON_TRANSLATABLE_STRING" /> <Detector class="com.mebigfatguy.fbcontrib.detect.UseEnumCollections" speed="fast" reports="UEC_USE_ENUM_COLLECTIONS" /> @@ -436,6 +436,8 @@ category="CORRECTNESS" /> <BugPattern abbrev="S508C" type="S508C_SET_COMP_COLOR" category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_NON_TRANSLATABLE_STRING" + category="CORRECTNESS" /> <BugPattern abbrev="UEC" type="UEC_USE_ENUM_COLLECTIONS" category="PERFORMANCE" /> <BugPattern abbrev="SIL" type="SIL_SQL_IN_LOOP" category="PERFORMANCE" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2010-01-24 16:48:56 UTC (rev 1509) +++ trunk/fb-contrib/etc/messages.xml 2010-01-25 02:01:27 UTC (rev 1510) @@ -1870,6 +1870,18 @@ </Details> </BugPattern> + <BugPattern type="S508C_NON_TRANSLATABLE_STRING"> + <ShortDescription>Method passes constant string to title/label of component</ShortDescription> + <LongDescription>Method {1} passes constant string to title/label of component</LongDescription> + <Details> + <![CDATA[ + <p>This method creates a component and passes a string literal to the title or label + of the component. As this string will be shown to users, it should be internationalizable + through the use of a resource bundle.</p> + ]]> + </Details> + </BugPattern> + <BugPattern type="UEC_USE_ENUM_COLLECTIONS"> <ShortDescription>Class uses an ordinary set or map with an enum class as the key</ShortDescription> <LongDescription>Class {0} uses an ordinary set or map with an enum class as the key</LongDescription> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-24 16:48:56 UTC (rev 1509) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-25 02:01:27 UTC (rev 1510) @@ -78,6 +78,18 @@ clsNFException = cnfe; } } + + private static final Map<String, Integer> displayTextMethods = new HashMap<String, Integer>(); + static { + displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;Ljavax/swing/Icon;I)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;I)", Integer.valueOf(2)); + displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;Ljava/awt/GraphicsConfiguration;)", Integer.valueOf(1)); + } + private final BugReporter bugReporter; private OpcodeStack stack; private Set<XField> fieldLabels; @@ -265,6 +277,28 @@ } } } + + if ((seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKEINTERFACE)) { + StringBuilder methodInfo = new StringBuilder(); + methodInfo.append(getClassConstantOperand()); + methodInfo.append("#"); + methodInfo.append(getNameConstantOperand()); + String signature = getSigConstantOperand(); + signature = signature.substring(0, signature.indexOf(')') + 1); + methodInfo.append(signature); + Integer parmIndex = displayTextMethods.get(methodInfo.toString()); + if (parmIndex != null) { + if (stack.getStackDepth() >= parmIndex.intValue()) { + OpcodeStack.Item item = stack.getStackItem(parmIndex.intValue()); + if (item.getConstant() != null) { + bugReporter.reportBug(new BugInstance(this, "S508C_NON_TRANSLATABLE_STRING", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-24 16:49:05
|
Revision: 1509 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1509&view=rev Author: dbrosius Date: 2010-01-24 16:48:56 +0000 (Sun, 24 Jan 2010) Log Message: ----------- report cnfe's Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-24 00:34:52 UTC (rev 1508) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-24 16:48:56 UTC (rev 1509) @@ -51,26 +51,31 @@ private static JavaClass componentClass; private static JavaClass jcomponentClass; private static JavaClass accessibleClass; + private static ClassNotFoundException clsNFException; static { try { windowClass = Repository.lookupClass("java/awt/Window"); } catch (ClassNotFoundException cnfe) { windowClass = null; + clsNFException = cnfe; } try { componentClass = Repository.lookupClass("javax/awt/Component"); } catch (ClassNotFoundException cnfe) { componentClass = null; + clsNFException = cnfe; } try { jcomponentClass = Repository.lookupClass("javax/swing/JComponent"); } catch (ClassNotFoundException cnfe) { jcomponentClass = null; + clsNFException = cnfe; } try { accessibleClass = Repository.lookupClass("javax.accessibility.Accessible"); } catch (ClassNotFoundException cnfe) { accessibleClass = null; + clsNFException = cnfe; } } private final BugReporter bugReporter; @@ -84,6 +89,8 @@ */ public Section508Compliance(BugReporter bugReporter) { this.bugReporter = bugReporter; + if (clsNFException != null) + bugReporter.reportMissingClass(clsNFException); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-24 00:42:58
|
Revision: 1507 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1507&view=rev Author: dbrosius Date: 2010-01-24 00:31:40 +0000 (Sun, 24 Jan 2010) Log Message: ----------- new Detector: IPU - Improper Properties use Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/htdocs/index.shtml Added Paths: ----------- trunk/fb-contrib/samples/IPU_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2010-01-23 23:50:15 UTC (rev 1506) +++ trunk/fb-contrib/etc/findbugs.xml 2010-01-24 00:31:40 UTC (rev 1507) @@ -324,6 +324,10 @@ speed="fast" reports="ROOM_REFLECTION_ON_OBJECT_METHODS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ImproperPropertiesUse" + speed="fast" + reports="IPU_IMPROPER_PROPERTIES_USE,IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" @@ -610,4 +614,8 @@ category="CORRECTNESS" /> <BugPattern abbrev="ROOM" type="ROOM_REFLECTION_ON_OBJECT_METHODS" category="CORRECTNESS" /> + <BugPattern abbrev="IPU" type="IPU_IMPROPER_PROPERTIES_USE" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="IPU" type="IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY" + category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2010-01-23 23:50:15 UTC (rev 1506) +++ trunk/fb-contrib/etc/messages.xml 2010-01-24 00:31:40 UTC (rev 1507) @@ -1110,6 +1110,19 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ImproperPropertiesUse"> + <Details> + <![CDATA[ + <p>This detector looks for java.util.Properties use where values other than String + are placed in the properties object. As the Properties object was intended to be a + String to String only collection, putting other types in the Properties object is + incorrect, and takes advantage of a poor design decision by the original Properties class + designers to derive from Hashtable, rather than using aggregation.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -3019,6 +3032,32 @@ ]]> </Details> </BugPattern> + + <BugPattern type="IPU_IMPROPER_PROPERTIES_USE"> + <ShortDescription>Method puts non-String values into a Properties object</ShortDescription> + <LongDescription>Method {1} puts non-String values into a Properties object</LongDescription> + <Details> + <![CDATA[ + <p>This method places non-String objects into a Properties object. As the Properties object + is intented to be a String to String map, putting non String objects is wrong, and takes advantage + of a design flaw in the Properties class by deriving from Hashtable instead of using aggregation. + If you want a collection that holds other types of objects, use a Hashtable, or better still newer collections + like HashMap or TreeMap. + ]]> + </Details> + </BugPattern> + + <BugPattern type="IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY"> + <ShortDescription>Method uses Properties.put instead of Properties.setProperty</ShortDescription> + <LongDescription>Method {1} uses Properties.put instead of Properties.setProperty</LongDescription> + <Details> + <![CDATA[ + <p>This method uses the inherited method from Hashtable put(String key, Object value) in + a Properties object. Since the Properties object was intended to be only a String to String + map, use of the derived put method is discouraged. Use the Properties.setProperty method instead. + ]]> + </Details> + </BugPattern> <!-- BugCode --> @@ -3113,4 +3152,5 @@ <BugCode abbrev="SNG">Suspicious Null Guard</BugCode> <BugCode abbrev="MDM">More Dumb Methods</BugCode> <BugCode abbrev="ROOM">Reflection on Object Methods</BugCode> + <BugCode abbrev="IPU">Improper Properties use</BugCode> </MessageCollection> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2010-01-23 23:50:15 UTC (rev 1506) +++ trunk/fb-contrib/htdocs/index.shtml 2010-01-24 00:31:40 UTC (rev 1507) @@ -69,6 +69,12 @@ <li><b>[ROOM] Reflection on Object Methods</b><br/> Looks for method calls through reflection on methods found in java.lang.Object. As these methods are always available, there's no reason to do this.</li> + <li><b>[IPU] Improper Properties Use</b><br/> + Looks for java.util.Properties use where values other than String are placed in + the properties object. As the Properties object was intended to be a String to + String only collection, putting other types in the Properties object is incorrect, + and takes advantage of a poor design decision by the original Properties class + designers to derive from Hashtable, rather than using aggregation.</li> </ul> </div> <hr/> Added: trunk/fb-contrib/samples/IPU_Sample.java =================================================================== --- trunk/fb-contrib/samples/IPU_Sample.java (rev 0) +++ trunk/fb-contrib/samples/IPU_Sample.java 2010-01-24 00:31:40 UTC (rev 1507) @@ -0,0 +1,24 @@ +import java.util.Properties; + + +public class IPU_Sample +{ + + public void testIPUSimple() + { + Properties p = new Properties(); + p.put("Key", new Integer(0)); + } + + public void testIPUUseSetProperty(Object o) + { + Properties p = new Properties(); + p.put("Key", o); + } + + public void testIPUUseMinorSetProperty() + { + Properties p = new Properties(); + p.put("Key", "Hello"); + } +} Property changes on: trunk/fb-contrib/samples/IPU_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2010-01-24 00:31:40 UTC (rev 1507) @@ -0,0 +1,100 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2010 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 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 java.util.Properties use where values other than String + * are placed in the properties object. As the Properties object was intended to be a + * String to String only collection, putting other types in the Properties object is + * incorrect, and takes advantage of a poor design decision by the original Properties class + * designers to derive from Hashtable, rather than using aggregation. + */ +public class ImproperPropertiesUse extends BytecodeScanningDetector { + + private BugReporter bugReporter; + private OpcodeStack stack; + + /** + * constructs a IPU detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public ImproperPropertiesUse(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } finally { + stack = null; + } + } + + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + super.visitCode(obj); + } + + public void sawOpcode(int seen) { + try { + if (seen == INVOKEVIRTUAL) { + String clsName = getClassConstantOperand(); + if ("java/util/Properties".equals(clsName)) { + String methodName = getNameConstantOperand(); + if ("put".equals(methodName)) { + String sig = getSigConstantOperand(); + if ("(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;".equals(sig)) { + if (stack.getStackDepth() >= 3) { + OpcodeStack.Item valueItem = stack.getStackItem(0); + String valueSig = valueItem.getSignature(); + if ("Ljava/lang/String;".equals(valueSig)) { + bugReporter.reportBug(new BugInstance(this, "IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY", LOW_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } else if (!"Ljava/lang/Object;".equals(valueSig)) { + bugReporter.reportBug(new BugInstance(this, "IPU_IMPROPER_PROPERTIES_USE", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } else { + bugReporter.reportBug(new BugInstance(this, "IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } + } + } + } finally { + stack.sawOpcode(this, seen); + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.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...> - 2010-01-24 00:42:58
|
Revision: 1508 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1508&view=rev Author: dbrosius Date: 2010-01-24 00:34:52 +0000 (Sun, 24 Jan 2010) Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2010-01-24 00:31:40 UTC (rev 1507) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2010-01-24 00:34:52 UTC (rev 1508) @@ -46,6 +46,11 @@ this.bugReporter = bugReporter; } + /** + * implements the listener to set up and tear down the opcode stack + * + * @param classContext the context object of the currently parsed class + */ public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); @@ -55,11 +60,22 @@ } } + /** + * implements the visitor to reset the opcode stack + * + * @param obj the context object for the currently parsed code block + */ public void visitCode(Code obj) { stack.resetForMethodEntry(this); super.visitCode(obj); } + /** + * implements the visitor to look for calls to java.utils.Properties.put, where the value + * is a non String. Reports both cases, where if it is a string, at a lower lever. + * + * @param seen the currently parsed op code + */ public void sawOpcode(int seen) { try { if (seen == INVOKEVIRTUAL) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-23 23:50:43
|
Revision: 1506 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1506&view=rev Author: dbrosius Date: 2010-01-23 23:50:15 +0000 (Sat, 23 Jan 2010) Log Message: ----------- no shouting Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2010-01-23 12:17:32 UTC (rev 1505) +++ trunk/fb-contrib/etc/messages.xml 2010-01-23 23:50:15 UTC (rev 1506) @@ -3110,7 +3110,7 @@ <BugCode abbrev="NSE">Non Symmetric Equals</BugCode> <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> <BugCode abbrev="NFF">Non Functional Field</BugCode> - <BugCode abbrev="SNG">SUSPICIOUS Null Guard</BugCode> + <BugCode abbrev="SNG">Suspicious Null Guard</BugCode> <BugCode abbrev="MDM">More Dumb Methods</BugCode> <BugCode abbrev="ROOM">Reflection on Object Methods</BugCode> </MessageCollection> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-23 12:43:09
|
Revision: 1505 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1505&view=rev Author: dbrosius Date: 2010-01-23 12:17:32 +0000 (Sat, 23 Jan 2010) Log Message: ----------- guard against NPEs Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 02:08:47 UTC (rev 1504) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-23 12:17:32 UTC (rev 1505) @@ -276,6 +276,8 @@ for (int i = 0; i < parmTypes.length; i++) { sb.append("L"); String type = parmTypes[i]; + if (type == null) + return ""; sb.append(type); if ((type.length() > 1) || ("IJ".indexOf(type) < 0)) sb.append(";"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-19 02:08:53
|
Revision: 1504 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1504&view=rev Author: dbrosius Date: 2010-01-19 02:08:47 +0000 (Tue, 19 Jan 2010) Log Message: ----------- java doc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 02:01:16 UTC (rev 1503) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 02:08:47 UTC (rev 1504) @@ -1,3 +1,21 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2010 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ package com.mebigfatguy.fbcontrib.detect; import java.util.HashMap; @@ -45,10 +63,20 @@ private Map<Integer, String[]> localClassTypes; private Map<String, String[]> fieldClassTypes; + /** + * constructs a ROOM detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public ReflectionOnObjectMethods(BugReporter bugReporter) { this.bugReporter = bugReporter; } + /** + * implements the visitor to create the stack and local and field maps + * for Class arrays to be used for getting the reflection method + * + * @param classContext the context object of the currently parse class + */ @Override public void visitClassContext(ClassContext classContext) { try { @@ -70,6 +98,11 @@ } } + /** + * implements the visitor to reset the opcode stack and clear the local variable map@ + * + * @param obj the context object of the currently parsed code block + */ @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); @@ -77,6 +110,12 @@ super.visitCode(obj); } + /** + * implements the visitor to look for calls that invoke a method through reflection + * where the method is defined in java.lang.Object + * + * @param seen the currently parsed opcode + */ @Override public void sawOpcode(int seen) { Integer arraySize = null; @@ -220,6 +259,15 @@ } } + /** + * builds a string that represents the signature of the method call that is being + * executed though reflection. + * + * @param methodName the method name + * @param parmTypes the array of parameter types of the method + * + * @return a signature string minus the return type + */ private String buildReflectionSignature(String methodName, String[] parmTypes) { StringBuilder sb = new StringBuilder(64); sb.append(methodName); @@ -237,6 +285,13 @@ return sb.toString(); } + /** + * finds the method that is the static initializer for the class + * + * @param cls the class to find the initializer for + * + * @return the Method of the static initializer or null if this class has none + */ private Method findStaticInitializer(JavaClass cls) { Method[] methods = cls.getMethods(); for (Method m : methods) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-19 02:01:30
|
Revision: 1503 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1503&view=rev Author: dbrosius Date: 2010-01-19 02:01:16 +0000 (Tue, 19 Jan 2010) Log Message: ----------- point scm at the 4.2.0 tag - contributed by Grzegorz Slowikowski Modified Paths: -------------- tags/v4_2_0/pom.xml Modified: tags/v4_2_0/pom.xml =================================================================== --- tags/v4_2_0/pom.xml 2010-01-19 01:54:45 UTC (rev 1502) +++ tags/v4_2_0/pom.xml 2010-01-19 02:01:16 UTC (rev 1503) @@ -22,9 +22,9 @@ </licenses> <scm> - <connection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/tags/v4_0_0</connection> - <developerConnection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/tags/v4_2_0</developerConnection> - <url>http://fb-contrib.svn.sourceforge.net/viewvc/fb-contrib/</url> + <connection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/tags/v4_2_0/</connection> + <developerConnection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/tags/v4_2_0/</developerConnection> + <url>http://fb-contrib.svn.sourceforge.net/viewvc/fb-contrib/tags/v4_2_0/</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-19 01:54:51
|
Revision: 1502 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1502&view=rev Author: dbrosius Date: 2010-01-19 01:54:45 +0000 (Tue, 19 Jan 2010) Log Message: ----------- point pom to trunk, patch supplied by Grzegorz Slowikowski Modified Paths: -------------- trunk/fb-contrib/pom.xml Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2010-01-19 01:35:57 UTC (rev 1501) +++ trunk/fb-contrib/pom.xml 2010-01-19 01:54:45 UTC (rev 1502) @@ -48,9 +48,9 @@ </licenses> <scm> - <connection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/tags/v4_0_0</connection> - <developerConnection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/tags/v4_0_0</developerConnection> - <url>http://fb-contrib.svn.sourceforge.net/viewvc/fb-contrib/</url> + <connection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/trunk/</connection> + <developerConnection>scm:svn:https://fb-contrib.svn.sourceforge.net/svnroot/fb-contrib/trunk/</developerConnection> + <url>http://fb-contrib.svn.sourceforge.net/viewvc/fb-contrib/trunk/</url> </scm> <mailingLists> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-19 01:36:03
|
Revision: 1501 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1501&view=rev Author: dbrosius Date: 2010-01-19 01:35:57 +0000 (Tue, 19 Jan 2010) Log Message: ----------- support null (as new Class[0]) for getMethod parms Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 01:27:35 UTC (rev 1500) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 01:35:57 UTC (rev 1501) @@ -179,7 +179,7 @@ if (methodName != null) { String reflectionSig = buildReflectionSignature(methodName, arrayTypes); if (objectSigs.contains(reflectionSig)) { - loadedTypes = arrayTypes; + loadedTypes = (arrayTypes == null) ? new String[0] : arrayTypes; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-19 01:27:55
|
Revision: 1499 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1499&view=rev Author: dbrosius Date: 2010-01-19 00:20:13 +0000 (Tue, 19 Jan 2010) Log Message: ----------- add more tests Modified Paths: -------------- trunk/fb-contrib/samples/ROOM_Sample.java Modified: trunk/fb-contrib/samples/ROOM_Sample.java =================================================================== --- trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-18 17:32:47 UTC (rev 1498) +++ trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-19 00:20:13 UTC (rev 1499) @@ -3,6 +3,7 @@ public class ROOM_Sample { + public static final Class[] STATIC_NO_ARGS = new Class[0]; public final Class[] NO_ARGS = new Class[0]; public void testRoomWithLocals() throws Exception @@ -18,14 +19,22 @@ Class c = Class.forName("java.lang.Object"); Method m = c.getMethod("toString", NO_ARGS); - String s = (String)m.invoke(this, null); + String s = (String)m.invoke(this, (Object[])null); } + public void testRoomWithStatic() throws Exception + { + Class c = Class.forName("java.lang.Object"); + Method m = c.getMethod("hashCode", STATIC_NO_ARGS); + + String s = (String)m.invoke(this, (Object[])null); + } + public void testRoomWithNull() throws Exception { Class c = Class.forName("java.lang.Object"); - Method m = c.getMethod("notify", null); + Method m = c.getMethod("notify", (Class[])null); - String s = (String)m.invoke(this, null); + String s = (String)m.invoke(this, (Object[])null); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-19 01:27:43
|
Revision: 1500 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1500&view=rev Author: dbrosius Date: 2010-01-19 01:27:35 +0000 (Tue, 19 Jan 2010) Log Message: ----------- support the Class array being setup in clinit Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 00:20:13 UTC (rev 1499) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-19 01:27:35 UTC (rev 1500) @@ -6,6 +6,8 @@ import java.util.Set; import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.JavaClass; +import org.apache.bcel.classfile.Method; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; @@ -53,6 +55,13 @@ stack = new OpcodeStack(); localClassTypes = new HashMap<Integer, String[]>(); fieldClassTypes = new HashMap<String, String[]>(); + JavaClass cls = classContext.getJavaClass(); + Method staticInit = findStaticInitializer(cls); + if (staticInit != null) { + setupVisitorForClass(cls); + doVisitMethod(staticInit); + } + super.visitClassContext(classContext); } finally { stack = null; @@ -228,4 +237,14 @@ return sb.toString(); } + private Method findStaticInitializer(JavaClass cls) { + Method[] methods = cls.getMethods(); + for (Method m : methods) { + if ("<clinit>".equals(m.getName())) { + return m; + } + } + + return null; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-18 17:32:53
|
Revision: 1498 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1498&view=rev Author: dbrosius Date: 2010-01-18 17:32:47 +0000 (Mon, 18 Jan 2010) Log Message: ----------- try to support null parms Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-18 17:31:58 UTC (rev 1497) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-18 17:32:47 UTC (rev 1498) @@ -164,7 +164,7 @@ if (stack.getStackDepth() >= 2) { OpcodeStack.Item clsArgs = stack.getStackItem(0); String[] arrayTypes = (String[])clsArgs.getUserValue(); - if (arrayTypes != null) { + if ((arrayTypes != null) || (clsArgs.isNull())) { OpcodeStack.Item methodItem = stack.getStackItem(1); String methodName = (String)methodItem.getConstant(); if (methodName != null) { @@ -215,12 +215,14 @@ StringBuilder sb = new StringBuilder(64); sb.append(methodName); sb.append("("); - for (int i = 0; i < parmTypes.length; i++) { - sb.append("L"); - String type = parmTypes[i]; - sb.append(type); - if ((type.length() > 1) || ("IJ".indexOf(type) < 0)) - sb.append(";"); + if (parmTypes != null) { + for (int i = 0; i < parmTypes.length; i++) { + sb.append("L"); + String type = parmTypes[i]; + sb.append(type); + if ((type.length() > 1) || ("IJ".indexOf(type) < 0)) + sb.append(";"); + } } sb.append(")"); return sb.toString(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-18 17:32:04
|
Revision: 1497 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1497&view=rev Author: dbrosius Date: 2010-01-18 17:31:58 +0000 (Mon, 18 Jan 2010) Log Message: ----------- add test with Null Modified Paths: -------------- trunk/fb-contrib/samples/ROOM_Sample.java Modified: trunk/fb-contrib/samples/ROOM_Sample.java =================================================================== --- trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-18 17:27:20 UTC (rev 1496) +++ trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-18 17:31:58 UTC (rev 1497) @@ -20,4 +20,12 @@ String s = (String)m.invoke(this, null); } + + public void testRoomWithNull() throws Exception + { + Class c = Class.forName("java.lang.Object"); + Method m = c.getMethod("notify", null); + + String s = (String)m.invoke(this, null); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-18 17:27:26
|
Revision: 1496 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1496&view=rev Author: dbrosius Date: 2010-01-18 17:27:20 +0000 (Mon, 18 Jan 2010) Log Message: ----------- add support for fields Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-18 17:26:55 UTC (rev 1495) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-18 17:27:20 UTC (rev 1496) @@ -41,6 +41,7 @@ private BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, String[]> localClassTypes; + private Map<String, String[]> fieldClassTypes; public ReflectionOnObjectMethods(BugReporter bugReporter) { this.bugReporter = bugReporter; @@ -51,10 +52,12 @@ try { stack = new OpcodeStack(); localClassTypes = new HashMap<Integer, String[]>(); + fieldClassTypes = new HashMap<String, String[]>(); super.visitClassContext(classContext); } finally { stack = null; localClassTypes = null; + fieldClassTypes = null; } } @@ -101,6 +104,28 @@ } break; + case PUTFIELD: + case PUTSTATIC: { + String name = getNameConstantOperand(); + if (stack.getStackDepth() >= 1) { + OpcodeStack.Item item = stack.getStackItem(0); + String[] arrayTypes = (String[])item.getUserValue(); + if (arrayTypes != null) { + fieldClassTypes.put(name, arrayTypes); + return; + } + } + fieldClassTypes.remove(name); + } + break; + + case GETFIELD: + case GETSTATIC: { + String name = getNameConstantOperand(); + loadedTypes = fieldClassTypes.get(name); + } + break; + case ASTORE_0: case ASTORE_1: case ASTORE_2: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-18 17:27:02
|
Revision: 1495 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1495&view=rev Author: dbrosius Date: 2010-01-18 17:26:55 +0000 (Mon, 18 Jan 2010) Log Message: ----------- test with fields Modified Paths: -------------- trunk/fb-contrib/samples/ROOM_Sample.java Modified: trunk/fb-contrib/samples/ROOM_Sample.java =================================================================== --- trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-18 17:12:18 UTC (rev 1494) +++ trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-18 17:26:55 UTC (rev 1495) @@ -3,7 +3,7 @@ public class ROOM_Sample { - public static final Class[] NO_ARGS = new Class[0]; + public final Class[] NO_ARGS = new Class[0]; public void testRoomWithLocals() throws Exception { @@ -13,7 +13,7 @@ String s = (String)m.invoke(this, new ROOM_Sample()); } - public void testRoomWithStatic() throws Exception + public void testRoomWithField() throws Exception { Class c = Class.forName("java.lang.Object"); Method m = c.getMethod("toString", NO_ARGS); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-18 17:12:25
|
Revision: 1494 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1494&view=rev Author: dbrosius Date: 2010-01-18 17:12:18 +0000 (Mon, 18 Jan 2010) Log Message: ----------- delete this Removed Paths: ------------- trunk/fb-contrib/.svnignore Deleted: trunk/fb-contrib/.svnignore =================================================================== --- trunk/fb-contrib/.svnignore 2010-01-18 17:06:23 UTC (rev 1493) +++ trunk/fb-contrib/.svnignore 2010-01-18 17:12:18 UTC (rev 1494) @@ -1,2 +0,0 @@ -*.class -htdocs/*.html This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-18 17:06:34
|
Revision: 1493 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1493&view=rev Author: dbrosius Date: 2010-01-18 17:06:23 +0000 (Mon, 18 Jan 2010) Log Message: ----------- svn ignore file Added Paths: ----------- trunk/fb-contrib/.svnignore Added: trunk/fb-contrib/.svnignore =================================================================== --- trunk/fb-contrib/.svnignore (rev 0) +++ trunk/fb-contrib/.svnignore 2010-01-18 17:06:23 UTC (rev 1493) @@ -0,0 +1,2 @@ +*.class +htdocs/*.html Property changes on: trunk/fb-contrib/.svnignore ___________________________________________________________________ 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...> - 2010-01-18 17:01:00
|
Revision: 1492 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1492&view=rev Author: dbrosius Date: 2010-01-18 17:00:51 +0000 (Mon, 18 Jan 2010) Log Message: ----------- add test with class array in a static Modified Paths: -------------- trunk/fb-contrib/samples/ROOM_Sample.java Modified: trunk/fb-contrib/samples/ROOM_Sample.java =================================================================== --- trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-18 16:59:58 UTC (rev 1491) +++ trunk/fb-contrib/samples/ROOM_Sample.java 2010-01-18 17:00:51 UTC (rev 1492) @@ -3,6 +3,8 @@ public class ROOM_Sample { + public static final Class[] NO_ARGS = new Class[0]; + public void testRoomWithLocals() throws Exception { Class c = Class.forName("java.lang.Object"); @@ -10,4 +12,12 @@ String s = (String)m.invoke(this, new ROOM_Sample()); } + + public void testRoomWithStatic() throws Exception + { + Class c = Class.forName("java.lang.Object"); + Method m = c.getMethod("toString", NO_ARGS); + + String s = (String)m.invoke(this, null); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-18 17:00:11
|
Revision: 1491 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1491&view=rev Author: dbrosius Date: 2010-01-18 16:59:58 +0000 (Mon, 18 Jan 2010) Log Message: ----------- clear loadedClassTypes on a store, if the variable isn't a class array Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-18 16:57:46 UTC (rev 1490) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2010-01-18 16:59:58 UTC (rev 1491) @@ -106,14 +106,16 @@ case ASTORE_2: case ASTORE_3: case ASTORE: { + Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)); if (stack.getStackDepth() >= 1) { OpcodeStack.Item item = stack.getStackItem(0); String[] arrayTypes = (String[])item.getUserValue(); if (arrayTypes != null) { - int reg = RegisterUtils.getAStoreReg(this, seen); - localClassTypes.put(Integer.valueOf(reg), arrayTypes); + localClassTypes.put(reg, arrayTypes); + return; } - } + } + localClassTypes.remove(reg); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |