Impossible cast from javax.naming.CompositeName to com.sun.jndi.dns.DnsName in compareRange(int, int, Name) in DnsName.java
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
Bug report generated from FindBugs
Impossible cast from javax.naming.CompositeName to com.sun.jndi.dns.DnsName in
compareRange(int, int, Name)
In class com.sun.jndi.dns.DnsName
In method compareRange(int, int, Name)
Actual type javax.naming.CompositeName
Expected com.sun.jndi.dns.DnsName
Value loaded from n
At DnsName.java:[line 390]
Relevant source code:
386: * greater than those of "n".
387: */
388: private int compareRange(int beg, int end, Name n) {
389: if (n instanceof CompositeName) {
390: n = (DnsName) n; // force ClassCastException
391: }
392: // Loop through labels, starting with most significant.
393: int minSize = Math.min(end - beg, n.size());
394: for (int i = 0; i < minSize; i++) {
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):
b9c5e422ce21dc230c2d8195629f9ab1
Original issue reported on code.google.com by keithl
on 24 Feb 2010 at 3:16
Google Code Exporter commented
Original comment by keithl
on 24 Feb 2010 at 3:17
- Changed state: Invalid