You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladimir Ermakov (Jira)" <ji...@apache.org> on 2021/12/06 14:17:00 UTC
[jira] [Resolved] (IGNITE-16062) Support binary HANLDEs: Unable read object array twice.
[ https://issues.apache.org/jira/browse/IGNITE-16062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Ermakov resolved IGNITE-16062.
---------------------------------------
Resolution: Duplicate
> Support binary HANLDEs: Unable read object array twice.
> -------------------------------------------------------
>
> Key: IGNITE-16062
> URL: https://issues.apache.org/jira/browse/IGNITE-16062
> Project: Ignite
> Issue Type: Bug
> Reporter: Vladimir Ermakov
> Assignee: Vladimir Ermakov
> Priority: Major
>
> "Looks like this commit introduce a blocker.
> Second read of array field fail and read some garbage.
> This happen because when object read with handle stream position don't move to the end of already deserialized object.
> So second array element is just random bytes from the middle of the stream."
>
> Reproducer:
> {code:java}
> /** */
> @Test
> public void testArrayFieldSeveralRead() throws Exception {
> try (Ignite ignite = startGrid(1)) {
> TestClass1[] expArr = new TestClass1[] {new TestClass1(), new TestClass1()};
> BinaryObject arrObj = ignite.binary().toBinary(new TestClsWithArray(expArr));
> for (int i = 0; i < 10; i++)
> Assert.assertArrayEquals(i + " iteration", expArr, PlatformUtils.unwrapBinariesInArray(arrObj.field("arr")));
> arrObj = ignite.binary().builder(TestClsWithArray.class.getName()).setField("arr", expArr).build();
> for (int i = 0; i < 10; i++)
> Assert.assertArrayEquals(i + " iteration", expArr, PlatformUtils.unwrapBinariesInArray(arrObj.field("arr")));
> }
> finally {
> clearBinaryMeta();
> }
> }
> /** Test class with array. */
> public static class TestClsWithArray {
> /** */
> private final Object[] arr;
> /** */
> public TestClsWithArray(TestClass1[] arr) {
> this.arr = arr;
> }
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)