Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/metron/pull/851#discussion_r154763112
  
    --- 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 --
    
    Can we reword this?  It needs to be clear that some things cannot be 
deserialized if they have an invalid configuration.



---

Reply via email to