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

Jean-Noel Rouvignac
19.30.2014 377b2709c64b32fe93905b466482216c2cc0581c
opendj3-server-dev/src/server/org/opends/server/config/StringConfigAttribute.java
@@ -406,12 +406,12 @@
      {
        if (requiresAdminAction())
        {
          setPendingValues(new LinkedHashSet<AttributeValue>(0));
          setPendingValues(new LinkedHashSet<ByteString>(0));
          pendingValues = new ArrayList<String>();
        }
        else
        {
          setActiveValues(new LinkedHashSet<AttributeValue>(0));
          setActiveValues(new LinkedHashSet<ByteString>(0));
          activeValues.clear();
        }
      }
@@ -430,8 +430,7 @@
    // Iterate through all the provided values, make sure that they are
    // acceptable, and build the value set.
    LinkedHashSet<AttributeValue> valueSet =
         new LinkedHashSet<AttributeValue>(numValues);
    LinkedHashSet<ByteString> valueSet = new LinkedHashSet<ByteString>(numValues);
    for (String value : values)
    {
      if ((value == null) || (value.length() == 0))
@@ -440,10 +439,7 @@
        throw new ConfigException(message);
      }
      AttributeValue attrValue =
          AttributeValues.create(ByteString.valueOf(value),
              ByteString.valueOf(value));
      ByteString attrValue = ByteString.valueOf(value);
      if (valueSet.contains(attrValue))
      {
        LocalizableMessage message =
@@ -478,14 +474,10 @@
   *
   * @return  The constructed value set.
   */
  private static LinkedHashSet<AttributeValue> getValueSet(String value)
  private static LinkedHashSet<ByteString> getValueSet(String value)
  {
    LinkedHashSet<AttributeValue> valueSet =
         new LinkedHashSet<AttributeValue>(1);
    valueSet.add(AttributeValues.create(ByteString.valueOf(value),
        ByteString.valueOf(value)));
    LinkedHashSet<ByteString> valueSet = new LinkedHashSet<ByteString>(1);
    valueSet.add(ByteString.valueOf(value));
    return valueSet;
  }
@@ -498,22 +490,18 @@
   *
   * @return  The constructed value set.
   */
  private static LinkedHashSet<AttributeValue> getValueSet(List<String> values)
  private static LinkedHashSet<ByteString> getValueSet(List<String> values)
  {
    if (values == null)
    {
      return null;
    }
    LinkedHashSet<AttributeValue> valueSet =
         new LinkedHashSet<AttributeValue>(values.size());
    LinkedHashSet<ByteString> valueSet = new LinkedHashSet<ByteString>(values.size());
    for (String value : values)
    {
      valueSet.add(AttributeValues.create(ByteString.valueOf(value),
          ByteString.valueOf(value)));
      valueSet.add(ByteString.valueOf(value));
    }
    return valueSet;
  }
@@ -549,17 +537,15 @@
   * @return  <CODE>true</CODE> if the provided value is acceptable for use in
   *          this attribute, or <CODE>false</CODE> if not.
   */
  public boolean valueIsAcceptable(AttributeValue value,
  public boolean valueIsAcceptable(ByteString value,
                                   StringBuilder rejectReason)
  {
    // The only requirement is that the value is not null or empty.
    if ((value == null) || (value.getValue().toString().length() == 0))
    if (value == null || value.toString().length() == 0)
    {
      rejectReason.append(ERR_CONFIG_ATTR_EMPTY_STRING_VALUE.get(getName()));
      return false;
    }
    return true;
  }
@@ -584,7 +570,7 @@
   * @throws  ConfigException  If an unrecoverable problem occurs while
   *                           performing the conversion.
   */
  public LinkedHashSet<AttributeValue>
  public LinkedHashSet<ByteString>
              stringsToValues(List<String> valueStrings,
                              boolean allowFailures)
         throws ConfigException
@@ -598,7 +584,7 @@
      }
      else
      {
        return new LinkedHashSet<AttributeValue>();
        return new LinkedHashSet<ByteString>();
      }
    }
@@ -612,8 +598,7 @@
    }
    LinkedHashSet<AttributeValue> valueSet =
         new LinkedHashSet<AttributeValue>(numValues);
    LinkedHashSet<ByteString> valueSet = new LinkedHashSet<ByteString>(numValues);
    for (String valueString : valueStrings)
    {
      if ((valueString == null) || (valueString.length() == 0))
@@ -631,11 +616,9 @@
        }
      }
      valueSet.add(AttributeValues.create(ByteString.valueOf(valueString),
          ByteString.valueOf(valueString)));
      valueSet.add(ByteString.valueOf(valueString));
    }
    // If this method was configured to continue on error, then it is possible
    // that we ended up with an empty list.  Check to see if this is a required
    // attribute and if so deal with it accordingly.
@@ -645,7 +628,6 @@
      throw new ConfigException(message);
    }
    return valueSet;
  }
@@ -762,9 +744,9 @@
            }
            pendingValues = new ArrayList<String>(numValues);
            for (AttributeValue v : a)
            for (ByteString v : a)
            {
              pendingValues.add(v.getValue().toString());
              pendingValues.add(v.toString());
            }
          }
        }
@@ -815,9 +797,9 @@
          }
          activeValues = new ArrayList<String>(numValues);
          for (AttributeValue v : a)
          for (ByteString v : a)
          {
            activeValues.add(v.getValue().toString());
            activeValues.add(v.toString());
          }
        }
      }