You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (JIRA)" <ji...@apache.org> on 2016/06/02 15:19:59 UTC
[jira] [Updated] (IGNITE-3240) Arrays do not deserialize properly
[ https://issues.apache.org/jira/browse/IGNITE-3240?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Tupitsyn updated IGNITE-3240:
-----------------------------------
Description:
Code to reproduce:
{code}
IgniteCache<Integer, String[]> cache = ignite.getOrCreateCache(CACHE_NAME);
cache.put(1, new String[]{"hello", "world"});
String[] res = cache.get(1);
{code}
The bug is in CacheObjectContext.unwrapBinariesInArrayIfNeeded method, which always produces a new array.
We should check for basic types somehow and skip this conversion.
Generally, we NEVER want to change the type of the array, so the fix may be:
{code}
if (arr.getClass().getComponentType() != Object.class)
return arr;
{code}
was:
Code to reproduce:
{code}
IgniteCache<Integer, String[]> cache = ignite.getOrCreateCache(CACHE_NAME);
cache.put(1, new String[]{"omg", "wtf"});
String[] res = cache.get(1);
{code}
The bug is in CacheObjectContext.unwrapBinariesInArrayIfNeeded method, which always produces a new array.
We should check for basic types somehow and skip this conversion.
Generally, we NEVER want to change the type of the array, so the fix may be:
{code}
if (arr.getClass().getComponentType() != Object.class)
return arr;
{code}
> Arrays do not deserialize properly
> ----------------------------------
>
> Key: IGNITE-3240
> URL: https://issues.apache.org/jira/browse/IGNITE-3240
> Project: Ignite
> Issue Type: Bug
> Components: binary, cache
> Affects Versions: 1.1.4
> Reporter: Pavel Tupitsyn
> Assignee: Denis Magda
> Priority: Blocker
> Fix For: 1.7
>
>
> Code to reproduce:
> {code}
> IgniteCache<Integer, String[]> cache = ignite.getOrCreateCache(CACHE_NAME);
> cache.put(1, new String[]{"hello", "world"});
> String[] res = cache.get(1);
> {code}
> The bug is in CacheObjectContext.unwrapBinariesInArrayIfNeeded method, which always produces a new array.
> We should check for basic types somehow and skip this conversion.
> Generally, we NEVER want to change the type of the array, so the fix may be:
> {code}
> if (arr.getClass().getComponentType() != Object.class)
> return arr;
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)