tyutNo4 / findbugs

Automatically exported from code.google.com/p/findbugs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Impossible cast from javax.naming.CompositeName to com.sun.jndi.dns.DnsName in addAll(int, Name) in DnsName.java

GoogleCodeExporter opened this issue · comments

Bug report generated from FindBugs
Impossible cast from javax.naming.CompositeName to com.sun.jndi.dns.DnsName in 
addAll(int, Name)

In class com.sun.jndi.dns.DnsName
  In method addAll(int, Name)
  Actual type javax.naming.CompositeName
  Expected com.sun.jndi.dns.DnsName
  Value loaded from n
  At DnsName.java:[line 363]

Relevant source code:
  359:           domain = null;
  360:       }
  361: 
  362:   } else if (n instanceof CompositeName) {
  363:       n = (DnsName) n;            // force ClassCastException

Classified as: MOSTLY_HARMLESS
Bug pattern explanation:
This cast will always throw a ClassCastException. FindBugs tracks type 
information from instanceof checks, and also uses more precise information 
about the types of values returned from methods and loaded from fields. Thus, 
it may have more precise information that just the declared type of a 
variable, and can use this to determine that a cast will always throw an 
exception at runtime.



FindBugs issue identifier (do not modify or remove): 
9f539f18993066f5fa629c57f23a982c

Original issue reported on code.google.com by keithl on 24 Feb 2010 at 3:09

Original comment by keithl on 16 Jun 2010 at 9:22

  • Changed state: Invalid