teragrep / cfe_31

0 stars 0 forks source link

HostMeta shouldn't be sent if one of the fields is null #43

Closed MoonBow-1 closed 5 months ago

MoonBow-1 commented 5 months ago

Describe the bug

Currently HostMetas are sent even if they contain fields which are null

Expected behavior

HostMetas with null fields are not sent and are reported in a file

Software version

1.0.0

MoonBow-1 commented 5 months ago

Implemented the first version of the check and reporting.

There was a problem with Gson not wanting to serialize a Java Path, which resulted in a StackOverflow Exception, but adding an @exclude annotation to the field fixed it. (Not serialized when sending or wiring to file).

MoonBow-1 commented 5 months ago

Tests have been added to check for correct behavior. HostMeta with null fields are written to faultyReport.json with the following syntax:

{
    "path": "/path/to/HostMetaFile.conf.json",
    "reason": "Fields [meta1, meta2, meta3, meta4] are null",
    "jsonObject": {
      "meta1": null,
      "meta2": null,
      "meta3": null,
      "meta4": null
    }
  }
MoonBow-1 commented 5 months ago

HostMeta class needed to be refactored a bit more, related to #44