Program: 19153
Project: 19153
Buggy source:
@Override protected Boolean doInBackground(String... params) throws Exception {
  AuthenticatorHelper authenticatorHelper=App.get(mContext).getAuthenticatorHelper();
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mContext);
  int logCount=prefs.getInt(PrefConstants.DOWNLOADING_COUNT_OF_LOGS,5);
  if (!authenticatorHelper.hasAccount())   throw new InvalidCredentialsException("String_Node_Str");
  WherigoService wherigoService=new WherigoServiceImpl();
  String cacheId=params[0];
  if (!ImportActivity.CACHE_CODE_PATTERN.matcher(cacheId).find()) {
    cacheId=wherigoService.getCacheCodeFromGuid(cacheId);
  }
  GeocachingApi api=GeocachingApiFactory.create();
  try {
    login(api);
    GeocachingApi.ResultQuality resultQuality=GeocachingApi.ResultQuality.FULL;
    if (!authenticatorHelper.getRestrictions().isPremiumMember()) {
      resultQuality=GeocachingApi.ResultQuality.SUMMARY;
      logCount=0;
    }
    Geocache cache=api.getCache(resultQuality,cacheId,logCount,0);
    authenticatorHelper.getRestrictions().updateLimits(api.getLastCacheLimits());
    if (isCancelled())     return false;
    if (cache == null)     throw new CacheNotFoundException(cacheId);
    File dataFile=ActionDisplayPointsExtended.getCacheFileName(mContext);
    StoreableListFileOutput slfo=null;
    try {
      slfo=new StoreableListFileOutput(ActionDisplayPointsExtended.getCacheFileOutputStream(mContext));
      Waypoint waypoint=LocusDataMapper.toLocusPoint(mContext,cache);
      PackWaypoints pack=new PackWaypoints("String_Node_Str");
      pack.addWaypoint(waypoint);
      slfo.beginList();
      slfo.write(pack);
      slfo.endList();
    }
 catch (    IOException e) {
      Timber.e(e,e.getMessage());
      throw new GeocachingApiException(e.getMessage(),e);
    }
 finally {
      Utils.closeStream(slfo);
    }
    try {
      return ActionDisplayPointsExtended.sendPacksFile(mContext,dataFile,true,false,Intent.FLAG_ACTIVITY_NEW_TASK);
    }
 catch (    RequiredVersionMissingException e) {
      Timber.e(e,e.getMessage());
      return false;
    }
  }
 catch (  InvalidSessionException e) {
    Timber.e(e,e.getMessage());
    authenticatorHelper.invalidateAuthToken();
    throw e;
  }
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(String... params) throws Exception {
  AuthenticatorHelper authenticatorHelper=App.get(mContext).getAuthenticatorHelper();
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(mContext);
  int logCount=prefs.getInt(PrefConstants.DOWNLOADING_COUNT_OF_LOGS,5);
  if (!authenticatorHelper.hasAccount())   throw new InvalidCredentialsException("String_Node_Str");
  WherigoService wherigoService=new WherigoServiceImpl();
  String cacheId=params[0];
  if (!ImportActivity.CACHE_CODE_PATTERN.matcher(cacheId).find()) {
    cacheId=wherigoService.getCacheCodeFromGuid(cacheId);
  }
  GeocachingApi api=GeocachingApiFactory.create();
  try {
    login(api);
    GeocachingApi.ResultQuality resultQuality=GeocachingApi.ResultQuality.FULL;
    if (!authenticatorHelper.getRestrictions().isPremiumMember()) {
      resultQuality=GeocachingApi.ResultQuality.SUMMARY;
      logCount=0;
    }
    Geocache cache=api.getGeocache(resultQuality,cacheId,logCount,0);
    authenticatorHelper.getRestrictions().updateLimits(api.getLastGeocacheLimits());
    if (isCancelled())     return false;
    if (cache == null)     throw new CacheNotFoundException(cacheId);
    File dataFile=ActionDisplayPointsExtended.getCacheFileName(mContext);
    StoreableListFileOutput slfo=null;
    try {
      slfo=new StoreableListFileOutput(ActionDisplayPointsExtended.getCacheFileOutputStream(mContext));
      Waypoint waypoint=LocusDataMapper.toLocusPoint(mContext,cache);
      PackWaypoints pack=new PackWaypoints("String_Node_Str");
      pack.addWaypoint(waypoint);
      slfo.beginList();
      slfo.write(pack);
      slfo.endList();
    }
 catch (    IOException e) {
      Timber.e(e,e.getMessage());
      throw new GeocachingApiException(e.getMessage(),e);
    }
 finally {
      Utils.closeStream(slfo);
    }
    try {
      return ActionDisplayPointsExtended.sendPacksFile(mContext,dataFile,true,false,Intent.FLAG_ACTIVITY_NEW_TASK);
    }
 catch (    RequiredVersionMissingException e) {
      Timber.e(e,e.getMessage());
      return false;
    }
  }
 catch (  InvalidSessionException e) {
    Timber.e(e,e.getMessage());
    authenticatorHelper.invalidateAuthToken();
    throw e;
  }
}