Github user nreich commented on a diff in the pull request: https://github.com/apache/geode/pull/753#discussion_r136641632 --- Diff: geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportDataCommand.java --- @@ -87,4 +80,45 @@ public Result exportData( } return result; } + + private Result getFunctionResult(ResultCollector<?, ?> rc) { + Result result; + List<Object> results = (List<Object>) rc.getResult(); + if (results != null) { + Object resultObj = results.get(0); + if (resultObj instanceof String) { + result = ResultBuilder.createInfoResult((String) resultObj); + } else if (resultObj instanceof Exception) { + result = ResultBuilder.createGemFireErrorResult(((Exception) resultObj).getMessage()); + } else { + result = ResultBuilder.createGemFireErrorResult( + CliStrings.format(CliStrings.COMMAND_FAILURE_MESSAGE, CliStrings.EXPORT_DATA)); + } + } else { + result = ResultBuilder.createGemFireErrorResult( + CliStrings.format(CliStrings.COMMAND_FAILURE_MESSAGE, CliStrings.EXPORT_DATA)); + } + return result; + } + + private String defaultFileName(String dirPath, String regionName) { + return new File(dirPath, regionName + RegionSnapshotService.SNAPSHOT_FILE_EXTENSION) + .getAbsolutePath(); + } + + private Optional<Result> validatePath(String filePath, String dirPath, boolean parallel) { --- End diff -- I thought about having them both extend the same abstract base class: that would remove the duplicate code. The method is not dependant on state of the object, so it could be extracted into a static helper method (suggestions on where would be best to put it if this route is desirable?).
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---