Buggy code:
public class Cache extends NameSet { private class Element { RRset rrset ; byte credibility ; long timeIn ; int ttl ; int srcid ; Thread tid ; public Element ( int _ttl , byte cred , int src ) { } public Element ( Record r , byte cred , int src ) { } public Element ( RRset r , byte cred , int src ) { } public void update ( Record r ) { } public void deleteRecord ( Record r ) { } public boolean expiredTTL ( ) { } public boolean TTL0Ours ( ) { } public boolean TTL0NotOurs ( ) { } public String toString ( ) { } } private Verifier verifier ; private boolean secure ; public Cache ( ) { } public Cache ( String file ) throws IOException { } public void addRecord ( Record r , byte cred , Object o ) { } public void addRRset ( RRset rrset , byte cred , Object o ) { } public void addNegative ( Name name , short type , short dclass , int ttl , byte cred , Object o ) { } public SetResponse lookupRecords ( Name name , short type , short dclass , byte minCred ) { SetResponse cr = null ; Object [ ] objects = findSets ( name , type , dclass ) ; if ( objects == null ) return new SetResponse ( SetResponse . UNKNOWN ) ; int nelements = 0 ; for ( int i = 0 ; i < ( objects . length ) ; i ++ ) { Cache . Element element = ( ( Cache . Element ) ( objects [ i ] ) ) ; if ( element . TTL0Ours ( ) ) { removeSet ( name , type , dclass , element ) ; nelements ++ ; } else if ( element . TTL0NotOurs ( ) ) { objects [ i ] = null ; } else if ( element . expiredTTL ( ) ) { removeSet ( name , type , dclass , element ) ; objects [ i ] = null ; } else if ( ( element . credibility ) < minCred ) objects [ i ] = null ; else nelements ++ ; } if ( nelements == 0 ) return new SetResponse ( SetResponse . UNKNOWN ) ; Cache . Element [ ] elements = new Cache . Element [ nelements ] ; for ( int i = 0 , j = 0 ; i < ( objects . length ) ; i ++ ) { if ( ( objects [ i ] ) == null ) continue ; elements [ ( j ++ ) ] = ( ( Cache . Element ) ( objects [ i ] ) ) ; } for ( int i = 0 ; i < ( elements . length ) ; i ++ ) { RRset rrset = elements [ i ] . rrset ; if ( rrset == null ) { if ( type == ( Type . ANY ) ) continue ; if ( ! ( name . isWild ( ) ) ) { <START_BUG> cr = lookupRecords ( name . wild ( ) , type , dclass , minCred ) ; <END_BUG> if ( cr . isSuccessful ( ) ) return cr ; } return new SetResponse ( SetResponse . NEGATIVE ) ; } if ( ( ( type != ( Type . CNAME ) ) && ( type != ( Type . ANY ) ) ) && ( ( rrset . getType ( ) ) == ( Type . CNAME ) ) ) { CNAMERecord cname = ( ( CNAMERecord ) ( rrset . first ( ) ) ) ; cr = lookupRecords ( cname . getTarget ( ) , type , dclass , minCred ) ; if ( cr . isUnknown ( ) ) cr . set ( PARTIAL , cname ) ; cr . addCNAME ( cname ) ; return cr ; } if ( cr == null ) cr = new SetResponse ( SetResponse . SUCCESSFUL ) ; cr . addRRset ( rrset ) ; } if ( ( cr == null ) && ( type == ( Type . ANY ) ) ) return new SetResponse ( SetResponse . NEGATIVE ) ; return cr ; } private RRset [ ] findRecords ( Name name , short type , short dclass , byte minCred ) { } public RRset [ ] findRecords ( Name name , short type , short dclass ) { } public RRset [ ] findAnyRecords ( Name name , short type , short dclass ) { } public void addMessage ( Message in ) { } void flushSet ( Name name , short type , short dclass ) { } void flushName ( Name name ) { } public void setVerifier ( Verifier v ) { } public void setSecurePolicy ( ) { } }

Fix:
cr = lookupRecords ( name . wild ( 1 ) , type , dclass , minCred ) ;