Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.4.1SDK
-
None
Description
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.
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()); } }