You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (Jira)" <de...@uima.apache.org> on 2020/12/03 21:49:00 UTC

[jira] [Commented] (UIMA-6295) CAS transportable Java object not serialised or deserialised with compressed binary

    [ https://issues.apache.org/jira/browse/UIMA-6295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17243533#comment-17243533 ] 

Richard Eckart de Castilho commented on UIMA-6295:
--------------------------------------------------

Based on your analysis of the code, I made a modification to the {{FeatureMap}} class in your test which also seems it would address the issue:

{code}
  @Override
  public void _save_to_cas_data() {
    FSArray<FeatureRecord> records = getFeatures();
    int featureCount = _features.size();

    // If there is no target array or it does not have the correct size, (re)create it.
    if (records == null || featureCount != records.size()) {
        records = new FSArray(this.getJCas(), featureCount);
    }

    // Fill in the values
    int i = 0;
    for (FeatureRecord record : _features.values()) {
      records.set(i++, record);
    }

    setFeatures(records);
  }
{code}

> CAS transportable Java object not serialised or deserialised with compressed binary
> -----------------------------------------------------------------------------------
>
>                 Key: UIMA-6295
>                 URL: https://issues.apache.org/jira/browse/UIMA-6295
>             Project: UIMA
>          Issue Type: Bug
>          Components: uimaj
>    Affects Versions: 3.1.1SDK
>         Environment: [^cas-transported-java-objects.zip]
>            Reporter: Mario Juric
>            Priority: Major
>         Attachments: cas-transported-java-objects.zip
>
>
> I have been experimenting with wrapping a CAS transportable Java HashMap inside an UIMA type, and I found that the internal UIMA FSArray is either not stored or restored, although _save_to_cas_data and _init_from_cas_data of UimaSerializableFSs are called during serialisation and deserialisation of a compressed CAS binary. I have not yet been able to pinpoint where it goes wrong, serialisation or deserialisation, but I attached a simple Maven project with a test that reproduces the problem. Notice that the test that uses XMI succeeds, while the one that uses SerialFormat.COMPRESSED_FILTERED_TS fails.
> [^cas-transported-java-objects.zip]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)