tyutNo4/findbugs

False positive for Bad Cast

GoogleCodeExporter opened this issue · 4 comments

What steps will reproduce the problem?

Run FindBugs GUI on the "mail" module of Project GlassFish
(http://glassfish.dev.java.net).

There are several instances of code such as the following:

        if (message instanceof SMTPMessage)
            from = ((SMTPMessage)message).getEnvelopeFrom();


What is the expected output? What do you see instead?

Complains about an unchecked cast.


What version of the product are you using? On what operating system?

FindBugs 1.1.1, JDK 1.5.0_07, Solaris 10


Please provide any additional information below.


Original issue reported on code.google.com by bs00...@gmail.com on 23 Oct 2006 at 8:11

I need some more information to understand this report. Ideally, a sample Java 
file and an XML report generated 
by FindBugs.

Alternatively, just give me the specific file and line number within Glassfish 
where you are getting this false 
positive.

Original comment by bill.p...@gmail.com on 16 Dec 2006 at 8:54

  • Changed title: False positive for Bad Cast
  • Changed state: NeedInfo
  • Added labels: Type-FalsePositive
  • Removed labels: Type-Defect
Darn, how do I fix the summary for this issue?

Original comment by bs00...@gmail.com on 23 Oct 2006 at 8:12

This occurs in com.sun.mail.smtp.SMTPTransport, in method mailFrom, about line 
750:
https://glassfish.dev.java.net/source/browse/glassfish/mail/src/java/com/sun/mai
l/smtp/SMTPTransport.java?view=markup
It complains about the cast to SMTPMessage, even though it's checked with 
instanceof
the line before.

Original comment by bs00...@gmail.com on 20 Jan 2007 at 1:58

Thanks for the report, but please report this bug at sourceforge bug tracker 
again. This tracker is not used / monitored.

Original comment by iloveeclipse on 23 Nov 2011 at 10:05

  • Changed state: Invalid