Source:
public void run() { String username = cli.getOptionValue(ODK_USERNAME); String password = cli.getOptionValue(ODK_PASSWORD); String server = cli.getOptionValue(AGGREGATE_URL); String formid = cli.getOptionValue(FORM_ID); String storageDir = cli.getOptionValue(STORAGE_DIRECTORY); String fileName = cli.getOptionValue(EXPORT_FILENAME); String exportPath = cli.getOptionValue(EXPORT_DIRECTORY); String startDateString = cli.getOptionValue(EXPORT_START_DATE); String endDateString = cli.getOptionValue(EXPORT_END_DATE); boolean exportMedia = !cli.hasOption(EXCLUDE_MEDIA_EXPORT); boolean overwrite = cli.hasOption(OVERWRITE_CSV_EXPORT); boolean pullBefore = cli.hasOption(PULL_BEFORE_EXPORT); String odkDir = cli.getOptionValue(ODK_DIR); String pemKeyFile = cli.getOptionValue(PEM_FILE); try { if (odkDir != null) importODK(storageDir, Paths.get(odkDir)); if (odkDir == null && server != null) pullFormFromAggregate(storageDir, formid, username, password, server, false); if (exportPath != null) export( storageDir, formid, Paths.get(exportPath), fileName, exportMedia, overwrite, pullBefore, Optional.ofNullable(startDateString).map(s -> LocalDate.parse(s.replaceAll("/", "-"))), Optional.ofNullable(endDateString).map(s -> LocalDate.parse(s.replaceAll("/", "-"))), Optional.ofNullable(pemKeyFile).map(Paths::get) ); } catch (BriefcaseException e) { System.err.println("Error: " + e.getMessage()); log.error("Error", e); System.exit(1); } catch (Throwable t) { System.err.println("Unexpected error in Briefcase. Please review briefcase.log for more information. For help, post to <LINK_0>"); log.error("Error", t); System.exit(1); } }

Target:
public void run() { String username = cli.getOptionValue(ODK_USERNAME); String password = cli.getOptionValue(ODK_PASSWORD); String server = cli.getOptionValue(AGGREGATE_URL); String formid = cli.getOptionValue(FORM_ID); String storageDir = cli.getOptionValue(STORAGE_DIRECTORY); String fileName = cli.getOptionValue(EXPORT_FILENAME); String exportPath = cli.getOptionValue(EXPORT_DIRECTORY); String startDateString = cli.getOptionValue(EXPORT_START_DATE); String endDateString = cli.getOptionValue(EXPORT_END_DATE); boolean exportMedia = !cli.hasOption(EXCLUDE_MEDIA_EXPORT); boolean overwrite = cli.hasOption(OVERWRITE_CSV_EXPORT); String odkDir = cli.getOptionValue(ODK_DIR); String pemKeyFile = cli.getOptionValue(PEM_FILE); try { if (odkDir != null) importODK(storageDir, Paths.get(odkDir), Optional.empty()); if (odkDir == null && server != null) pullFormFromAggregate(storageDir, formid, username, password, server, false); if (exportPath != null) export( storageDir, formid, Paths.get(exportPath), fileName, exportMedia, overwrite, false, Optional.ofNullable(startDateString).map(s -> LocalDate.parse(s.replaceAll("/", "-"))), Optional.ofNullable(endDateString).map(s -> LocalDate.parse(s.replaceAll("/", "-"))), Optional.ofNullable(pemKeyFile).map(Paths::get) ); } catch (BriefcaseException e) { System.err.println("Error: " + e.getMessage()); log.error("Error", e); System.exit(1); } catch (Throwable t) { System.err.println("Unexpected error in Briefcase. Please review briefcase.log for more information. For help, post to <LINK_0>"); log.error("Error", t); System.exit(1); } }