Source:
private Pair<Integer, String> recover(HttpRequestEndpoints requestor, AndroidTransactionParserFactory factory) { this.publishProgress(PROGRESS_RECOVERY_NEEDED); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery Triggered"); BitCache cache; try { RemoteDataPullResponse pullResponse = dataPullRequester.makeDataPullRequest(this, requestor, server, false); if (!(pullResponse.responseCode >= 200 && pullResponse.responseCode < 300)) { return new Pair<>(PROGRESS_RECOVERY_FAIL_SAFE, ""); } cache = pullResponse.writeResponseToCache(context); } catch (IOException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery Failed due to IOException|" + e.getMessage()); return new Pair<>(PROGRESS_RECOVERY_FAIL_SAFE, ""); } this.publishProgress(PROGRESS_RECOVERY_STARTED); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery payload downloaded"); CommCareApplication._().getUserStorage(ACase.STORAGE_KEY, ACase.class).removeAll(); String failureReason = ""; try { String syncToken = readInput(cache.retrieveCache(), factory); updateUserSyncToken(syncToken); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery Succesful"); return new Pair<>(PROGRESS_DONE, ""); } catch (ActionableInvalidStructureException e) { e.printStackTrace(); failureReason = e.getLocalizedMessage(); } catch (InvalidStructureException e) { e.printStackTrace(); failureReason = e.getMessage(); } catch (XmlPullParserException e) { e.printStackTrace(); failureReason = e.getMessage(); } catch (UnfullfilledRequirementsException e) { e.printStackTrace(); failureReason = e.getMessage(); } catch (StorageFullException e) { e.printStackTrace(); failureReason = e.getMessage(); } catch (IOException e) { e.printStackTrace(); failureReason = e.getMessage(); } finally { cache.release(); } Logger.log(AndroidLogger.TYPE_USER, "Sync recovery failed|" + failureReason); return new Pair<>(PROGRESS_RECOVERY_FAIL_BAD, failureReason); }

Target:
private Pair<Integer, String> recover(HttpRequestEndpoints requestor, AndroidTransactionParserFactory factory) { this.publishProgress(PROGRESS_RECOVERY_NEEDED); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery Triggered"); BitCache cache; try { RemoteDataPullResponse pullResponse = dataPullRequester.makeDataPullRequest(this, requestor, server, false); if (!(pullResponse.responseCode >= 200 && pullResponse.responseCode < 300)) { return new Pair<>(PROGRESS_RECOVERY_FAIL_SAFE, ""); } cache = pullResponse.writeResponseToCache(context); } catch (IOException e) { e.printStackTrace(); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery Failed due to IOException|" + e.getMessage()); return new Pair<>(PROGRESS_RECOVERY_FAIL_SAFE, ""); } this.publishProgress(PROGRESS_RECOVERY_STARTED); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery payload downloaded"); CommCareApplication._().getUserStorage(ACase.STORAGE_KEY, ACase.class).removeAll(); String failureReason = ""; try { String syncToken = readInput(cache.retrieveCache(), factory); updateUserSyncToken(syncToken); Logger.log(AndroidLogger.TYPE_USER, "Sync Recovery Succesful"); return new Pair<>(PROGRESS_DONE, ""); } catch (ActionableInvalidStructureException e) { e.printStackTrace(); failureReason = e.getLocalizedMessage(); } catch (InvalidStructureException | XmlPullParserException | UnfullfilledRequirementsException | StorageFullException | SessionUnavailableException | IOException e) { e.printStackTrace(); failureReason = e.getMessage(); } finally { cache.release(); } Logger.log(AndroidLogger.TYPE_USER, "Sync recovery failed|" + failureReason); return new Pair<>(PROGRESS_RECOVERY_FAIL_BAD, failureReason); }