Update of /cvsroot/fb-contrib/fb-contrib/etc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14551/etc
Modified Files:
findbugs.xml messages.xml
Log Message:
Initial checkin: LSC Detector
Index: messages.xml
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- messages.xml 19 Sep 2005 02:25:44 -0000 1.12
+++ messages.xml 19 Sep 2005 04:20:20 -0000 1.13
@@ -122,6 +122,17 @@
]]>
</Details>
</Detector>
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison">
+ <Details>
+ <![CDATA[
+ <p> Looks for methods that compare strings against literal strings, where the literal string
+ is passed as the parameter. If the .equals or .compareTo is called on the literal itself, passing
+ the variable as the parameter, you avoid the possibility of a NullPointerException.</p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
<!-- BugPattern -->
@@ -236,6 +247,18 @@
</Details>
</BugPattern>
+ <BugPattern type="LSC_LITERAL_STRING_COMPARISON">
+ <ShortDescription>method makes literal string comparisons passing the literal as an argument</ShortDescription>
+ <LongDescription>method {1} makes literal string comparisons passing the literal as an argument</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method calls the equals or compareTo methods on a String variable passing in a String literal.
+ A NullPointerException may occur if the string variable is null. If instead the method was called on
+ the string literal, and the variable was passed as an argument, this exception could never happen.</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<!-- BugCode -->
<BugCode abbrev="ISB">Inefficient String Buffering</BugCode>
@@ -247,5 +270,6 @@
<BugCode abbrev="DRE">Declared Runtime Exception</BugCode>
<BugCode abbrev="CE">Class Envy</BugCode>
<BugCode abbrev="FP">Final Parameters</BugCode>
+ <BugCode abbrev="LSC">Literal String Comparison</BugCode>
</MessageCollection>
\ No newline at end of file
Index: findbugs.xml
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- findbugs.xml 19 Sep 2005 02:25:44 -0000 1.13
+++ findbugs.xml 19 Sep 2005 04:20:19 -0000 1.14
@@ -50,7 +50,11 @@
speed="fast"
reports="FP_FINAL_PARAMETERS" />
- <!-- BugPattern -->
+ <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison"
+ speed="fast"
+ reports="LSC_LITERAL_STRING_COMPARISON" />
+
+ <!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
<BugPattern abbrev="SCI" type="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" category="CORRECTNESS" />
@@ -61,5 +65,6 @@
<BugPattern abbrev="DRE" type="DRE_DECLARED_RUNTIME_EXCEPTION" category="STYLE" />
<BugPattern abbrev="CE" type="CE_CLASS_ENVY" category="STYLE" experimental="true" />
<BugPattern abbrev="FP" type="FP_FINAL_PARAMETERS" category="STYLE" experimental="true" />
+ <BugPattern abbrev="LSC" type="LSC_LITERAL_STRING_COMPARISON" category="STYLE" experimental="true" />
</FindbugsPlugin>
\ No newline at end of file
|