[
https://issues.apache.org/jira/browse/IGNITE-16349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Evgeny Stanilovsky updated IGNITE-16349:
----------------------------------------
Description:
After merging IGNITE-15462 NPE is possible caused by differences in return vals.
For example code like :
{noformat}
final Int2ObjectOpenHashMap<List<Integer>> targets = new
Int2ObjectOpenHashMap<>();
...
final Collection<Integer> integers = targets.get(ifc.getFieldIndex());
if (integers.isEmpty()) <- possible NPE
{noformat}
due to difference between:
Multimap#get
{noformat}
/**
* Returns a view collection of the values associated with {@code key} in
this multimap, if any.
* Note that when {@code containsKey(key)} is false, this returns an empty
collection, not {@code
* null}.
*
* <p>Changes to the returned collection will update the underlying multimap,
and vice versa.
*/
Collection<V> get(@Nullable K key);
{noformat}
and
Int2ObjectOpenHashMap#get
{noformat}
Returns:
the corresponding value, or the default return value if no value was present
for the given key.
V defaultReturnValue()
Gets the default return value.
This default implementation just return the default null value of the type
(null for objects, 0 for scalars, false for Booleans).
{noformat}
was:
After merging IGNITE-15462 NPE is possible caused by differen in return vals.
For example code like :
{noformat}
final Int2ObjectOpenHashMap<List<Integer>> targets = new
Int2ObjectOpenHashMap<>();
...
final Collection<Integer> integers = targets.get(ifc.getFieldIndex());
if (integers.isEmpty()) <- possible NPE
{noformat}
due to difference between:
Multimap#get
{noformat}
/**
* Returns a view collection of the values associated with {@code key} in
this multimap, if any.
* Note that when {@code containsKey(key)} is false, this returns an empty
collection, not {@code
* null}.
*
* <p>Changes to the returned collection will update the underlying multimap,
and vice versa.
*/
Collection<V> get(@Nullable K key);
{noformat}
and
Int2ObjectOpenHashMap#get
{noformat}
Returns:
the corresponding value, or the default return value if no value was present
for the given key.
V defaultReturnValue()
Gets the default return value.
This default implementation just return the default null value of the type
(null for objects, 0 for scalars, false for Booleans).
{noformat}
> Sql. Check for potential NPE after IGNITE-15462.
> ------------------------------------------------
>
> Key: IGNITE-16349
> URL: https://issues.apache.org/jira/browse/IGNITE-16349
> Project: Ignite
> Issue Type: Bug
> Components: sql
> Reporter: Evgeny Stanilovsky
> Assignee: Vladimir Ermakov
> Priority: Major
> Labels: calcite3-required, ignite-3
>
> After merging IGNITE-15462 NPE is possible caused by differences in return
> vals.
> For example code like :
> {noformat}
> final Int2ObjectOpenHashMap<List<Integer>> targets = new
> Int2ObjectOpenHashMap<>();
> ...
> final Collection<Integer> integers = targets.get(ifc.getFieldIndex());
> if (integers.isEmpty()) <- possible NPE
> {noformat}
> due to difference between:
> Multimap#get
> {noformat}
> /**
> * Returns a view collection of the values associated with {@code key} in
> this multimap, if any.
> * Note that when {@code containsKey(key)} is false, this returns an empty
> collection, not {@code
> * null}.
> *
> * <p>Changes to the returned collection will update the underlying
> multimap, and vice versa.
> */
> Collection<V> get(@Nullable K key);
> {noformat}
> and
> Int2ObjectOpenHashMap#get
> {noformat}
> Returns:
> the corresponding value, or the default return value if no value was present
> for the given key.
> V defaultReturnValue()
> Gets the default return value.
> This default implementation just return the default null value of the type
> (null for objects, 0 for scalars, false for Booleans).
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)