Buggy code:
public cgGeo startGeo ( UpdateLocationCallback geoUpdate ) { } public cgGeo removeGeo ( ) { } private class removeGeoThread extends Thread { @ Override public void run ( ) { } } public cgDirection startDir ( Context context , UpdateDirectionCallback dirUpdate ) { } public cgDirection removeDir ( ) { } private class removeDirThread extends Thread { @ Override public void run ( ) { } } public void cleanDatabase ( boolean more ) { } public boolean isThere ( String geocode , String guid , boolean detailed , boolean checkTime ) { } public boolean isOffline ( String geocode , String guid ) { } public String getGeocode ( String guid ) { } public String getCacheid ( String geocode ) { } public static StatusCode getError ( final cgSearch search ) { } public static boolean setError ( final cgSearch search , final StatusCode error ) { } public static String getUrl ( final cgSearch search ) { } public static boolean setUrl ( final cgSearch search , String url ) { } public static String [ ] getViewstates ( final cgSearch search ) { } public static boolean setViewstates ( final cgSearch search , String [ ] viewstates ) { } public static int getTotal ( final cgSearch search ) { } public static int getCount ( final cgSearch search ) { } public boolean hasUnsavedCaches ( final cgSearch search ) { } public cgCache getCacheByGeocode ( String geocode ) { } public cgCache getCacheByGeocode ( final String geocode , final int loadFlags ) { } public cgTrackable getTrackableByGeocode ( String geocode ) { } public void removeCacheFromCache ( String geocode ) { } public void putCacheInCache ( cgCache cache ) { } public String [ ] geocodesInCache ( ) { } public List < Number > getBounds ( String geocode ) { } public List < Number > getBounds ( final cgSearch search ) { } public List < Number > getBounds ( final List < String > geocodes ) { } public cgCache getCache ( final cgSearch search ) { } public List < cgCache > getCaches ( final cgSearch search , final boolean loadWaypoints ) { } public List < cgCache > getCaches ( final cgSearch search , Long centerLat , Long centerLon , Long spanLat , Long spanLon ) { } public List < cgCache > getCaches ( final cgSearch search , final Long centerLat , final Long centerLon , final Long spanLat , final Long spanLon , final int loadFlags ) { } public cgSearch getBatchOfStoredCaches ( final boolean detailedOnly , final Geopoint coords , final CacheType cacheType , final int list ) { } public List < cgDestination > getHistoryOfSearchedLocations ( ) { } public cgSearch getHistoryOfCaches ( final boolean detailedOnly , final CacheType cacheType ) { } public cgSearch getCachedInViewport ( final Long centerLat , final Long centerLon , final Long spanLat , final Long spanLon , final CacheType cacheType ) { } public cgSearch getStoredInViewport ( final Long centerLat , final Long centerLon , final Long spanLat , final Long spanLon , final CacheType cacheType ) { } public int getAllStoredCachesCount ( final boolean detailedOnly , final CacheType cacheType , final Integer list ) { } private cgData getStorage ( ) { } public int getAllHistoricCachesCount ( ) { } public void markStored ( String geocode , int listId ) { } public boolean markDropped ( String geocode ) { } public boolean markFound ( String geocode ) { } public boolean clearSearchedDestinations ( ) { } public boolean saveSearchedDestination ( cgDestination destination ) { } public boolean saveWaypoints ( String geocode , List < cgWaypoint > waypoints , boolean drop ) { } public boolean saveOwnWaypoint ( int id , String geocode , cgWaypoint waypoint ) { } public boolean deleteWaypoint ( int id ) { } public boolean saveTrackable ( cgTrackable trackable ) { } public static void addGeocode ( final cgSearch search , final String geocode ) { } public void addSearch ( final List < cgCache > cacheList , final int reason ) { if ( CollectionUtils . isEmpty ( cacheList ) ) { return ; } if ( ( storage ) == null ) { storage = new cgData ( this ) ; } for ( final cgCache cache : cacheList ) { cache . setReason ( reason ) ; <START_BUG> storeWithMerge ( cache , false ) ; <END_BUG> } } public boolean addCacheToSearch ( cgSearch search , cgCache cache ) { } private boolean storeWithMerge ( final cgCache cache , final boolean override ) { } public void dropStored ( int listId ) { } public List < cgTrackable > loadInventory ( String geocode ) { } public Map < LogType , Integer > loadLogCounts ( String geocode ) { } public List < cgImage > loadSpoilers ( String geocode ) { } public cgWaypoint loadWaypoint ( int id ) { } public void setAction ( String action ) { } public String getAction ( ) { } public boolean addLog ( String geocode , cgLog log ) { } public void setLastCoords ( final Geopoint coords ) { } public Geopoint getLastCoords ( ) { } public boolean saveLogOffline ( String geocode , Date date , LogType logtype , String log ) { } public cgLog loadLogOffline ( String geocode ) { } public void clearLogOffline ( String geocode ) { } public void saveVisitDate ( String geocode ) { } public void clearVisitDate ( String geocode ) { } public List < StoredList > getLists ( ) { } public StoredList getList ( int id ) { } public int createList ( String title ) { } public int renameList ( final int listId , final String title ) { } public boolean removeList ( int id ) { } public boolean removeSearchedDestinations ( cgDestination destination ) { } public void moveToList ( String geocode , int listId ) { } public String getCacheDescription ( String geocode ) { } }

Fix:
storeWithMerge ( cache , ( reason >= 1 ) ) ;