Uploaded image for project: 'Apache Curator'
  1. Apache Curator
  2. CURATOR-108

Wrong usage of Arrays.equals in DistributedAtomicValue for values equality test

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.4.2
    • 2.5.0
    • Recipes

    Description

      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.

      Attachments

        Activity

          People

            randgalt Jordan Zimmerman
            alexlopashev Alex Lopashev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified