Buggy code:
public class jnamed { static final int FLAG_DNSSECOK = 1 ; static final int FLAG_SIGONLY = 2 ; Map caches ; Map znames ; Map TSIGs ; public jnamed ( String conffile ) throws ZoneTransferException , IOException { } public void addPrimaryZone ( String zname , String zonefile ) throws IOException { } public void addSecondaryZone ( String zone , String remote ) throws ZoneTransferException , IOException { } public void addTSIG ( String namestr , String key ) throws IOException { } public Cache getCache ( int dclass ) { } public Zone findBestZone ( Name name ) { } public RRset findExactMatch ( Name name , int type , int dclass , boolean glue ) { } void addRRset ( Name name , Message response , RRset rrset , int section , int flags ) { } private final void addSOA ( Message response , Zone zone ) { } private final void addNS ( Message response , Zone zone , int flags ) { } private final void addCacheNS ( Message response , Cache cache , Name name ) { } private void addGlue ( Message response , Name name , int flags ) { } private void addAdditional2 ( Message response , int section , int flags ) { } private final void addAdditional ( Message response , int flags ) { } byte addAnswer ( Message response , Name name , int type , int dclass , int iterations , int flags ) { SetResponse sr ; byte rcode = Rcode . NOERROR ; if ( iterations > 6 ) return Rcode . NOERROR ; <START_BUG> if ( type == ( Type . SIG ) ) { <END_BUG> type = Type . ANY ; flags |= jnamed . FLAG_SIGONLY ; } Zone zone = findBestZone ( name ) ; if ( zone != null ) sr = zone . findRecords ( name , type ) ; else { Cache cache = getCache ( dclass ) ; sr = cache . lookupRecords ( name , type , NORMAL ) ; } if ( sr . isUnknown ( ) ) { addCacheNS ( response , getCache ( dclass ) , name ) ; } if ( sr . isNXDOMAIN ( ) ) { response . getHeader ( ) . setRcode ( NXDOMAIN ) ; if ( zone != null ) { addSOA ( response , zone ) ; if ( iterations == 0 ) response . getHeader ( ) . setFlag ( AA ) ; } rcode = Rcode . NXDOMAIN ; } else if ( sr . isNXRRSET ( ) ) { if ( zone != null ) { addSOA ( response , zone ) ; if ( iterations == 0 ) response . getHeader ( ) . setFlag ( AA ) ; } } else if ( sr . isDelegation ( ) ) { RRset nsRecords = sr . getNS ( ) ; addRRset ( nsRecords . getName ( ) , response , nsRecords , AUTHORITY , flags ) ; } else if ( sr . isCNAME ( ) ) { RRset rrset = new RRset ( ) ; CNAMERecord cname = sr . getCNAME ( ) ; rrset . addRR ( cname ) ; addRRset ( name , response , rrset , ANSWER , flags ) ; if ( ( zone != null ) && ( iterations == 0 ) ) response . getHeader ( ) . setFlag ( AA ) ; rcode = addAnswer ( response , cname . getTarget ( ) , type , dclass , ( iterations + 1 ) , flags ) ; } else if ( sr . isDNAME ( ) ) { RRset rrset = new RRset ( ) ; DNAMERecord dname = sr . getDNAME ( ) ; rrset . addRR ( dname ) ; addRRset ( name , response , rrset , ANSWER , flags ) ; Name newname ; try { newname = name . fromDNAME ( dname ) ; } catch ( NameTooLongException e ) { return Rcode . YXDOMAIN ; } rrset = new RRset ( ) ; rrset . addRR ( new CNAMERecord ( name , dclass , 0 , newname ) ) ; addRRset ( name , response , rrset , ANSWER , flags ) ; if ( ( zone != null ) && ( iterations == 0 ) ) response . getHeader ( ) . setFlag ( AA ) ; rcode = addAnswer ( response , newname , type , dclass , ( iterations + 1 ) , flags ) ; } else if ( sr . isSuccessful ( ) ) { RRset [ ] rrsets = sr . answers ( ) ; for ( int i = 0 ; i < ( rrsets . length ) ; i ++ ) addRRset ( name , response , rrsets [ i ] , ANSWER , flags ) ; if ( zone != null ) { addNS ( response , zone , flags ) ; if ( iterations == 0 ) response . getHeader ( ) . setFlag ( AA ) ; } else addCacheNS ( response , getCache ( dclass ) , name ) ; } return rcode ; } TSIG findTSIG ( Name name ) { } byte [ ] doAXFR ( Name name , Message query , TSIG tsig , TSIGRecord qtsig , Socket s ) { } byte [ ] generateReply ( Message query , byte [ ] in , int length , Socket s ) throws IOException { } byte [ ] buildErrorMessage ( Header header , int rcode , Record question ) { } public byte [ ] formerrMessage ( byte [ ] in ) { } public byte [ ] errorMessage ( Message query , int rcode ) { } public void TCPclient ( Socket s ) { } public void serveTCP ( InetAddress addr , int port ) { } public void serveUDP ( InetAddress addr , int port ) { }

Fix:
if ( ( type == ( Type . SIG ) ) || ( type == ( Type . RRSIG ) ) ) {