Skip to content

Presence of wire wrapper for LIF data in LIF files #33

@reckart

Description

@reckart

It seems as if it is not specified whether LIF files should some with a wire wrapper or not. Apparently data generated within LAPPS Galaxy comes with a wire wrapper so it can carry error messages in its payload instead of actual LIF data. But it seems that for normal usage of LIF files, wrapper should not be necessary.

Also, parsing files in such a way that they might or might not contain a wire wrapper is kind of hacky:

            Container container;
            String json = IOUtils.toString(res.getInputStream(), sourceEncoding);
            try {
                // First try parsing without the wire wrapper.
                container = Serializer.parse(json, Container.class);
            }
            catch (Exception e) {
                // If that fails, it might be because there is a wire wrapper around the actual
                // data, so let's try that.
                container = (Container) Serializer.parse(json, DataContainer.class).getPayload();
            }

It would be nice if

  • there was a clear specification when a wire wrapper is supposed to be present
  • the API should be able to deal with it nicely

Note that in the case above, doing a container = Serializer.parse(json, Container.class).getPayload() fails with a ClassCastException stating that the payload is a map which cannot be cast to Container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions