private String[] getChangedFields(JsonValue before, JsonValue after) { if (null == before && null == after) { return new String[0]; } // Default to empty json when they are null. if (after == null) { after = json(object()); } if (before == null) { before = json(object()); } // Now find the changed fields. List<String> changedFields = new ArrayList<>(); for (JsonValue change : JsonPatch.diff(before, after)) { String diff = change.get(JsonPatch.PATH_PTR).asString(); // Config objects require id only for repo storage and not on the filesystem. // As far as reporting changes to a config, it is not relevant to be reported as changes. if (!ROOT_ID_PATH.equals(diff)) { changedFields.add(diff); } } return changedFields.toArray(new String[changedFields.size()]); }