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

jcduff
23.04.2008 f73b655466092169abac34833fb628fce1fcdebe
opends/src/server/org/opends/server/backends/jeb/ApproximateIndexer.java
@@ -128,8 +128,6 @@
    indexAttribute(newAttributes, modifiedKeys, true);
  }
  /**
   * Generate the set of index keys to be added and the set of index keys
   * to be deleted for an entry that was modified.
@@ -162,34 +160,21 @@
    for (Attribute attr : attrList)
    {
      indexValues(attr.getValues(), keys);
    }
  }
  /**
   * 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
      for (AttributeValue value : attr)
      {
        byte[] keyBytes =
             approximateRule.normalizeValue(value.getValue()).value();
        keys.add(keyBytes);
      }
      catch (DirectoryException e)
      {
        if (debugEnabled())
        try
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
          byte[] keyBytes =
               approximateRule.normalizeValue(value.getValue()).value();
          keys.add(keyBytes);
        }
        catch (DirectoryException e)
        {
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }
        }
      }
    }
@@ -211,46 +196,29 @@
    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 =
            approximateRule.normalizeValue(value.getValue()).value();
        try
        {
          byte[] keyBytes =
              approximateRule.normalizeValue(value.getValue()).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);
          }
        }
      }
    }