Buggy code:
private static GenericToolkit instance = null ; private GenericToolkit ( ) { } public static GenericToolkit getInstance ( ) { } SimpleDateFormat dateYYYYMMDD = new SimpleDateFormat ( "yyyyMMdd" ) ; final int REGION = 0 ; final int ZONE = 1 ; final int OS = 2 ; final int INSTANCE_TYPE = 3 ; final int DATE = 4 ; public String generateProfileKey ( String region , String zone , String OS , String instanceType , Date date ) { } public String [ ] reverseLookUpProfile ( String profile ) { } public Date dateConvert ( String date ) { } private ArrayList < String > removeProfile ( String profile ) { } private ArrayList < String > addProfile ( String profile ) { } public ArrayList < String > getProfiles ( ) { } private ArrayList < String > removeDelete ( String delete ) { } private ArrayList < String > addDelete ( String delete ) { } public ArrayList < String > getDeletes ( ) { } public String [ ] [ ] getBidsOffers ( String profile ) { } public String queryDataStore ( ) { } public Entity [ ] queryDataStore ( String optProfile , String forcedDelete ) { } public Msg createBidOffer ( String profile , double price , String user , String arrayIndex ) { } public Boolean autoTransaction ( Boolean seller , double price , String profile , String arrayIndex ) { } public Msg createTransaction ( String profile , String arrayIndex , String buyer , String ami , String securityGroupName , String keyPairName ) { } public String createTestTransaction ( Date date , String time ) { } public List < Entity > getOpenTransactions ( ) { } public void updateTransaction ( Key key , String propertyName , String value ) { } public Entity getUserProfileForUser ( String userId ) { } public void updateUserProfile ( String userId , String propertyName , String value ) { } public UserProfile [ ] getBuyerSellerProfileForTransaction ( Key key ) { } public void createCharge ( Key key , String instanceId , String userId , String amount , String type ) { } public List < Entity > getChargesForUser ( String userId ) { } public Msg cancelBidOffer ( String key , String userId ) { } private void deleteBidOffer ( String profile , String arrayIndex ) { } public String profileToKey ( String profile , String arrayIndex ) { } private Msg sendChannelMessage ( String type , String action , String value , String qty , String profile , String arrayIndex ) { } private String indexToHour ( String arrayIndex ) { } private int hourToIndex ( String hour , Boolean seller ) { } private Msg updateMemcache ( Boolean flag , String profile , String arrayIndex , Entity e ) { Entity [ ] tmpList = null ; Entity m = null ; int index = Integer . valueOf ( arrayIndex ) ; if ( ! ( syncCache . contains ( profile ) ) ) { try { Thread . sleep ( 1000 ) ; queryDataStore ( profile , "" ) ; } catch ( InterruptedException e1 ) { e1 . printStackTrace ( ) ; } } System . out . println ( "updateMemCache::1" ) ; if ( e == null ) { queryDataStore ( profile , "" ) ; if ( ! ( syncCache . contains ( profile ) ) ) { <START_BUG> return sendChannelMessage ( "REFRESH" , "refresh" , "0" , "1" , profile , "0" ) ; <END_BUG> } else { m = ( ( Entity [ ] ) ( syncCache . get ( profile ) ) ) [ index ] ; if ( m != null ) return sendChannelMessage ( "UPDATE" , "bidOffer" , String . valueOf ( ( ( Double ) ( m . getProperty ( "price" ) ) ) ) , "1" , profile , String . valueOf ( index ) ) ; else { return sendChannelMessage ( "UPDATE" , "bidOffer" , "" , "1" , profile , String . valueOf ( index ) ) ; } } } if ( syncCache . contains ( profile ) ) tmpList = ( ( Entity [ ] ) ( syncCache . get ( profile ) ) ) ; else tmpList = new Entity [ 48 ] ; m = tmpList [ index ] ; if ( m == null ) { tmpList [ index ] = e ; syncCache . put ( profile , tmpList ) ; return sendChannelMessage ( "UPDATE" , "bidOffer" , String . valueOf ( ( ( Double ) ( e . getProperty ( "price" ) ) ) ) , "1" , profile , String . valueOf ( index ) ) ; } System . out . println ( "updateMemCache::4" ) ; if ( ( ( Boolean ) ( m . getProperty ( "seller" ) ) ) ) { System . out . println ( "updateMemCache::5" ) ; if ( ( ( ( Double ) ( m . getProperty ( "price" ) ) ) <= ( ( Double ) ( e . getProperty ( "price" ) ) ) ) && ( ! ( m . equals ( e ) ) ) ) return null ; } else { System . out . println ( "updateMemCache::6" ) ; if ( ( ( ( Double ) ( m . getProperty ( "price" ) ) ) >= ( ( Double ) ( e . getProperty ( "price" ) ) ) ) && ( ! ( m . equals ( e ) ) ) ) return null ; } System . out . println ( "updateMemCache::7" ) ; tmpList [ index ] = e ; syncCache . put ( profile , tmpList ) ;

Fix:
return sendChannelMessage ( "REFRESH" , "REFRESH" , "0" , "1" , profile , "0" ) ;