[FB-Discuss] Adding new patterns

TvT tvtreeck at nepatec.de
Thu Jul 1 06:20:50 EDT 2010


Ok i understand that.
However then i have to more questions ;-)

1.)
Your patterns also contain 'pure bugs'
e.g. the Pattern id: MDM_BIGDECIMAL_EQUALS, type: MDM, category: CORRECTNESS
(equals() being called to compare two java.math.BigDecimal numbers.
This is normally a mistake, as two BigDecimal objects are only equal
if they are equal in both value and scale, so that 2.0 is not equal to
2.00. To compare BigDecimal objects for mathematical equality, use
compareTo() instead.)

2.) Why does findbugs then have several reporter configurations like:
- performance
- security
- correctness
- bad practice
- dodgy
etc.

I think in that sense lots of patterns are also more stylistic and not
drop dead bugs. That line is quite difficult to draw which would still
speak for an inclusion in my opinion ...
Another solution (e.g. for the eclipse plugin) would be that while
installing findbugs to offer your lib as an optional update or
somthing like that...

ToM

2010/7/1 Dave Brosius <dbrosius at mebigfatguy.com>
>
> The focus for Findbugs core is to report pure bugs, without the influence of stylistic detectors, whereas mine are much more heavily in the camp of the style-type bugs. Each has it's place, but i think Bill wants his detectors to report drop dead bugs. It's a common pattern, take for instance ant and ant-contrib.
>
>
>
>
>
> On 06/30/2010 04:34 AM, TvT wrote:
>
> Thanks dave for sharing those detectors.
>
> @findbugs developers
> Why aren't those bug detectors (e.g. the stable ones and not the experimental) included into the official findbugs?
> I think it would be nice if everbody can benefit from it...
>
> Thanks
> ToM
>
> 2010/6/29 Dave Brosius <dbrosius at mebigfatguy.com>
>>
>> There is already something similar to this in fb-contrib.sf.net.
>>
>> See LostExceptionStackTrace
>>
>> http://fb-contrib.svn.sourceforge.net/viewvc/fb-contrib/trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java?revision=1573&view=markup
>>
>>
>>
>> ----- Original Message -----
>> From: "Mark Zellers" <markz at adaptiveplanning.com>
>> Sent: Tue, June 29, 2010 12:37
>> Subject: [FB-Discuss] Adding new patterns
>>
>> I'd like to learn how to add a new pattern to FindBugs.  Is there a document or tutorial that would allow a mere mortal to do this, or does it require heavy wizardry?
>>
>> The case I'd like to catch is where an exception is caught and a different exception is thrown, but without either logging the original exception or linking it to the new exception.
>>
>> for example
>>
>>       catch (SQLException ex) {
>>            throw new Exception("Bad Query");
>>       }
>>
>> should be flagged but
>>
>>      catch (SQLException ex) {
>>          throw new Exception("Bad Query", ex);
>>      }
>>
>> or
>>
>>      catch (SQLException ex) {
>>          log(ex);
>>          throw new Exception("Bad Query");
>>     }
>>
>> would not.
>>
>>
>> Thanks,
>>
>> Mark Z.
>>
>> ________________________________
>>
>> _______________________________________________
>> Findbugs-discuss mailing list
>> Findbugs-discuss at cs.umd.edu
>> https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss
>>
>> _______________________________________________
>> Findbugs-discuss mailing list
>> Findbugs-discuss at cs.umd.edu
>> https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss
>
>
> _______________________________________________
> Findbugs-discuss mailing list
> Findbugs-discuss at cs.umd.edu
> https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss
>
> _______________________________________________
> Findbugs-discuss mailing list
> Findbugs-discuss at cs.umd.edu
> https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss




More information about the Findbugs-discuss mailing list