You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Jordan Zimmerman (JIRA)" <ji...@apache.org> on 2014/05/23 17:53:02 UTC

[jira] [Updated] (CURATOR-108) Wrong usage of Arrays.equals in DistributedAtomicValue for values equality test

     [ https://issues.apache.org/jira/browse/CURATOR-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jordan Zimmerman updated CURATOR-108:
-------------------------------------

    Fix Version/s: 2.5.0

> Wrong usage of Arrays.equals in DistributedAtomicValue for values equality test
> -------------------------------------------------------------------------------
>
>                 Key: CURATOR-108
>                 URL: https://issues.apache.org/jira/browse/CURATOR-108
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.4.2
>            Reporter: Alex Lopashev
>            Assignee: Jordan Zimmerman
>            Priority: Critical
>              Labels: easyfix
>             Fix For: 2.5.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Without setting value ZooKeeper DistributedAtomicValue instance returns byte[0]{} as its value, but in #compareAndSet method expectedValue is always non-zero-sized byte array, so in fresh new DistributedAtomicValue with no data in ZooKeeper node test Arrays.equals(byte[4]{0,0,0,0}, byte[0]{}) for integer and Arrays.equals(byte[8]{0,0,0,0,0,0,0,0}, byte[0]{}) will always fail. Solution is to not only check with Arrays.equals, but also if one of byte arrays is empty then check if second one has only zero elements.



--
This message was sent by Atlassian JIRA
(v6.2#6252)