Buggy code:
public final class Lookup { private static Resolver defaultResolver ; private static Name [ ] defaultSearchPath ; private static Map defaultCaches ; private Resolver resolver ; private Name [ ] searchPath ; private Cache cache ; private byte credibility ; private Name name ; private int type ; private int dclass ; private boolean verbose ; private int iterations ; private boolean foundAlias ; private boolean done ; private List aliases ; private Record [ ] answers ; private int result ; private String error ; private boolean nxdomain ; private boolean badresponse ; private String badresponse_error ; private boolean networkerror ; private boolean timedout ; private boolean nametoolong ; public static final int SUCCESSFUL = 0 ; public static final int UNRECOVERABLE = 1 ; public static final int TRY_AGAIN = 2 ; public static final int HOST_NOT_FOUND = 3 ; public static final int TYPE_NOT_FOUND = 4 ; public static synchronized Resolver getDefaultResolver ( ) { } public static synchronized void setDefaultResolver ( Resolver resolver ) { } public static synchronized Cache getDefaultCache ( int dclass ) { } public static synchronized void setDefaultCache ( Cache cache , int dclass ) { } public static synchronized Name [ ] getDefaultSearchPath ( ) { } public static synchronized void setDefaultSearchPath ( Name [ ] domains ) { } public static synchronized void setDefaultSearchPath ( String [ ] domains ) throws TextParseException { } public Lookup ( Name name , int type , int dclass ) { } public Lookup ( Name name , int type ) { } public Lookup ( Name name ) { } public Lookup ( String name , int type , int dclass ) throws TextParseException { } public Lookup ( String name , int type ) throws TextParseException { } public Lookup ( String name ) throws TextParseException { } public void setResolver ( Resolver resolver ) { } public void setSearchPath ( Name [ ] domains ) { } public void setSearchPath ( String [ ] domains ) throws TextParseException { } public void setCache ( Cache cache ) { } public void setCredibility ( byte credibility ) { } private void follow ( Name name , Name oldname ) { } private void processResponse ( Name name , SetResponse response ) { } private void lookup ( Name current ) { SetResponse sr = cache . lookupRecords ( current , type , credibility ) ; if ( verbose ) { System . err . println ( ( ( ( "lookup<seq2seq4repair_space>" + current ) + "<seq2seq4repair_space>" ) + ( Type . string ( type ) ) ) ) ; System . err . println ( sr ) ; } processResponse ( current , sr ) ; if ( done ) return ; Record question = Record . newRecord ( current , type , dclass ) ; Message query = Message . newQuery ( question ) ; Message response = null ; try { response = resolver . send ( query ) ; } catch ( IOException e ) { if ( e instanceof InterruptedIOException ) timedout = true ; else networkerror = true ; return ; } <START_BUG> short rcode = response . getHeader ( ) . getRcode ( ) ; <END_BUG> if ( ( rcode != ( Rcode . NOERROR ) ) && ( rcode != ( Rcode . NXDOMAIN ) ) ) { badresponse = true ; badresponse_error = Rcode . string ( rcode ) ; return ; } if ( ! ( query . getQuestion ( ) . equals ( response . getQuestion ( ) ) ) ) { badresponse = true ; badresponse_error = "response<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>match<seq2seq4repair_space>query" ; return ; } sr = cache . addMessage ( response ) ; if ( sr == null ) sr = cache . lookupRecords ( current , type , credibility ) ; if ( verbose ) { System . err . println ( ( ( ( "queried<seq2seq4repair_space>" + current ) + "<seq2seq4repair_space>" ) + ( Type . string ( type ) ) ) ) ; System . err . println ( sr ) ; } processResponse ( current , sr ) ; } private void resolve ( Name current , Name suffix ) { } public Record [ ] run ( ) { } private void checkDone ( ) { } public Record [ ] getAnswers ( ) { } public Name [ ] getAliases ( ) { } public int getResult ( ) { } public String getErrorString ( ) { } }

Fix:
int rcode = response . getHeader ( ) . getRcode ( ) ;