You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2013/07/08 22:19:48 UTC
[jira] [Commented] (UIMA-3054) Binary CAS format 6 leaves document
text "null" after deserializing
[ https://issues.apache.org/jira/browse/UIMA-3054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13702367#comment-13702367 ]
Marshall Schor commented on UIMA-3054:
--------------------------------------
This is an actual bug. It was missed in the test cases because they didn't have a case where the sofa occurred after some other feature structure.
The bug: (for the curious, only:) In form 6, there's a translation from absolute FS addresses to a sequence number, which is serialized. This is done for multiple reasons; there needs to be a corresponding reverse-translation when deserializing. This was missing but just for the case of a sofa FS which are handled specially.
> Binary CAS format 6 leaves document text "null" after deserializing
> -------------------------------------------------------------------
>
> Key: UIMA-3054
> URL: https://issues.apache.org/jira/browse/UIMA-3054
> Project: UIMA
> Issue Type: Bug
> Components: Core Java Framework
> Affects Versions: 2.4.1SDK
> Reporter: Richard Eckart de Castilho
> Assignee: Marshall Schor
>
> Binary CAS format 6 leaves document text "null" after deserializing.
> On my machine (uimaj 2.4.1-SNAPSHOT) this fails in the last line, claiming that "test" is not equal to null.
> {code}
> import static org.junit.Assert.assertEquals;
> import static org.junit.Assert.assertTrue;
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.FileOutputStream;
> import java.io.InputStream;
> import java.io.OutputStream;
> import org.apache.commons.io.IOUtils;
> import org.apache.uima.cas.CAS;
> import org.apache.uima.cas.impl.Serialization;
> import org.apache.uima.resource.metadata.TypeSystemDescription;
> import org.apache.uima.util.CasCreationUtils;
> import org.junit.Rule;
> import org.junit.Test;
> import org.junit.rules.TemporaryFolder;
> public class MinimalTest
> {
> @Rule
> public TemporaryFolder testFolder = new TemporaryFolder();
> @Test
> public void test6()
> throws Exception
> {
> CAS cas = CasCreationUtils.createCas((TypeSystemDescription) null, null, null);
> cas.setDocumentLanguage("latin");
> cas.setDocumentText("test");
> File file = testFolder.newFile("test.bin");
>
> OutputStream os = new FileOutputStream(file);
> Serialization.serializeWithCompression(cas, os, cas.getTypeSystem());
> IOUtils.closeQuietly(os);
> assertTrue(new File(testFolder.getRoot(), "test.bin").exists());
>
> CAS cas2 = CasCreationUtils.createCas((TypeSystemDescription) null, null, null);
> InputStream is = new FileInputStream(file);
> Serialization.deserializeCAS(cas2, is);
> IOUtils.closeQuietly(is);
> assertEquals("latin", cas2.getDocumentLanguage());
> assertEquals("test", cas2.getDocumentText());
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira