mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jcduff
23.04.2008 f73b655466092169abac34833fb628fce1fcdebe
opends/src/server/org/opends/server/backends/jeb/EqualityIndexer.java
@@ -157,34 +157,6 @@
  }
  /**
   * Generate the set of index keys for a set of attribute values.
   * @param values The set of attribute values to be indexed.
   * @param keys The set into which the keys will be inserted.
   */
  private void indexValues(Set<AttributeValue> values,
                           Set<byte[]> keys)
  {
    if (values == null) return;
    for (AttributeValue value : values)
    {
      try
      {
        byte[] keyBytes = value.getNormalizedValue().value();
        keys.add(keyBytes);
      }
      catch (DirectoryException e)
      {
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
        }
      }
    }
  }
  /**
   * Generate the set of index keys for an attribute.
   * @param attrList The attribute to be indexed.
   * @param keys The set into which the keys will be inserted.
@@ -196,7 +168,22 @@
    for (Attribute attr : attrList)
    {
      indexValues(attr.getValues(), keys);
      for (AttributeValue value : attr)
      {
        try
        {
          byte[] keyBytes = value.getNormalizedValue().value();
          keys.add(keyBytes);
        }
        catch (DirectoryException e)
        {
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }
        }
      }
    }
  }
@@ -216,45 +203,28 @@
    for (Attribute attr : attrList)
    {
      indexValues(attr.getValues(), modifiedKeys, insert);
    }
  }
  /**
   * Generate the set of index keys for a set of attribute values.
   * @param values The set of attribute values to be indexed.
   * @param modifiedKeys The map into which the modified
   *  keys will be inserted.
   * @param insert <code>true</code> if generated keys should
   * be inserted or <code>false</code> otherwise.
   */
  private void indexValues(Set<AttributeValue> values,
                           Map<byte[], Boolean> modifiedKeys,
                           Boolean insert)
  {
    if (values == null) return;
    for (AttributeValue value : values)
    {
      try
      for (AttributeValue value : attr)
      {
        byte[] keyBytes = value.getNormalizedValue().value();
        try
        {
          byte[] keyBytes = value.getNormalizedValue().value();
        Boolean cInsert = modifiedKeys.get(keyBytes);
        if(cInsert == null)
        {
          modifiedKeys.put(keyBytes, insert);
          Boolean cInsert = modifiedKeys.get(keyBytes);
          if(cInsert == null)
          {
            modifiedKeys.put(keyBytes, insert);
          }
          else if(!cInsert.equals(insert))
          {
            modifiedKeys.remove(keyBytes);
          }
        }
        else if(!cInsert.equals(insert))
        catch (DirectoryException e)
        {
          modifiedKeys.remove(keyBytes);
        }
      }
      catch (DirectoryException e)
      {
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }
        }
      }
    }