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 boolean temporary_cache ; private int credibility ; private Name name ; private int type ; private int dclass ; private boolean verbose ; private int iterations ; private boolean foundAlias ; private boolean done ; private boolean doneCurrent ; 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 ; private boolean referral ; private static final Name [ ] noAliases = new Name [ 0 ] ; 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 void refreshDefault ( ) { } 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 { } private final void reset ( ) { } 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 ( int credibility ) { } private void follow ( Name name , Name oldname ) { foundAlias = true ; badresponse = false ; networkerror = false ; timedout = false ; nxdomain = false ; referral = false ; ( iterations ) ++ ; if ( ( ( iterations ) >= 6 ) || ( name . equals ( oldname ) ) ) { result = Lookup . UNRECOVERABLE ; error = "CNAME<seq2seq4repair_space>loop" ; done = true ; return ; } if ( ( aliases ) == null ) aliases = new ArrayList ( ) ; <START_BUG> aliases . add ( name ) ; <END_BUG> lookup ( name ) ; } private void processResponse ( Name name , SetResponse response ) { } private void lookup ( Name current ) { } 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:
aliases . add ( oldname ) ;