Stockpile for possible Bugpatterns

View: New views
2 Messages — Rating Filter:   Alert me  

Stockpile for possible Bugpatterns

by Tobias van Treeck :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

i just found a bug in my program which wasn't found by findbugs (no offence ;-) but cost me one day to track down this Nullpointer:

HttpURLConnection httpConnection = ...;
InputStream errorStream = httpConnection.getErrorStream();
errorStream.read();

In the javadoc i found that the method "getErrorStream()" can return null. Inf fact to quote it: "This (null) is the default."!

Now if i would have the time (and probably the bytecodeskills) i would implement my own bug pattern for it. However i currently don't have the time to do so and my questions is if there is a place where the community could report such bugs->potential bug patterns? Someone else may has the time and the skill to implement it...

If there's nothing like it i think it would make sense to establish such an "potential bug pattern stockpile". Maybe the community could also vote which pattern gets implemented first...Ah so many possibilities :-) But in the end this would definitely improve findbugs

Just a suggestion,
ToM

_______________________________________________
Findbugs-discuss mailing list
Findbugs-discuss@...
https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss

Re: Stockpile for possible Bugpatterns

by Jonathan Leech :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the nullness checking via @NonNull and its brethren annotations would handle this quite nicely if the default behavior were changed or were configurable. IThe default behavior for findbugs for methods that aren't annotated (e.g. the Java API methods) is to not do the nullness checks against them. If this was changed by default or by configuration I think it would catch this bug. Or stated another way, if the HTTPURLConnection.getErrorStream() were annotated as @Nullable, findbugs would catch this bug.


From: findbugs-discuss-bounces@... [mailto:findbugs-discuss-bounces@...] On Behalf Of Tobias van Treeck
Sent: Wednesday, August 26, 2009 11:29 AM
To: findbugs-discuss@...
Subject: [FB-Discuss] Stockpile for possible Bugpatterns

Hi,

i just found a bug in my program which wasn't found by findbugs (no offence ;-) but cost me one day to track down this Nullpointer:

HttpURLConnection httpConnection = ...;
InputStream errorStream = httpConnection.getErrorStream();
errorStream.read();

In the javadoc i found that the method "getErrorStream()" can return null. Inf fact to quote it: "This (null) is the default."!

Now if i would have the time (and probably the bytecodeskills) i would implement my own bug pattern for it. However i currently don't have the time to do so and my questions is if there is a place where the community could report such bugs->potential bug patterns? Someone else may has the time and the skill to implement it...

If there's nothing like it i think it would make sense to establish such an "potential bug pattern stockpile". Maybe the community could also vote which pattern gets implemented first...Ah so many possibilities :-) But in the end this would definitely improve findbugs

Just a suggestion,
ToM

_______________________________________________
Findbugs-discuss mailing list
Findbugs-discuss@...
https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss