Buggy code:
public class WorkflowControllerImpl extends Host implements WorkflowController { private AtomicLong xidCounter ; private Hashtable < HostName , Remote > hostMap ; public WorkflowControllerImpl ( ) throws RemoteException { } public static void main ( String [ ] args ) { } public void startUp ( ) { } private boolean bind ( HostName who ) { } private < K > ResourceManager < K > rm ( HostName who ) { } private TransactionManager tm ( ) { } @ Override public long start ( ) throws RemoteException { } @ Override public boolean commit ( long xid ) throws RemoteException , TransactionAbortedException { } @ Override public void abort ( long xid ) throws RemoteException { } private < K > boolean exist ( ResourceManager < K > rm , long xid , K key ) throws RemoteException , DeadlockException { } private void abortForRMException ( long xid , Exception e ) throws RemoteException , TransactionAbortedException { } private < T extends ResourceItem < String > > boolean add ( long xid , String key , int num , int price , Class < T > clazz , HostName who ) throws RemoteException , TransactionAbortedException { } @ Override public boolean addFlight ( long xid , String flightNum , int numSeats , int price ) throws RemoteException , TransactionAbortedException { } @ Override public boolean deleteFlight ( long xid , String flightNum ) throws RemoteException , TransactionAbortedException { } @ Override public boolean addRooms ( long xid , String location , int numRooms , int price ) throws RemoteException , TransactionAbortedException { } @ Override public boolean deleteRooms ( long xid , String location , int numRooms ) throws RemoteException , TransactionAbortedException { } @ Override public boolean addCars ( long xid , String location , int numCars , int price ) throws RemoteException , TransactionAbortedException { } @ Override public boolean deleteCars ( long xid , String location , int numCars ) throws RemoteException , TransactionAbortedException { } @ Override public boolean newCustomer ( long xid , String custName ) throws RemoteException , TransactionAbortedException { } @ Override public boolean deleteCustomer ( long xid , String custName ) throws RemoteException , TransactionAbortedException { } private < T > T get ( long xid , String key , Class < ? extends T > clazz , HostName who ) throws RemoteException { } @ Override public int queryFlight ( long xid , String flightNum ) throws RemoteException { } @ Override public int queryFlightPrice ( long xid , String flightNum ) throws RemoteException { } @ Override public int queryRooms ( long xid , String location ) throws RemoteException { } @ Override public int queryRoomsPrice ( long xid , String location ) throws RemoteException { } @ Override public int queryCars ( long xid , String location ) throws RemoteException { } @ Override public int queryCarsPrice ( long xid , String location ) throws RemoteException { } @ Override public int queryCustomerBill ( long xid , String custName ) throws RemoteException { if ( custName == null ) { return - 1 ; } ResourceManager reservationRM = rm ( RMReservations ) ; ResourceManager carRM = rm ( RMCars ) ; ResourceManager hotelRM = rm ( RMRooms ) ; ResourceManager flightRM = rm ( RMFlights ) ; try { List < ResourceItem < ReservationKey > > reservations = reservationRM . query ( xid , "custName" , custName ) ; <START_BUG> if ( ( reservations == null ) || ( reservations . isEmpty ( ) ) ) { <END_BUG> return - 1 ; } int result = 0 ; for ( ResourceItem < ReservationKey > reservation : reservations ) { ReservationKey key = reservation . getKey ( ) ; switch ( key . resvType ( ) ) { case FLIGHT : Flight flight = ( ( Flight ) ( flightRM . query ( xid , key . resvKey ( ) ) ) ) ; result += flight . price ( ) ; break ; case CAR : Car car = ( ( Car ) ( carRM . query ( xid , key . resvKey ( ) ) ) ) ; result += car . price ( ) ; break ; case HOTEL : Hotel hotel = ( ( Hotel ) ( hotelRM . query ( xid , key . resvKey ( ) ) ) ) ; result += hotel . price ( ) ; break ; } } return result ; } catch ( DeadlockException e ) { throw new RemoteException ( String . format ( "Deadlock<seq2seq4repair_space>detected<seq2seq4repair_space>for<seq2seq4repair_space>%d:%s" , xid , e ) ) ; } } private < T extends ResourceItem < String > > boolean reserve ( long xid , String custName , String key , Class < T > clazz , ReservationType type , HostName who ) throws RemoteException , TransactionAbortedException { } @ Override public boolean reserveFlight ( long xid , String custName , String flightNum ) throws RemoteException , TransactionAbortedException { } @ Override public boolean reserveCar ( long xid , String custName , String location ) throws RemoteException , TransactionAbortedException { } @ Override public boolean reserveRoom ( long xid , String custName , String location ) throws RemoteException , TransactionAbortedException { } @ Override public boolean reconnect ( ) throws RemoteException { } @ Override public boolean dieNow ( HostName who ) throws RemoteException { } public boolean dieRMAfterEnlist ( HostName who ) throws RemoteException { } public boolean dieRMBeforePrepare ( HostName who ) throws RemoteException { } public boolean dieRMAfterPrepare ( HostName who ) throws RemoteException { } public boolean dieRMBeforeCommit ( HostName who ) throws RemoteException { } public boolean dieRMBeforeAbort ( HostName who ) throws RemoteException { } public boolean dieTMBeforeCommit ( ) throws RemoteException { } public boolean dieTMAfterCommit ( ) throws RemoteException { } @ Override public boolean dieNow ( ) throws RemoteException { } private boolean dieNow ( Remote host ) { } private boolean dieRM ( HostName who , DieTime time ) throws RemoteException { }

Fix:
if ( reservations == null ) {