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

jvergara
25.31.2008 a6cced8bf29418e2d5dabb836bd046d920ee3872
Fix for issue 3327 (cmd line returned by dsconfig with --displayCommand to create new attribute is invalid)

Analyze the type of the value that we committed. If it is a CommonSchemaElement use the oid of the element.
3 files modified
35 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java 6 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java 21 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
@@ -1468,7 +1468,7 @@
          INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
      for (Object value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+value);
        arg.addValue(propName+':'+getArgumentValue(value));
      }
      break;
    case SET:
@@ -1478,7 +1478,7 @@
          INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
      for (Object value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+value);
        arg.addValue(propName+':'+getArgumentValue(value));
      }
      break;
    case RESET:
@@ -1495,7 +1495,7 @@
          INFO_DSCFG_DESCRIPTION_REMOVE_PROP_VAL.get());
      for (Object value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+value);
        arg.addValue(propName+':'+getArgumentValue(value));
      }
      arg = null;
      break;
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
@@ -456,7 +456,7 @@
                            INFO_VALUE_SET_PLACEHOLDER.get(), null, null,
                            INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
                        arg.addValue(cvc.getPropertyDefinition().getName()+':'+
                            cvc.getValue());
                            getArgumentValue(cvc.getValue()));
                        builder.addArgument(arg);
                      }
                      catch (Throwable t)
@@ -972,7 +972,7 @@
          INFO_DSCFG_DESCRIPTION_REMOVE_PROP_VAL.get());
      for (Object value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+value);
        arg.addValue(propName+':'+getArgumentValue(value));
      }
      break;
    case ADD:
@@ -982,7 +982,7 @@
          INFO_DSCFG_DESCRIPTION_ADD_PROP_VAL.get());
      for (Object value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+value);
        arg.addValue(propName+':'+getArgumentValue(value));
      }
      break;
    case SET:
@@ -992,7 +992,7 @@
          INFO_DSCFG_DESCRIPTION_PROP_VAL.get());
      for (Object value : mod.getModificationValues())
      {
        arg.addValue(propName+':'+value);
        arg.addValue(propName+':'+getArgumentValue(value));
      }
      break;
    default:
opendj-sdk/opends/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
@@ -70,6 +70,7 @@
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.tools.ClientException;
import org.opends.server.types.CommonSchemaElements;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
@@ -1227,4 +1228,24 @@
    }
  }
  /**
   * Returns the string value for a given object as it will be displayed
   * in the equivalent command-line.
   * @param o the value.
   * @return the String value to be displayed in the equivalent command-line.
   */
  protected static String getArgumentValue(Object o)
  {
    String value;
    if (o instanceof CommonSchemaElements)
    {
      value = ((CommonSchemaElements)o).getOID();
    }
    else
    {
      value = String.valueOf(o);
    }
    return value;
  }
}