Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/851#discussion_r155347462 --- Diff: metron-platform/metron-common/src/main/java/org/apache/metron/common/configuration/ConfigurationsUtils.java --- @@ -572,15 +590,22 @@ public static void applyConfigPatchToZookeeper(ConfigurationType configurationTy * @param patchData a JSON patch in the format specified by RFC 6902 * @param client access to zookeeeper */ - public static void applyConfigPatchToZookeeper(ConfigurationType configurationType, - Optional<String> configName, - byte[] patchData, CuratorFramework client) throws Exception { + public static void applyConfigPatchToZookeeper( + ConfigurationType configurationType, + Optional<String> configName, + byte[] patchData, CuratorFramework client) throws Exception { + byte[] configData = readConfigBytesFromZookeeper(configurationType, configName, client); JsonNode source = JSONUtils.INSTANCE.readTree(configData); JsonNode patch = JSONUtils.INSTANCE.readTree(patchData); JsonNode patchedConfig = JSONUtils.INSTANCE.applyPatch(patch, source); - writeConfigToZookeeper(configurationType, configName, - JSONUtils.INSTANCE.toJSONPretty(patchedConfig), client); + byte[] prettyPatchedConfig = JSONUtils.INSTANCE.toJSONPretty(patchedConfig); + + // ensure the patch produces a valid result; otherwise exception thrown during deserialization --- End diff -- Heh, well our meta-PR was to address a code change that resulted in duplication, not just a style preference. ;)
---