Buggy code:
cursor . moveToFirst ( ) ; int rid = cursor . getInt ( cursor . getColumnIndex ( "rid" ) ) ; cursor = db . query ( "restaurants" , null , ( "rid<seq2seq4repair_space>=<seq2seq4repair_space>" + rid ) , null , null , null , null ) ; cursor . moveToFirst ( ) ; restaurant_names . add ( cursor . getString ( cursor . getColumnIndex ( "name" ) ) ) ; restaurant_lats . add ( cursor . getInt ( cursor . getColumnIndex ( "lat" ) ) ) ; restaurant_lons . add ( cursor . getInt ( cursor . getColumnIndex ( "lon" ) ) ) ; double distance = MapFragment . distanceBetween ( myLoc , new GeoPoint ( cursor . getInt ( cursor . getColumnIndex ( "lat" ) ) , cursor . getInt ( cursor . getColumnIndex ( "lon" ) ) ) ) ; restaurant_distances . add ( String . format ( "%.1f" , distance ) ) ; } } else { Cursor cursor = db . query ( "restaurants" , null , ( ( "name<seq2seq4repair_space>LIKE<seq2seq4repair_space>'%" + query ) + "%'" ) , null , null , null , null ) ; cursor . moveToFirst ( ) ; int rid = cursor . getInt ( cursor . getColumnIndex ( "rid" ) ) ; String restaurant_name = cursor . getString ( cursor . getColumnIndex ( "name" ) ) ; int restaurant_lat = cursor . getInt ( cursor . getColumnIndex ( "lat" ) ) ; int restaurant_lon = cursor . getInt ( cursor . getColumnIndex ( "lon" ) ) ; double distance = MapFragment . distanceBetween ( myLoc , new GeoPoint ( restaurant_lat , restaurant_lon ) ) ; cursor = db . query ( "restaurants_items" , null , ( "rid<seq2seq4repair_space>=<seq2seq4repair_space>" + rid ) , null , null , null , null ) ; cursor . moveToFirst ( ) ; while ( ! ( cursor . isAfterLast ( ) ) ) { item_ids . add ( cursor . getInt ( cursor . getColumnIndex ( "iid" ) ) ) ; cursor . moveToNext ( ) ; } for ( int i = 0 ; i < ( item_ids . size ( ) ) ; i ++ ) { cursor = db . query ( "items" , null , ( "iid<seq2seq4repair_space>=<seq2seq4repair_space>" + ( item_ids . get ( i ) ) ) , null , null , null , null ) ; cursor . moveToFirst ( ) ; restaurant_names . add ( restaurant_name ) ; restaurant_lats . add ( restaurant_lat ) ; restaurant_lons . add ( restaurant_lon ) ; restaurant_distances . add ( String . format ( "%.1f" , distance ) ) ; item_names . add ( cursor . getString ( cursor . getColumnIndex ( "name" ) ) ) ; String price = cursor . getString ( cursor . getColumnIndex ( "price" ) ) ; if ( price . equals ( "0.00" ) ) { price = "Unknown<seq2seq4repair_space>Price" ; } item_prices . add ( price ) ; item_descriptions . add ( cursor . getString ( cursor . getColumnIndex ( "description" ) ) ) ; item_vegs . add ( cursor . getInt ( cursor . getColumnIndex ( "veg" ) ) ) ; } } db . close ( ) ; Bundle b = new Bundle ( ) ; b . putString ( "query" , query ) ; b . putBoolean ( "menu" , menu ) ; b . putIntegerArrayList ( "item_ids" , item_ids ) ; b . putStringArrayList ( "restaurant_names" , restaurant_names ) ; b . putIntegerArrayList ( "restaurant_lats" , restaurant_lats ) ; b . putIntegerArrayList ( "restaurant_lons" , restaurant_lons ) ; b . putStringArrayList ( "restaurant_distances" , restaurant_distances ) ; b . putStringArrayList ( "item_names" , item_names ) ; b . putStringArrayList ( "item_prices" , item_prices ) ; b . putStringArrayList ( "item_descriptions" , item_descriptions ) ; b . putIntegerArrayList ( "item_vegs" , item_vegs ) ; ArrayList < Item > item_list = new ArrayList < Item > ( ) ; for ( int i = 0 ; i < ( item_ids . size ( ) ) ; i ++ ) { boolean mSort = ( menu ) ? prefs . getBoolean ( "sortPrice" , false ) : true ; Item item = new Item ( item_ids . get ( i ) , restaurant_names . get ( i ) , restaurant_lats . get ( i ) , restaurant_lons . get ( i ) , restaurant_distances . get ( i ) , item_names . get ( i ) , item_prices . get ( i ) , item_descriptions . get ( i ) , item_vegs . get ( i ) , mSort ) ; item_list . add ( item ) ; } Collections . sort ( item_list ) ; ArrayList < String > combined = new ArrayList < String > ( ) ; String thisName = "" ; for ( Iterator < Item > i = item_list . iterator ( ) ; i . hasNext ( ) ; ) { Item item = i . next ( ) ; if ( ! ( item . restaurant_name . equals ( thisName ) ) ) { combined . add ( ( ( ( ( ( ( combined . size ( ) ) == 0 ? "" : "\n\n" ) + ( item . restaurant_name ) ) + "\n" ) + ( item . restaurant_distance ) ) + "<seq2seq4repair_space>mi.\n\n" ) ) ; } <START_BUG> combined . add ( ( ( ( ( ( item . item_name ) + ( item . item_description . equals ( "" ) ? "" : "\n" + ( item . item_description ) ) ) + ( item . item_price . equals ( "Unknown<seq2seq4repair_space>Price" ) ? "" : "\n$" + ( item . item_price ) ) ) + "\n\n" ) + ( ( item . item_veg ) != 0 ? "We<seq2seq4repair_space>think<seq2seq4repair_space>this<seq2seq4repair_space>IS<seq2seq4repair_space>a<seq2seq4repair_space>vegetarian<seq2seq4repair_space>item" : "We<seq2seq4repair_space>think<seq2seq4repair_space>this<seq2seq4repair_space>is<seq2seq4repair_space>NOT<seq2seq4repair_space>a<seq2seq4repair_space>vegetarian<seq2seq4repair_space>item" ) ) ) ; <END_BUG> thisName = item . restaurant_name ; } b . putStringArrayList ( "combined" , combined ) ; return b ; } }

Fix:
combined . add ( ( ( ( ( ( item . item_name ) + ( item . item_description . equals ( "" ) ? "" : "\n" + ( item . item_description ) ) ) + ( item . item_price . equals ( "Unknown<seq2seq4repair_space>Price" ) ? "" : "\n$" + ( item . item_price ) ) ) + "\n" ) + ( ( item . item_veg ) == 1 ? "We<seq2seq4repair_space>think<seq2seq4repair_space>this<seq2seq4repair_space>IS<seq2seq4repair_space>a<seq2seq4repair_space>vegetarian<seq2seq4repair_space>item" : "We<seq2seq4repair_space>think<seq2seq4repair_space>this<seq2seq4repair_space>is<seq2seq4repair_space>NOT<seq2seq4repair_space>a<seq2seq4repair_space>vegetarian<seq2seq4repair_space>item" ) ) ) ;